在升级完node版本后启动项目发现报错,这是由于版本兼容导致的,关键报错如下:
Downloading binary from https://npm.taobao.org/mirrors/node-sass/v4.12.0/win32-x64-93_binding.node
Cannot download "https://npm.taobao.org/mirrors/node-sass/v4.12.0/win32-x64-93_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
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! node-sass@4.12.0 postinstall: `node scripts/build.js`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the node-sass@4.12.0 postinstall script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\Administrator\AppData\Roaming\npm-cache\_logs\2022-06-15T13_59_40_556Z-debug.log
以前的版本信息:
以前我的node版本为:v14.5.1
又去看了下node
与sass-node
的版本对应表
可以看到前面是没问题的,但是我现在node
版本升级为了:v16.15.1
所以node-sass
就必须要6.0+
的版本才行
还得去看node-sass
与sass-loader
的对应版本,把sass-loader
也换为对应的版本
我这里v16.15.1
需要的版本:
npm install node-sass@6.0.1 sass-loader@10.2.0
版本更换完成,问题解决。