webpack报错Module build failed: TypeError: fileSystem.statSync is not a function

跟着视频操作,删掉node_modules目录后,执行webpack报错

ERROR in ./src/js/index.js
Module build failed: TypeError: fileSystem.statSync is not a function
    at module.exports (/Users/mac/source/9-01/node_modules/babel-loader/lib/utils/exists.js:7:25)
    at find (/Users/mac/source/9-01/node_modules/babel-loader/lib/resolve-rc.js:13:9)
    at Object.module.exports (/Users/mac/source/9-01/node_modules/babel-loader/lib/index.js:113:132)
百度了一下,有人说是因为 webpack版本不一致导致。所以重新安装了

npm install webpack --save-dev
执行这一步时出现很多警告
npm notice save webpack is being moved from dependencies to devDependencies
npm WARN [email protected] requires a peer of webpack@2 || 3 but none is installed. You must install peer dependencies yourself.
npm WARN [email protected] requires a peer of jquery@>=1.8.0 but none is installed. You must install peer dependencies yourself.
npm WARN [email protected] No description
npm WARN [email protected] No repository field.
大意为 babel-loader这个版本需要更高级的webpack,于是执行下面语句安装3.0版
npm install [email protected] --save-dev
再执行webpack就运行成功了。

猜你喜欢

转载自blog.csdn.net/weixin_38049458/article/details/79200724
今日推荐