找不到节点-sass binding.node 文件

Node-sass binding.node file not found

我有一个 angular 项目 7.1,它之前运行良好,但在升级到 ubuntu 19.10 之后,当我执行 npm install 时,出现以下错误:

> node-sass@4.11.0 install /home/gabb/dev/homepage/node_modules/node-sass
> node scripts/install.js

Downloading binary from https://github.com/sass/node-sass/releases/download/v4.11.0/linux-x64-79_binding.node
Cannot download "https://github.com/sass/node-sass/releases/download/v4.11.0/linux-x64-79_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[1617]: ../src/signal_wrap.cc:159:void node::DecreaseSignalHandlerCount(int): Assertion `(new_handler_count) >= (0)' failed.
 1: 0x9f0390 node::Abort() [node]
 2: 0x9f0417  [node]
 3: 0xa91bdc node::DecreaseSignalHandlerCount(int) [node]
 4: 0xa91cb4  [node]
 5: 0x98fbd5 node::Environment::CleanupHandles() [node]
 6: 0x98fe6b node::Environment::RunCleanup() [node]
 7: 0xa2d2f0 node::NodeMainInstance::Run() [node]
 8: 0x9c1311 node::Start(int, char**) [node]
 9: 0x7fbff275e1e3 __libc_start_main [/lib/x86_64-linux-gnu/libc.so.6]
10: 0x95ed25  [node]
Aborted (core dumped)

这个 link https://github.com/sass/node-sass/releases/download/v4.11.0/linux-x64-79_binding.node 确实 return 404。如果我转到 package.json 文件,则没有 node-sass 条目。任何人都可以解释为什么它试图安装 node-sass@4.11.0 如果它不在 package.json 中。它是 angular 的依赖项吗?如果是这样,我是否需要将 angular 升级到新版本才能获得最新的 node-sass 版本?

仅升级到最新的 ubuntu 版本似乎有点复杂,尤其是因为很难将 angular 升级到另一个版本。

package.json: https://pastebin.com/w51Kna2g

为了澄清,我想知道关于这个的解释,而不仅仅是 "fix" 它的一些命令。

编辑:似乎它是 @angular-devkit/build-angular 的依赖项,我的版本是 0.13.6

当我将其更新到最新版本时,出现了其他错误。

所以答案是我的 angular-devkit/build-angular 版本依赖于 node-sass v4.11.0 但 node-sass v4.11.0 不支持我的 NodeJS 版本。所以我必须将 angular-devkit 更新到具有节点 sass 4.13.0.

的版本

显然有 none 个,0.13.9 是最后一个支持 angular 7 的版本,它有 4.12.0 作为 node-sass 版本。

这意味着要在 ubuntu 19.10 上编写代码,我需要 angular 8+?这对我来说是不可能的,因为我使用的某些软件包不支持它。整个项目建于 2019 年,更新起来已经很困难了。必须使用 docker 来模拟 ubuntu 19.04 才能编码 angular 7.

跟进您的回答:

So the answer is that my angular-devkit/build-angular version depends on node-sass v4.11.0 but node-sass v4.11.0 does not support my linux version

更正确的说法是没有适用于您的特定平台版本的预编译二进制文件。在 post-install 期间,它会尝试找到一个不存在的,这会导致错误。您可以做的是尝试自己从源代码构建一个。

the node-sass README 中有一节讨论如何按照以下步骤自行创建二进制文件:

Check out the project:

git clone --recursive https://github.com/sass/node-sass.git
cd node-sass
npm install
node scripts/build -f  # use -d switch for debug release
# if succeeded, it will generate and move
# the binary in vendor directory.

一旦你有了一个二进制文件,就有 some env variables 你可以用来引用它。

我上周在工作中尝试建立一个项目时看到了 README 的这一部分。我无法获得 node-sass 二进制文件,但我的问题更多地与在公司代理后面工作有关。我最终下载了一个节点二进制文件(而不是自己创建它)并简单地将 vendor 文件夹复制到项目的 node_modules/node-sass 中(我知道,不是非常理想)。