解决 v3.13.1/win32-x64-64_binding.node 下载失败

问题:

项目中依赖了gulp-sass:~2.1.1这个比较旧的版本,以致在npm install 的时候一直报一下错误:

Downloading binary from https://github.com/sass/node-sass/releases/download/v3.13.1/win32-x64-64_binding.node
Cannot download "https://github.com/sass/node-sass/releases/download/v3.13.1/win32-x64-64_binding.node":

HTTP error 404 Not Found

Hint: If github.com is not accessible in your location
      try setting a proxy via HTTP_PROXY, e.g.

      export HTTP_PROXY=http://example.com:1234

or configure npm proxy via

      npm config set proxy http://example.com:8080

解决方法:

1. 网上很多文章都说是镜像方面的问题,因此会切换成淘宝的镜像:

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

2. 也有些人说直接到node-sass官网下载对应的版本进行本地安装:

# 1. 下载对应版本到本地磁盘

# 2. 设置sass路径
set SASS_BINARY_PATH=本地磁盘路径

# 3.安装
npm i node-sass -D --verbose

然而以上方法都不能解决我的问题,因为sass官网已经没有v3.13.1这个版本了,后面看到https://github.com/SharePoint/sp-dev-fx-webparts/issues/501这篇文章,完美地解决了我的问题。

1. 进入 C:\Windows\System32 找到cmd.exe程序,右键以管理员身份运行

2. 输入:npm install --global --production windows-build-tools

3. 等待安装完成即可

 

你可能感兴趣的:(采坑系列)