Aurelia构建失败 - 无法找到模块babel-runtime

时间:2016-12-19 22:10:11

标签: node.js npm aurelia aurelia-cli

我在Aurelia CLI回购中创建了一个issue,但我想在这里以防万一。我在Windows 7上使用节点7.2.1和npm 4.0.5。链接的问题包含有关依赖项版本的详细信息。

当我尝试通过au build进行构建时,我收到以下错误消息。我试过从头开始:

  1. 使用nvm(节点7.2.1)
  2. 安装最新节点版本
  3. npm install npm -g(npm@4.0.5)
  4. npm install aurelia-cli -g(aurelia-cli@0.23.0)
  5. npm install
  6. au build
  7. > 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,但这不起作用。

1 个答案:

答案 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来解决这个问题。应尽快接受。