vue错误:Module build failed: Error: Cannot find module 'node-sass'

vue错误:

 ERROR  Failed to compile with 2 errors                                                                         20:19:24

 error  in ./src/views/Main.vue

Module build failed: Error: Cannot find module 'node-sass'
Require stack:
- D:\Vue\workspace\hellovue\node_modules\sass-loader\dist\index.js
- D:\Vue\workspace\hellovue\node_modules\sass-loader\dist\cjs.js
- D:\Vue\workspace\hellovue\node_modules\loader-runner\lib\loadLoader.js
- D:\Vue\workspace\hellovue\node_modules\loader-runner\lib\LoaderRunner.js
- D:\Vue\workspace\hellovue\node_modules\webpack\lib\NormalModule.js
- D:\Vue\workspace\hellovue\node_modules\webpack\lib\NormalModuleFactory.js
- D:\Vue\workspace\hellovue\node_modules\webpack\lib\Compiler.js
- D:\Vue\workspace\hellovue\node_modules\webpack\lib\webpack.js
- D:\Vue\workspace\hellovue\node_modules\webpack-dev-server\lib\Server.js
- D:\Vue\workspace\hellovue\node_modules\webpack-dev-server\bin\webpack-dev-server.js
    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:793:17)
    at Function.Module._load (internal/modules/cjs/loader.js:686:27)
    at Module.require (internal/modules/cjs/loader.js:848:19)
    at require (internal/modules/cjs/helpers.js:74:18)
    at getDefaultSassImpl (D:\Vue\workspace\hellovue\node_modules\sass-loader\dist\index.js:198:10)
    at Object.loader (D:\Vue\workspace\hellovue\node_modules\sass-loader\dist\index.js:80:29)

 @ ./node_modules/vue-style-loader!./node_modules/css-loader?{"sourceMap":true}!./node_modules/vue-loader/lib/style-comp
iler?{"vue":true,"id":"data-v-c1f1971a","scoped":true,"hasInlineConfig":false}!./node_modules/sass-loader/dist/cjs.js?{"
sourceMap":true}!./node_modules/vue-loader/lib/selector.js?type=styles&index=0!./src/views/Main.vue 4:14-369 13:3-17:5 1
4:22-377
 @ ./src/views/Main.vue
 @ ./src/router/index.js
 @ ./src/main.js
 @ multi (webpack)-dev-server/client?http://localhost:8080 webpack/hot/dev-server ./src/main.js

 error  in ./src/views/Login.vue

Module build failed: Error: Cannot find module 'node-sass'
Require stack:
- D:\Vue\workspace\hellovue\node_modules\sass-loader\dist\index.js
- D:\Vue\workspace\hellovue\node_modules\sass-loader\dist\cjs.js
- D:\Vue\workspace\hellovue\node_modules\loader-runner\lib\loadLoader.js
- D:\Vue\workspace\hellovue\node_modules\loader-runner\lib\LoaderRunner.js
- D:\Vue\workspace\hellovue\node_modules\webpack\lib\NormalModule.js
- D:\Vue\workspace\hellovue\node_modules\webpack\lib\NormalModuleFactory.js
- D:\Vue\workspace\hellovue\node_modules\webpack\lib\Compiler.js
- D:\Vue\workspace\hellovue\node_modules\webpack\lib\webpack.js
- D:\Vue\workspace\hellovue\node_modules\webpack-dev-server\lib\Server.js
- D:\Vue\workspace\hellovue\node_modules\webpack-dev-server\bin\webpack-dev-server.js
    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:793:17)
    at Function.Module._load (internal/modules/cjs/loader.js:686:27)
    at Module.require (internal/modules/cjs/loader.js:848:19)
    at require (internal/modules/cjs/helpers.js:74:18)
    at getDefaultSassImpl (D:\Vue\workspace\hellovue\node_modules\sass-loader\dist\index.js:198:10)
    at Object.loader (D:\Vue\workspace\hellovue\node_modules\sass-loader\dist\index.js:80:29)

 @ ./node_modules/vue-style-loader!./node_modules/css-loader?{"sourceMap":true}!./node_modules/vue-loader/lib/style-comp
iler?{"vue":true,"id":"data-v-26084dc2","scoped":true,"hasInlineConfig":false}!./node_modules/sass-loader/dist/cjs.js?{"
sourceMap":true}!./node_modules/vue-loader/lib/selector.js?type=styles&index=0!./src/views/Login.vue 4:14-370 13:3-17:5
14:22-378
 @ ./src/views/Login.vue
 @ ./src/router/index.js
 @ ./src/main.js
 @ multi (webpack)-dev-server/client?http://localhost:8080 webpack/hot/dev-server ./src/main.js

解决办法:cnpm install node-sass@latest

这样就能成功运行了!

你可能感兴趣的:(vue,node-sass,axios)