【问题标题】:node-sass and python ERROR during npm installnpm 安装期间的 node-sass 和 python 错误
【发布时间】:2021-07-29 16:59:55
【问题描述】:

我无法运行项目,这是控制台日志,您能帮帮我吗? 似乎 node-sass 和 Python 存在问题...... node-sass URL怎么可能是404...我不知道应该在哪里配置这个

$ npm install

> node-sass@4.10.0 install C:\SOURCES\menuentite\node_modules\@angular-devkit\build-angular\node_modules\node-sass
> node scripts/install.js

Downloading binary from https://github.com/sass/node-sass/releases/download/v4.10.0/win32-x64-72_binding.node
Cannot download "https://github.com/sass/node-sass/releases/download/v4.10.0/win32-x64-72_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.10.0 postinstall C:\SOURCES\menuentite\node_modules\@angular-devkit\build-angular\node_modules\node-sass
> node scripts/build.js

Building: C:\Program Files\nodejs\node.exe C:\SOURCES\menuentite\node_modules\node-gyp\bin\node-gyp.js rebuild --verbose --libsass_ext= --libsass_cflags= --libsass_ldflags= --libsass_library=
gyp info it worked if it ends with ok
gyp verb cli [
gyp verb cli   'C:\\Program Files\\nodejs\\node.exe',
gyp verb cli   'C:\\SOURCES\\menuentite\\node_modules\\node-gyp\\bin\\node-gyp.js',
gyp verb cli   'rebuild',
gyp verb cli   '--verbose',
gyp verb cli   '--libsass_ext=',
gyp verb cli   '--libsass_cflags=',

[...]

install peer dependencies yourself.
npm WARN ngx-cookie-service@10.0.1 requires a peer of @angular/common@^10.0.5 but none is installed. You must install peer dependencies yourself.
npm WARN ngx-cookie-service@10.0.1 requires a peer of @angular/core@^10.0.5 but none is installed. You must install peer dependencies yourself.
npm WARN tsickle@0.34.3 requires a peer of typescript@~3.3.1 but none is installed. You must install peer dependencies yourself.
npm WARN The package tslib is included as both a dev and production dependency.
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.2.7 (node_modules\fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.2.7: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"})
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: node-sass@4.10.0 (node_modules\@angular-devkit\build-angular\node_modules\node-sass):
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: node-sass@4.10.0 postinstall: `node scripts/build.js`
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: Exit status 1

audited 1341 packages in 8.257s

1 package is looking for funding
run `npm fund` for details

found 2930 vulnerabilities (2168 low, 11 moderate, 749 high, 2 critical)
run `npm audit fix` to fix them, or `npm audit` for details

【问题讨论】:

  • 在 package.json 中我应该更改版本以将 "node-sass": "^4.14.1", 替换为最新版本...但仍然是相同的 404 错误...帮助

标签: node.js npm sass


【解决方案1】:

我做了什么,我不确定是什么解决了这个问题,但现在它正在工作:

  • 安装 Python 从https://www.python.org/downloads/windows/ 将 python 文件夹添加到您的 PATH,即 python/python39 中的一个,下载并安装适用于 Windows 的 python(接受添加到 PATH 的选项)。我还在自己的 windows env 变量中添加了其他变量名称 python2

  • 重新安装Nodejs然后执行以下命令:

    • npm 链接@angular/cli
    • npm 重建 node-sass
    • npm --add-python-to-path='true' --debug install --global windows-build-tools
    • npm install --global node-gyp

最后我将一个新的 package.json 文件添加到我的 lib 项目中:

{
   "name": "menuT",
    "version": "1.0.0"
}

最后,我能够执行最后一个命令:

ng build menuT

我要救了……

【讨论】:

  • 为什么我必须安装 Python ?
猜你喜欢
  • 2018-08-23
  • 1970-01-01
  • 2019-01-17
  • 1970-01-01
  • 2018-10-16
  • 2018-09-10
  • 2019-09-08
  • 2020-02-25
  • 2019-03-16
相关资源
最近更新 更多