我已按照文档中有关如何将客户端库添加到aurelia-cli项目的说明进行操作。我能够添加其中几个,包括bootstrap。但是,当我尝试添加estraverse.js时,使用此日志构建失败:
Starting 'readProjectConfiguration'...
Finished 'readProjectConfiguration'
Starting 'processMarkup'...
Starting 'processCSS'...
Starting 'configureEnvironment'...
Finished 'processCSS'
Finished 'processMarkup'
Finished 'configureEnvironment'
Starting 'buildJavaScript'...
Finished 'buildJavaScript'
Starting 'writeBundles'...
Tracing app...
{ uid: 9,
name: 'writeBundles',
branch: false,
error:
{ Error: ENOENT: no such file or directory,
open 'C:\Users\abdulaziz\Downloads\newProject\life-code\src\package.json.js'
at Error (native)
at Object.fs.openSync (fs.js:634:18)
at Object.fs.readFileSync (fs.js:502:33)
at Object.exports.readFileSync (C:\Users\abdulaziz\Downloads\newProject\life-code\node_modules\aurelia-cli\lib\file-system.js:38:13)
at amodroTrace.fileRead (C:\Users\abdulaziz\Downloads\newProject\life-code\node_modules\aurelia-cli\lib\build\bundled-source.js:83:31)
at Object.context.fileRead (C:\Users\abdulaziz\Downloads\newProject\life-code\node_modules\aurelia-cli\lib\build\amodro-trace\lib\loader\Loader.js:176:18)
at Object.context.load (C:\Users\abdulaziz\Downloads\newProject\life-code\node_modules\aurelia-cli\lib\build\amodro-trace\lib\loader\Loader.js:357:30)
at Object.Module.load (eval at <anonymous> (C:\Users\abdulaziz\Downloads\newProject\life-code\node_modules\aurelia-cli\lib\build\amodro-trace\lib\loader\Loader.js:14:9), <anonymous>:832:29)
at Object.Module.fetch (eval at <anonymous> (C:\Users\abdulaziz\Downloads\newProject\life-code\node_modules\aurelia-cli\lib\build\amodro-trace\lib\loader\Loader.js:14:9), <anonymous>:822:66)
at Object.Module.check (eval at <anonymous> (C:\Users\abdulaziz\Downloads\newProject\life-code\node_modules\aurelia-cli\lib\build\amodro-trace\lib\loader\Loader.js:14:9), <anonymous>:854:30)
errno: -4058,
code: 'ENOENT',
syscall: 'open',
path: 'C:\\Users\\abdulaziz\\Downloads\\newProject\\life-code\\src\\package.json.js',
moduleTree: [ 'estraverse' ],
fileName: 'C:/Users/abdulaziz/Downloads/newProject/life-code/node_modules/estraverse/estraverse.js' },
duration: [ 1, 52233832 ],
time: 1471898227440 }
我认为它试图加载.json文件但是没有这样做。任何人都知道如何解决这个问题?
这是我的尝试: 在Aurelia.json中,我在加载器部分添加了.json插件:
"loader": {
"type": "require",
"configTarget": "vendor-bundle.js",
"includeBundleMetadataInConfig": "auto",
"plugins": [
{
"name": "text",
"extensions": [
".html",
".css",
".json"
],
"stub": true
}
]
},
但没有用!