Search code examples
angularnpmsassnode-sass

Node-sass binding.node file not found


I have an angular project 7.1 which was working fine before but after upgrading to ubuntu 19.10 when I do npm install I get the following error:

> 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)

This link https://github.com/sass/node-sass/releases/download/v4.11.0/linux-x64-79_binding.node really does return 404. If I go to the package.json file there is no node-sass entry. Anyone can explain why it is trying to install node-sass@4.11.0 if its not in the package.json. Is it a dependency of angular? If so do I need to upgrade angular to a new version to be able to get the latest node-sass version?

This seems a bit complicated for just upgrading to the latest ubuntu version, especially since its very hard to upgrade angular to another version.

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

To clarify I would like to know an explanation about this not just some commands that "fix" it.

Edit: Seems its a dependency of @angular-devkit/build-angular where I have version 0.13.6

When I update that to the latest version I get other errors.


Solution

  • Following up on your answer:

    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

    It would be more correct to say that there is no pre-compiled binary available for your specific platform version. During post-install, it tries to find one that doesn't exist which results in the error. What you can do, is try and build one from the source yourself.

    There is a section in the the node-sass README that talks about creating a binary yourself by following these steps:

    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.
    

    Once you have a binary, there are some env variables you can use to reference it.

    I came across this section of the README last week trying to set up a project at work. I could not get a node-sass binary, but my problem was more related to working behind a corporate proxy. I ended up downloading a node binary file (instead of creating it myself) and simply copying the vendor folder into node_modules/node-sass of the project (i know, not super ideal).