折腾:
期间,代码配置:
.babelrc
{ “presets”: [ “env”, “stage-0”, “react”, “es2015”, “stage-1” ], “plugins”: [ “transform-decorators-legacy”, “transform-runtime”, “react-hot-loader/babel” ] } |
npm run dev出错:
ERROR in ./src/app.entry.js Module build failed: Error: Couldn’t find preset “es2015” relative to directory “/Users/crifan/dev/dev_root/xxx” at /Users/crifan/dev/dev_root/xxx/node_modules/babel-core/lib/transformation/file/options/option-manager.js:293:19 at Array.map (native) at OptionManager.resolvePresets (/Users/crifan/dev/dev_root/xxx/node_modules/babel-core/lib/transformation/file/options/option-manager.js:275:20) at OptionManager.mergePresets (/Users/crifan/dev/dev_root/xxx/node_modules/babel-core/lib/transformation/file/options/option-manager.js:264:10) at OptionManager.mergeOptions (/Users/crifan/dev/dev_root/xxx/node_modules/babel-core/lib/transformation/file/options/option-manager.js:249:14) at OptionManager.init (/Users/crifan/dev/dev_root/xxx/node_modules/babel-core/lib/transformation/file/options/option-manager.js:368:12) at File.initOptions (/Users/crifan/dev/dev_root/xxx/node_modules/babel-core/lib/transformation/file/index.js:212:65) at new File (/Users/crifan/dev/dev_root/xxx/node_modules/babel-core/lib/transformation/file/index.js:135:24) at Pipeline.transform (/Users/crifan/dev/dev_root/xxx/node_modules/babel-core/lib/transformation/pipeline.js:46:16) at transpile (/Users/crifan/dev/dev_root/xxx/node_modules/babel-loader/lib/index.js:49:20) at Object.module.exports (/Users/crifan/dev/dev_root/xxx/node_modules/babel-loader/lib/index.js:174:20) @ multi (webpack)-dev-server/client?http://localhost:4000 webpack/hot/dev-server ./src/app.entry.js |
Error: Couldn’t find preset “es2015” relative to directory
新手遇到问题 Couldn’t find preset “es2015” relative to directory · Issue #3 · 94dreamer/webpack
Couldn’t find preset “es2015” relative to directory · Issue #158 · JeffreyWay/laravel-mix
Couldn’t find preset “es2015” relative to directory · Issue #93 · babel/gulp-babel
去安装:
babel-preset-es2015
babel-preset-stage-2
npm install babel-preset-es2015 babel-preset-stage-2
➜ rse_web git:(master) ✗ npm install babel-preset-es2015 babel-preset-stage-2 npm WARN deprecated [email protected]: 🙌 Thanks for using Babel: we recommend using babel-preset-env now: please read babeljs.io/env to update! [email protected] /Users/crifan/dev/dev_root/xxx │ └── [email protected] │ └─┬ [email protected] │ └── [email protected] │ └── [email protected] npm WARN [email protected] requires a peer of react@^15.6.1 but none was installed. npm WARN [email protected] requires a peer of react@^15.5.4 but none was installed. npm WARN [email protected] requires a peer of react-dom@^15.5.4 but none was installed. npm WARN [email protected] requires a peer of react@^15.5.4 but none was installed. npm WARN [email protected] requires a peer of react-dom@^15.5.4 but none was installed. |
【总结】
此处去安装:
npm install babel-preset-es2015 babel-preset-stage-2
即可消除警告:
Module build failed Error Couldn’t find preset es2015 relative to directory
转载请注明:在路上 » 【已解决】ReactJS中使用Mobx出错:Module build failed Error Couldn’t find preset es2015 relative to directory