node-sass 安装出错 Cannot download "https://github.com/sass/node-sass... win32-x64-83_binding win32-x64-93_binding win32-x64-108_binding win32-x64-111_binding win32-x64-115_binding
Downloading binary from https://github.com/sass/node-sass/releases/download/v4.14.1/win32-x64-83_binding.node
Cannot download "https://github.com/sass/node-sass/releases/download/v4.14.1/win32-x64-83_binding.node":
我在github下载的几个版本 => fyfh
包含 win32-x64-83_binding win32-x64-93_binding win32-x64-108_binding win32-x64-111_binding win32-x64-115_binding
github网站大多时候都访问不到,下载 win32-x64-**_binding.node 文件就会失败,然后会尝试调用本地 python 、 Visual Studio 包含的 msbuild 程序等本地编译,报一大堆错误
正确解决办法:
手动下载文件, 地址: https://github.com/sass/node-sass/releases 下载指定版本(下载失败提示:我当前 win32-x64-83_binding.node)的 win32-x64-**_binding.node 文件到本地
下载好node版本对应的文件,一劳永逸。
查看当前node版本需要的
node -p "[process.platform, process.arch, process.versions.modules].join('-')"
设置环境变量:SASS_BINARY_PATH 值为存放下载文件的路径,类似: D:\node-sass\win32-x64-108_binding
或者添加到 .npmrc 文件中,.npmrc 文件路径一般位于 C:/用户/用户名/.npmrc,添加下载文件的路径 SASS_BINARY_PATH=D:\node-sass\win32-x64-83_binding.node
然后再 install