简体   繁体   中英

Aurelia build fails - cannot find module babel-runtime

I created an issue at the Aurelia CLI repo, but figured I would ask here just in case. I'm on Windows 7 with node 7.2.1 and npm 4.0.5. The linked issue has details about dependency versions.

When I try to build via au build I get the error below. I have tried starting from scratch:

  1. Install latest node version using nvm (node 7.2.1)
  2. npm install npm -g (npm@4.0.5)
  3. npm install aurelia-cli -g (aurelia-cli@0.23.0)
  4. npm install
  5. 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")

I tried npm install babel-runtime explicitly, but that does not work.

The culprit was when I updated to babel-preset-es2015-loose@8.0.0 (originally Aurelia CLI has it at ^7.0.0 ). That project is now deprecated if using babel-preset-es2015@6.13.0 or above.

Removing babel-preset-es2015-loose from package.json and using the new preset configuration from that link (in .babelrc file) allows Aurelia to build again.

Update

There's a pull request to fix this. Should be accepted soon.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM