sass-loader安裝+Failed to resolve loader: sass-loader You may need to install it.解決方法
阿新 • • 發佈:2020-07-11
方式一:
通過cnpm安裝node-sass
cnpm install node-sass --save
方式二:
通過npm 安裝
1、安裝sass-loader
npm install sass-loader --save-dev
2、安裝 node-sass
npm install node-sass --save-dev
如若不安裝node-sass ,會出現如下錯誤:
ERROR Failed to compile with 1 errors 3:13:52 PMerror in ./src/styles/index.scss
Module build failed (from ./node_modules/sass-loader/dist/cjs.js):
Error: Cannot find module 'node-sass'
at Function.Module._resolveFilename (internal/modules/cjs/loader.js:636:15)
at Function.Module._load (internal/modules/cjs/loader.js:562:25)
at Module.require (internal/modules/cjs/loader.js:692:17)at require (internal/modules/cjs/helpers.js:25:18)
at getDefaultSassImplementation (D:\WebStormProject\tourism-supervision-service-platform\node_modules\sass-loader\dist\getDefaultSassImplementation.js:24:10)
at getSassImplementation (D:\WebStormProject\tourism-supervision-service-platform\node_modules\sass-loader\dist\getSassImplementation.js:19:72)at Object.loader (D:\WebStormProject\tourism-supervision-service-platform\node_modules\sass-loader\dist\index.js:40:61)
@ ./src/styles/index.scss 4:14-225 14:3-18:5 15:22-233
@ ./src/main.js
@ multi (webpack)-dev-server/client?http://localhost:9999/sockjs-node (webpack)/hot/dev-server.js ./src/main.js