我正在升级一个项目到node-sass 4.9.4版本,因为我们之前使用的3.13.1版本已不再受支持,如果尝试从github加载将会得到404错误。问题是每次我尝试这样做时,npm都会尝试加载node-sass@3.13.1版本。我已经尝试了npm install node-sass@4.9.4,npm install node-sass@4.9.3和npm install node-sass@latest,但它每次都尝试加载3.13.1版本,导致以下错误:
$ npm install node-sass@4.9.3
> node-sass@3.13.1 install D:\Projects\Repos\bluemill\mle-website\node_modules\gulp-sass\node_modules\node-sass
> node scripts/install.js
Downloading binary from https://github.com/sass/node-sass/releases/download/v3.13.1/win32-x64-57_binding.node
Cannot download "https://github.com/sass/node-sass/releases/download/v3.13.1/win32-x64-57_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
> node-sass@4.9.3 install D:\Projects\Repos\bluemill\mle-website\node_modules\node-sass
> node scripts/install.js
Downloading binary from https://github.com/sass/node-sass/releases/download/v4.9.3/win32-x64-57_binding.node
Download complete
Binary saved to D:\Projects\Repos\bluemill\mle-website\node_modules\node-sass\vendor\win32-x64-57\binding.node
Caching binary to C:\Users\Tyler\AppData\Roaming\npm-cache\node-sass\4.9.3\win32-x64-57_binding.node
> node-sass@3.13.1 postinstall D:\Projects\Repos\bluemill\mle-website\node_modules\gulp-sass\node_modules\node-sass
> node scripts/build.js
我尝试过的其他事情:
- 重启我的电脑
- 重新启动Docker
- 重新启动Git Bash(我在Windows上)
- 运行
npm cache clean --force
- 进入node-sass 4.9.4 npm-cache文件夹,手动下载并安装binding
- 在package.json中为正确的文件夹设置
"node-sass": "^4.9.0"
- 在package-lock.json中设置
"node-sass": { "version": "4.9.4"...
- 检查package.json和package-lock.json是否有重复的node-sass要求,可能设置为不同的版本(没有其他版本)
- 删除node_modules文件夹并再次运行
npm install
- 运行
npm rebuild node-sass
无论我做什么,它总是首先尝试加载3.13.1,结果导致404错误。我完全不知道下一步该怎么办。我已经至少五次双重检查确认我在相同的目录下运行命令,与正确的package.json。
第一次出现错误时,我修复了package.json,然后在执行docker-compose up时出现了错误,所以我重新运行npm install
来确认它是否有所有模块,自那以后,无论我做什么它都只加载3.13.1。