Cannot find module 'node-sass'

 

 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终于能跑起来了!!!

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值