我在Aurelia CLI回购中创建了一个issue,但我想在这里以防万一。我在Windows 7上使用节点7.2.1和npm 4.0.5。链接的问题包含有关依赖项版本的详细信息。
当我尝试通过au build
进行构建时,我收到以下错误消息。我试过从头开始:
npm install npm -g
(npm@4.0.5)npm install aurelia-cli -g
(aurelia-cli@0.23.0)npm install
au build
> au build
resolve failed: { Error: Cannot find module 'babel-runtime'
at Function.Module._resolveFilename (module.js:470:15)
at Function.requireRelative.resolve (C:\myworkingdir\node_modules\require-relative\index.js:30:17)
at resolve (C:\myworkingdir\node_modules\modify-babel-preset\lib\serialize.js:26:26)
at findAndRemove (C:\myworkingdir\node_modules\modify-babel-preset\lib\serialize.js:83:11)
at C:\myworkingdir\node_modules\modify-babel-preset\lib\serialize.js:126:13
at Array.map (native)
at loadPreset (C:\myworkingdir\node_modules\modify-babel-preset\lib\serialize.js:118:29)
at module.exports (C:\myworkingdir\node_modules\modify-babel-preset\index.js:95:19)
at Object.<anonymous> (C:\myworkingdir\node_modules\babel-preset-es2015-loose\index.js:5:18)
at Module._compile (module.js:571:32)
at Module._extensions..js (module.js:580:10)
at Object.require.extensions.(anonymous function) [as .js] (C:\myworkingdir\node_modules\babel-register\lib\node.js:152:7)
at Module.load (module.js:488:32)
at tryModuleLoad (module.js:447:12)
at Function.Module._load (module.js:439:3)
at Module.require (module.js:498:17) code: 'MODULE_NOT_FOUND' } babel-runtime
C:\myworkingdir\node_modules\babel-core\lib\transformation\file\options\option-manager.js:334
throw e;
^
TypeError: Cannot read property 'displayName' of undefined (While processing preset: "C:\\myworkingdir\\node_modules\\babel-preset-es2015-loose\\index.js")
我明确地尝试了npm install babel-runtime
,但这不起作用。
答案 0 :(得分:3)
罪魁祸首是我更新到 babel-preset-es2015-loose@8.0.0 (最初Aurelia CLI在^7.0.0
处有)。如果使用 babel-preset-es2015@6.13.0 或更高版本,该项目现在为deprecated。
从package.json
删除 babel-preset-es2015-loose 并使用该链接中的新preset
配置(在.babelrc
文件中)允许Aurelia构建试。
有pull request来解决这个问题。应尽快接受。