为啥 NPM 安装安装旧版本的 node-sass

Posted

技术标签:

【中文标题】为啥 NPM 安装安装旧版本的 node-sass【英文标题】:Why NPM install installing older version of node-sass为什么 NPM 安装安装旧版本的 node-sass 【发布时间】:2020-03-25 19:36:19 【问题描述】:

我了解npm install 将安装在 package.json 中定义的节点模块版本。我不明白为什么它试图安装旧版本 4.9.1 而不是安装 4.11.0 或更高版本。正因为如此,我得到了错误。有人可以帮我解决这个问题吗?

无法下载 "https://github.com/sass/node-sass/releases/download/v4.9.1/win3 2-ia32-67_binding.node”:

找不到 HTTP 错误 404

环境: 节点版本:v11.0.0(32bit) 视觉工作室 2017

package.json


"name": "mydotnetcoreapp",
"version": "1.0.0",
"description": "",
"main": "",
"scripts": 
    "ng": "ng",
    "start": "ng serve",
    "build": "ng build",
    "build:watch": "ng build --watch --output-path=dist-dev",
    "build:dev": "ng build --output-path=dist-dev",
    "build:prod": "ng build --prod --output-path=dist-prod --output-hashing=none",
    "test": "ng test",
    "lint": "ng lint",
    "e2e": "ng e2e"
,
"author": "xxxx",
"license": "",
"dependencies": 
    "@angular/animations": "^5.0.5",
    "@angular/common": "^5.0.5",
    "@angular/compiler": "^5.0.5",
    "@angular/core": "^5.0.5",
    "@angular/forms": "^5.0.5",
    "@angular/http": "^5.0.5",
    "@angular/platform-browser": "^5.0.5",
    "@angular/platform-browser-dynamic": "^5.0.5",
    "@angular/router": "^5.0.5",
    "@ng-bootstrap/ng-bootstrap": "^1.0.0-beta.5",
    "bootstrap": "^4.0.0-beta.2",
    "classlist.js": "^1.1.20150312",
    "core-js": "^2.5.1",
    "font-awesome": "^4.7.0",
    "highcharts": "^6.0.2",
    "jquery": "^3.2.1",
    "lodash-es": "^4.17.4",
    "ng2-scroll-to-el": "^1.0.0",
    "ngx-cookie-service": "^2.2.0",
    "popper.js": "^1.12.9",
    "rxjs": "^5.5.2",
    "web-animations-js": "^2.3.1",
    "zone.js": "^0.8.18"
,
"devDependencies": 
    "@angular/cli": "1.5.5",
    "@angular/compiler-cli": "^5.0.5",
    "@angular/language-service": "^5.0.5",
    "@types/highcharts": "^5.0.12",
    "@types/jasmine": "^2.8.8",
    "@types/jasminewd2": "~2.0.2",
    "@types/lodash-es": "^4.17.0",
    "@types/node": "^6.0.90",
    "chrome": "^0.1.0",
    "codelyzer": "^3.2.2",
    "del": "^3.0.0",
    "gulp": "^3.9.1",
    "gulp-clean": "^0.3.2",
    "gulp-concat": "^2.6.1",
    "gulp-cssmin": "^0.2.0",
    "gulp-htmlmin": "^4.0.0",
    "gulp-sass": "^4.0.1",
    "gulp-uglify": "^3.0.0",
    "jasmine-core": "~2.99.1",
    "jasmine-marbles": "^0.3.1",
    "jasmine-spec-reporter": "~4.2.1",
    "karma": "^2.0.2",
    "karma-chrome-launcher": "~2.2.0",
    "karma-coverage-istanbul-reporter": "^1.4.3",
    "karma-jasmine": "^1.1.2",
    "karma-jasmine-html-reporter": "^0.2.2",
    "launcher": "0.0.1",
    "merge-stream": "^1.0.1",
    "natives": "^1.1.6",
    "node-sass": "^4.11.0",
    "protractor": "~5.1.2",
    "ts-node": "~3.3.0",
    "tslint": "~5.8.0",
    "typescript": "~2.4.2"

【问题讨论】:

正如here 解释的那样,现在建议使用npm ci 而不是npm install 来安装节点包。此外,已知 node-sass 会引发安装问题,但在 this post 中有一个解决方法。 【参考方案1】:

npm install --save-dev node-sass@4.5.3

【讨论】:

以上是关于为啥 NPM 安装安装旧版本的 node-sass的主要内容,如果未能解决你的问题,请参考以下文章

解决windows下node-sass安装失败和版本过高的问题

解决windows下node-sass安装失败和版本过高的问题

npm i安装node-sass报错问题解决

Windows 10 上的 node-sass 安装问题

为啥 Ubuntu 的 apt-get 包管理器中有旧版本的 nodejs 和 npm?

前端开发环境搭建踩坑笔记——npm install node-sass安装失败的解决方案