前端项目-安装sass报错。
执行npm install的时候报错:Cannot download "https://github.com/sass/node-sass/releases/download/v3.13.1/win3解决方法:1.到https://github.com/sass/node-sass/releases下载win32-x64-79_binding.node。2.回到命令行安装界面(nodes项目的目录
·
执行npm install的时候报错:Cannot download "https://github.com/sass/node-sass/releases/download/v3.13.1/win3
解决方法:
1.到https://github.com/sass/node-sass/releases下载win32-x64-79_binding.node。
2.回到命令行安装界面(nodes项目的目录下启动 命令行窗口)。
先输入 set SASS_BINARY_PATH=E:/win32-x64-46_binding.node
注意点:
1.可能大家会遇到gyp ERR! build error这时需要安装
先运行npm install -g node-gyp
后运行 npm install --global --production windows-build-tools 运行这个命令可能出能卡在图1的情况。
你可以到C:\Users\Administrator\.windows-build-tools 目录下查看一下是否成功安装成功。图2
2.可能遇到下面错误提示 npm ERR! Error: EPERM: operation not permitted,这时需要你用管理员的身份运行cmd的小窗口
图1
图2
最后是通过自己下文件安装运行成功的
手动安装方式
成功示例
//第一步
set SASS_BINARY_PATH=D:\douluoling\win32-x64-79_binding.node
//第二步
**//说明使用的是node 13.10.1的版本,不同的版本可能会出错**
D:\douluoling\ccb-df-fe>nvm use 13.10.1
Now using node v13.10.1 (64-bit)
//第三步
D:\douluoling\ccb-df-fe>npm install node-sass
> node-sass@5.0.0 install D:\douluoling\ccb-df-fe\node_modules\node-sass
> node scripts/install.js
**//win32-x64-79_binding.node在github上下载的sass的版本**
node-sass build Binary found at D:\douluoling\win32-x64-79_binding.node
> node-sass@5.0.0 postinstall D:\douluoling\ccb-df-fe\node_modules\node-sass
> node scripts/build.js
Binary found at D:\douluoling\win32-x64-79_binding.node
Testing binary
Binary is fine **//成功的标志**
npm WARN ajv-keywords@2.1.1 requires a peer of ajv@^5.0.0 but none is installed. You must install peer dependencies yourself.
npm WARN sass-loader@6.0.7 requires a peer of node-sass@^4.0.0 but none is installed. You must install peer dependencies yourself.
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@2.3.2 (node_modules\fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@2.3.2: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"})
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.2.13 (node_modules\karma\node_modules\fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.2.13: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"})
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.2.13 (node_modules\watchpack-chokidar2\node_modules\fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.2.13: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"})
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.2.13 (node_modules\webpack-dev-server\node_modules\fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.2.13: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"})
+ node-sass@5.0.0
added 51 packages from 55 contributors in 14.556s
47 packages are looking for funding
run `npm fund` for details
参考的博客:
https://www.wenjiangs.com/article/windows-build-tools-uninstall.html
http://www.yayihouse.com/yayishuwu/chapter/999
https://blog.csdn.net/weixin_42406046/article/details/80604623
![Logo](https://devpress.csdnimg.cn/79de2bf0b7994defa4242ef90d5513fa.jpg)
开放原子开发者工作坊旨在鼓励更多人参与开源活动,与志同道合的开发者们相互交流开发经验、分享开发心得、获取前沿技术趋势。工作坊有多种形式的开发者活动,如meetup、训练营等,主打技术交流,干货满满,真诚地邀请各位开发者共同参与!
更多推荐
所有评论(0)