Module build failed: Error: Cannot find module ‘node-sass‘

在安装web端项目时遇到Module build failed错误,由于缺少`node-sass`模块。系统中Node.js版本为v10.14.2,npm版本为6.4.1。解决方案是通过cnpm或更改npm源,以及使用管理员权限重新安装`node-sass`,最终通过`cnpm install`成功解决问题并能运行项目。
摘要由CSDN通过智能技术生成

核心提示:安装启动web端项目安装cnpmnpm install -g cnpm --registry=https://registry.npm.taobao.org或者设置下载仓库为淘宝镜像npm config set registry http://registry.npm.taobao.org/eg:C:\\Users\\x1c>npm config set registry http://registry.npm.taobao.org/C:\\Users\\x1c>npm configpython

 

 

安装启动web端项目

安装cnpm

npm install -g cnpm --registry=https://registry.npm.taobao.org

或者设置下载仓库为淘宝镜像

npm config set registry http://registry.npm.taobao.org/

eg:

C:\Users\x1c>npm config set registry http://registry.npm.taobao.org/

C:\Users\x1c>npm config list
; cli configs
metrics-registry = "http://registry.npm.taobao.org/"
scope = ""
user-agent = "npm/6.5.0 node/v11.9.0 win32 x64"

; userconfig C:\Users\x1c\.npmrc
cache = "D:\\Environments\\nodejs\\node_cache"
disturl = "https://npm.taobao.org/dist"
prefix = "D:\\Environments\\nodejs\\node_global"
python = "C:\\Users\\x1c\\.windows-build-tools\\python27\\python.exe"
registry = "http://registry.npm.taobao.org/"

; node bin location = D:\Environments\nodejs\node.exe
; cwd = C:\Users\x1c
; HOME = C:\Users\x1c
; "npm config ls -l" to show all defaults.
C:\Users\x1c>

安装完出现以下错误 Module build failed: Error: Cannot find module ‘node-sass’

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

错误表示找不到模块node-sass

我的node、npm版本

PS C:\Users\Administrator\Desktop\mall4v> node -v
v10.14.2
PS C:\Users\Administrator\Desktop\mall4v> npm -v
6.4.1

 

C:\Users\x1c>


错误信息是表示找不到node-sass模块,我重新安装下吧。

解决办法执行

cnpm install node-sass

 

若安装过程中出现Permission denied错误,则用如下命令安装:

npm install node-sass --unsafe-perm=true --allow-root

或者直接npm

npm install node-sass

我的安装好了 

 

重新 cnpm install 整个项目再运行整个项目吧,可以了

cnpm install npm run dev

PS C:\Users\Administrator\Desktop\mall4v> npm run dev

> admin-vue@1.0.0 dev C:\Users\Administrator\Desktop\mall4v
> webpack-dev-server --inline --progress --config build/webpack.dev.conf.js

 28% building modules 158/208 modules 50 active ...inistrator\Desktop\mall4v\src\App.vueNo parser and no filepath given, using 'babel' the parser
now but this will throw an error in the future. Please spe 41% building modules 266/309 modules 43 active ...4v\src\views\modules\sys\schedule.vueNo parser and no filepath given, using 'babel' the parser now but this will throw an error in the future. Please specify a parser or a filepath so one can be inferred.                                      42% building modules 270/311 modules 41 active ...odules\sys\schedule-add-or-update.vueNo parser and no filepath given, using 'babel' the parser now but this will throw an error in the future. Please specify a parser or a filepath so one can be inferred.                                      42% building modules 272/313 modules 41 active ...ws\modules\sys\user-add-or-update.vueNo parser and no filepath given, using 'babel' the parser now but this will throw an error in the future. Please specify a parser or a filepath so one can be inferred.                                      43% building modules 275/315 modules 40 active ...mall4v\src\views\modules\sys\role.vueNo parser and no filepath given, using 'babel' the parser now but this will throw an error in the future. Please specify a parser or a filepath so one can be inferred.                                      43% building modules 280/317 modules 37 active ...rc\views\modules\sys\schedule-log.vueNo parser and no filepath given, using 'babel' the parser now but this will throw an error in the future. Please specify a parser or a filepath so one can be inferred.                                      43% building modules 282/319 
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

没有学不会的技术,只有不学习的人

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值