欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页

解决Module build failed: Error: Cannot find module ‘node-sass‘Require stack

程序员文章站 2022-05-30 21:13:06
...
 in ./src/components/main/mainFirm.vue

Module build failed: Error: Cannot find module 'node-sass'
Require stack:
- C:\Users\Demo\Desktop\身份\YouQiu\node_modules\sass-loader\lib\loader.js
- C:\Users\Demo\Desktop\身份\YouQiu\node_modules\loader-runner\lib\loadLoader.js
- C:\Users\Demo\Desktop\身份\YouQiu\node_modules\loader-runner\lib\LoaderRunner.js
- C:\Users\Demo\Desktop\身份\YouQiu\node_modules\webpack\lib\NormalModule.js
- C:\Users\Demo\Desktop\身份\YouQiu\node_modules\webpack\lib\NormalModuleFactory.js
- C:\Users\Demo\Desktop\身份\YouQiu\node_modules\webpack\lib\Compiler.js
- C:\Users\Demo\Desktop\身份\YouQiu\node_modules\webpack\lib\webpack.js
- C:\Users\Demo\Desktop\身份\YouQiu\node_modules\webpack-dev-server\lib\Server.js
- C:\Users\Demo\Desktop\身份\YouQiu\node_modules\webpack-dev-server\bin\webpack-dev-server.js
    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:889:15)
    at Function.Module._load (internal/modules/cjs/loader.js:745:27)
    at Module.require (internal/modules/cjs/loader.js:961:19)
    at require (internal/modules/cjs/helpers.js:92:18)
    at Object.sassLoader (C:\Users\Demo\Desktop\身份\YouQiu\node_modules\sass-loader\lib\loader.js:46:72)

 @ ./node_modules/vue-style-loader!./node_modules/css-loader?{"sourceMap":true}!./node_modules/vue-loader/lib/style-compiler?{"vue":true,"id":"data-v-9809e666","scoped":true,"hasInlineConfig":false}!./node_modules/sass-loader/lib/loader.js?{"sourceMap":true}!./node_modul
es/vue-loader/lib/selector.js?type=styles&index=0!./src/components/main/mainFirm.vue 4:14-387 13:3-17:5 14:22-395
 @ ./src/components/main/mainFirm.vue
 @ ./src/router/index.js
 @ ./src/main.js
 @ multi (webpack)-dev-server/client?http://localhost:2727 webpack/hot/dev-server ./src/main.js

解决 方法

npm install --save-dev node-sass --registry=https://registry.npm.taobao.org --disturl=https://npm.taobao.org/dist --sass-binary-site=http://npm.taobao.org/mirrors/node-sass

亲测有效