Module build failed (from ./node_modules/sass-loader/dist/cjs.js)

react  报错

ERROR in ./src/pages/porder/index.scss (./node_modules/css-loader/dist/cjs.js!./node_modules/sass-loader/dist/cjs.js!./src/pages/porder/index.scss)
Module build failed (from ./node_modules/sass-loader/dist/cjs.js):
TypeError: this.getResolve is not a function
    at Object.loader (E:\Client\node_modules\sass-loader\dist\index.js:52:26)
 @ ./src/pages/porder/index.scss 2:26-142
 @ ./src/pages/porder/index.tsx

 

使用各种方法报错,终于发现:

npm WARN sass-loader@8.0.0 requires a peer of webpack@^4.36.0 but none is installed. You must install peer dependencies yourself.
npm WARN sass-loader@8.0.0 requires a peer of sass@^1.3.0 but none is installed. You must install peer dependencies yourself.
npm WARN sass-loader@8.0.0 requires a peer of fibers@>= 3.1.0 but none is installed. You must install peer dependencies yourself.
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.2.9 (node_modules\fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.2.9: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"})

从报错来看,应该是loader的问题,然后就删除重装sass-loader,node-sass,来来回回不下5次,还是报同样的错误,甚至怀疑是不是webpack.dev.config.js中没有配置好?一步步检查,也没有发现

这是警告。

看了博文:https://www.cnblogs.com/szqtiger/p/11599205.html

终于发现是版本问题,于是查看

发现版本不对,于是执行

npm uninstall sass-loader

npm install sass-loader@7.1.0 --save

npm install style-loader

npm install node-sass

安装对应的版本,搞定。

 

  • 19
    点赞
  • 28
    收藏
    觉得还不错? 一键收藏
  • 7
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 7
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值