前端项目-安装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项目的目录下启动 命令行窗口)。

先输入 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

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 1
    评论
根据引用内容,你遇到的问题是在项目中找不到'sass-loader'。根据引用\[1\]和引用\[2\]的建议,你可以尝试在webpack配置文件中的rules中添加对'sass-loader'的配置。具体做法是在webpack.base.conf.js文件中的rules数组中添加以下配置: { test: /\.sass$/, loaders: \['style', 'css', 'sass'\] } \[2\] 另外,你还可以尝试使用官方的Sass Loader引入方法。根据引用\[3\]的建议,你可以在项目中运行以下命令安装所需的依赖: npm install sass-loader node-sass webpack --save-dev npm install style-loader css-loader --save-dev 然后在webpack配置文件中添加以下配置: module: { rules: \[ { test: /\.scss$/, use: \[ { loader: "style-loader" }, { loader: "css-loader" }, { loader: "sass-loader" } \] } \] } \[3\] 这样应该能够解决你的问题。希望对你有帮助! #### 引用[.reference_title] - *1* *3* [web前端_Vue框架_关于Can't resolve 'sass-loader' in...错误的解决办法](https://blog.csdn.net/qq_24058693/article/details/80056557)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v91^koosearch_v1,239^v3^insert_chatgpt"}} ] [.reference_item] - *2* [vue项目sass-loader安装报错解决](https://blog.csdn.net/mChales_Liu/article/details/108178092)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v91^koosearch_v1,239^v3^insert_chatgpt"}} ] [.reference_item] [ .reference_list ]
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值