Error upgrading text plugin for Aurelia CLI 0.20.2

2019-09-14 00:08发布

问题:

I'm trying to upgrade my aurelia.json file for changes from v0.20.2 to v0.23.0, within an ASP.NET Core project.

I've installed the requirejs and text packages via npm install requirejs text --save, which are now external dependencies.

All changes are working fine, except for the text plugin, when I replace the old version:

{
    "name": "text",
    "path": "../wwwroot/scripts/text"
}

with the string "text" as per the changelog notes, I get this error from au build:

2>  Starting 'readProjectConfiguration'...
2>  { uid: 1,
2>    name: 'readProjectConfiguration',
2>    branch: false,
2>DNX : error :
2>     TypeError: Path must be a string. Received undefined
2>         at assertPath (path.js:7:11)
2>         at Object.join (path.js:466:7)
2>         at determineLoaderConfig (C:\Source\Octet.Platform\Octet.Portal\node_modules\aurelia-cli\lib\build\package-analyzer.js:57:31)
2>         at loadPackageMetadata.then (C:\Source\Octet.Platform\Octet.Portal\node_modules\aurelia-cli\lib\build\package-analyzer.js:15:19),
2>    duration: [ 0, 13672805 ],
2>    time: 1481183098363 }
2>  { uid: 0,
2>    name: '<series>',
2>    branch: true,
2>DNX : error :
2>     TypeError: Path must be a string. Received undefined
2>         at assertPath (path.js:7:11)
2>         at Object.join (path.js:466:7)
2>         at determineLoaderConfig (C:\Source\Octet.Platform\Octet.Portal\node_modules\aurelia-cli\lib\build\package-analyzer.js:57:31)
2>         at loadPackageMetadata.then (C:\Source\Octet.Platform\Octet.Portal\node_modules\aurelia-cli\lib\build\package-analyzer.js:15:19),
2>    duration: [ 0, 26563957 ],
2>    time: 1481183098375 }
2>  TypeError: Path must be a string. Received undefined
2>      at assertPath (path.js:7:11)
2>      at Object.join (path.js:466:7)
2>      at determineLoaderConfig (C:\Source\Octet.Platform\Octet.Portal\node_modules\aurelia-cli\lib\build\package-analyzer.js:57:31)
2>      at loadPackageMetadata.then (C:\Source\Octet.Platform\Octet.Portal\node_modules\aurelia-cli\lib\build\package-analyzer.js:15:19)

Any idea how to fix this error, or can I just continue to use the previous configuration?

回答1:

I found the problem. I installed the wrong NPM package, it should have been requirejs/text, NOT text, so my package update script is npm install requirejs requirejs/text --save.

I found this pretty confusing as someone new to NPM.