为什么出现这种BUG

来源:4-3 使用babel-loader 转换 ES6 代码 (下)

箭喜Video

2017-02-24 18:43

ERROR in Entry module not found: Error: Can't resolve 'babel' in 'D:\趣丸\WebPack\webpack-demo'

BREAKING CHANGE: It's no longer allowed to omit the '-loader' suffix when using loaders.

                 You need to specify 'babel-loader' instead of 'babel'.


ERROR in   Error: Child compilation failed:

  Module not found: Error: Can't resolve 'babel' in 'D:\趣丸\WebPack\webpack-demo'  BREAKING CHANGE: It's no longer allowed to omit the '-loader' suffix when usin  g loaders.

                   You need to specify 'babel-loader' instead of 'babel'.:

  Error: Can't resolve 'babel' in 'D:\趣丸\WebPack\webpack-demo'

  BREAKING CHANGE: It's no longer allowed to omit the '-loader' suffix when usin  g loaders.

                   You need to specify 'babel-loader' instead of 'babel'.


  - compiler.js:76

    [webpack-demo]/[html-webpack-plugin]/lib/compiler.js:76:16


  - Compiler.js:280 Compiler.<anonymous>

    [webpack-demo]/[webpack]/lib/Compiler.js:280:10


  - Compiler.js:480

    [webpack-demo]/[webpack]/lib/Compiler.js:480:13


  - Tapable.js:138 next

    [webpack-demo]/[tapable]/lib/Tapable.js:138:11


  - CachePlugin.js:62 Compiler.<anonymous>

    [webpack-demo]/[webpack]/lib/CachePlugin.js:62:5


  - Tapable.js:142 Compiler.applyPluginsAsyncSeries

    [webpack-demo]/[tapable]/lib/Tapable.js:142:13


  - Compiler.js:477

    [webpack-demo]/[webpack]/lib/Compiler.js:477:10


  - Tapable.js:131 Compilation.applyPluginsAsyncSeries

    [webpack-demo]/[tapable]/lib/Tapable.js:131:46


  - Compilation.js:640

    [webpack-demo]/[webpack]/lib/Compilation.js:640:19


  - Tapable.js:131 Compilation.applyPluginsAsyncSeries

    [webpack-demo]/[tapable]/lib/Tapable.js:131:46


  - Compilation.js:631

    [webpack-demo]/[webpack]/lib/Compilation.js:631:11


  - Tapable.js:131 Compilation.applyPluginsAsyncSeries

    [webpack-demo]/[tapable]/lib/Tapable.js:131:46


  - Compilation.js:626

    [webpack-demo]/[webpack]/lib/Compilation.js:626:10


  - Tapable.js:131 Compilation.applyPluginsAsyncSeries

    [webpack-demo]/[tapable]/lib/Tapable.js:131:46


  - Compilation.js:622 sealPart2

    [webpack-demo]/[webpack]/lib/Compilation.js:622:9


  - Tapable.js:131 Compilation.applyPluginsAsyncSeries

    [webpack-demo]/[tapable]/lib/Tapable.js:131:46


  - Compilation.js:570 Compilation.seal

    [webpack-demo]/[webpack]/lib/Compilation.js:570:8


  - Compiler.js:474

    [webpack-demo]/[webpack]/lib/Compiler.js:474:16


  - Tapable.js:225

    [webpack-demo]/[tapable]/lib/Tapable.js:225:11


  - Compilation.js:472

    [webpack-demo]/[webpack]/lib/Compilation.js:472:11


  - Compilation.js:443

    [webpack-demo]/[webpack]/lib/Compilation.js:443:13


  - next_tick.js:67 _combinedTickCallback

    internal/process/next_tick.js:67:7


  - next_tick.js:98 process._tickCallback

    internal/process/next_tick.js:98:9



Child html-webpack-plugin for "index.html":

       [0] ./~/html-webpack-plugin/lib/loader.js!./index.html 508 bytes {0} [built]


    ERROR in ./~/html-webpack-plugin/lib/loader.js!./index.html

    Module not found: Error: Can't resolve 'babel' in 'D:\趣丸\WebPack\webpack-demo'

    BREAKING CHANGE: It's no longer allowed to omit the '-loader' suffix when using loaders.

                     You need to specify 'babel-loader' instead of 'babel'.

     @ ./~/html-webpack-plugin/lib/loader.js!./index.html 1:8-50


npm ERR! Windows_NT 6.1.7601

npm ERR! argv "D:\\nodeJS\\node.exe" "C:\\Users\\Administrator\\AppData\\Roaming\\npm\\node_modules\\npm\\bin\\npm-cli.js" "run" "webpack"

npm ERR! node v5.10.1

npm ERR! npm  v4.1.2

npm ERR! code ELIFECYCLE

npm ERR! webpack-demo@1.0.0 webpack: `webpack --config webpack.config.js --progress --display-modules --colors`

npm ERR! Exit status 2

npm ERR!

npm ERR! Failed at the webpack-demo@1.0.0 webpack script 'webpack --config webpack.config.js --progress --display-modules --colors'.

npm ERR! Make sure you have the latest version of node.js and npm installed.

npm ERR! If you do, this is most likely a problem with the webpack-demo package,

npm ERR! not with npm itself.

npm ERR! Tell the author that this fails on your system:

npm ERR!     webpack --config webpack.config.js --progress --display-modules --colors

npm ERR! You can get information on how to open an issue for this project with:

npm ERR!     npm bugs webpack-demo

npm ERR! Or if that isn't available, you can get their info via:

npm ERR!     npm owner ls webpack-demo

npm ERR! There is likely additional logging output above.


npm ERR! Please include the following file with any support request:

npm ERR!     D:\趣丸\WebPack\webpack-demo\npm-debug.log


写回答 关注

7回答

  • qbaty
    2017-02-24 20:36:46

    You need to specify 'babel-loader' instead of 'babel'. 
    他这里说了,你用的是什么版本?

    严寒对酷暑

    老师,这是在哪里修改,我找不到

    2018-01-11 10:35:45

    共 2 条回复 >

  • 侠非
    2017-12-06 14:00:05

    loader: 'babel', 改成 loader: 'babel-loader',

  • qq_晒黑了吧孩子_0
    2017-11-23 15:01:23

    我也是这个错

  • qq_谜离_03319966
    2017-08-24 14:35:29

     loader: 'babel', 改成了 loader: 'babel-loader',

    依然报这个错

    UncleH...

    你解决了吗?我也是这个错

    2017-09-27 09:21:17

    共 1 条回复 >

  • sohucw
    2017-03-05 21:58:19

    webpack2要求必须加-loader了


     loader: 'babel', 改成 loader: 'babel-loader',

  • ahao430
    2017-02-27 00:35:56

    webpack2要求必须加-loader了

  • 者行孙
    2017-02-26 12:49:57

    配置的loader名称改为下面的就行了

      loader: 'babel-loader',

    严寒对酷暑

    是什么意思,在哪里修改?

    2018-01-11 10:11:26

    共 1 条回复 >

webpack深入与实战

webpack实战教程,用真实项目带你探索 webpack 强大的功能

86555 学习 · 750 问题

查看课程

相似问题