error in ./src/assets/scss/index.scss
Module build failed: 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 getDefaultSassImpl (D:\Vue\mall\node_modules\sass-loader\dist\index.js:198:10)
at Object.loader (D:\Vue\mall\node_modules\sass-loader\dist\index.js:80:29)
@ ./src/assets/scss/index.scss 4:14-210 13:3-17:5 14:22-218
@ ./src/main.js
@ multi (webpack)-dev-server/client?http://localhost:8081 webpack/hot/dev-server ./src/main.js
error in ./src/pages/home/index.vue
Module build failed: 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 getDefaultSassImpl (D:\Vue\mall\node_modules\sass-loader\dist\index.js:198:10)
at Object.loader (D:\Vue\mall\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-compiler?{"vue":true,"id":"data-v-5b685826","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/pages/home/index.vue 4:14-382 13:3-17:5 14:22-390
@ ./src/pages/home/index.vue
@ ./src/router/index.js
@ ./src/main.js
@ multi (webpack)-dev-server/client?http://localhost:8081 webpack/hot/dev-server ./src/main.js
error in ./src/components/tabbar/index.vue
Module build failed: 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 getDefaultSassImpl (D:\Vue\mall\node_modules\sass-loader\dist\index.js:198:10)
at Object.loader (D:\Vue\mall\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-compiler?{"vue":true,"id":"data-v-72b83f71","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/components/tabbar/index.vue 4:14-382 13:3-17:5 14:22-390
@ ./src/components/tabbar/index.vue
@ ./node_modules/babel-loader/lib!./node_modules/vue-loader/lib/selector.js?type=script&index=0!./src/App.vue
@ ./src/App.vue
@ ./src/main.js
@ multi (webpack)-dev-server/client?http://localhost:8081 webpack/hot/dev-server ./src/main.js
error in ./src/pages/home/header.vue
Module build failed: 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 getDefaultSassImpl (D:\Vue\mall\node_modules\sass-loader\dist\index.js:198:10)
at Object.loader (D:\Vue\mall\node_modules\sass-loader\dist\index.js:80:29)
先前npm install 也是报这种类似的错误。
后来搜索出cnpm install node-sass --save
这个命令可能有用,但是要事先安装cnpm。所以npm i cnpm时又是一通报错。
所以用npm install -g cnpm --registry=https://registry.npm.taobao.org ,从淘宝镜像那下载,然后cnpm下载成功。
最后输入cnpm install node-sass --save。npm run dev终于能跑起来了!!!