0

I'm trying to npm install a project on Ubuntu but I'm getting this error:

Node Sass does not yet support your current environment: Linux 64-bit with Unsupported runtime (93)

The solutions I found on Stack Overflow was to run npm rebuild node-sass, like in this thread:

Node Sass does not yet support your current environment: Linux 64-bit with false

When I first tried this solution I got this error:

npm - “Can't find Python executable ”python“, you can set the PYTHON env variable.”

and the solution I found for it was to install Python 2.7, from here:

Can't find Python executable "python"

Now when I run python --version I get: Python 2.7.18

So I removed the node_modules folder and the lock file, and run npm install again, but it didn't work, and now I'm getting a build error, which you can find in this gist:

https://gist.github.com/aimad-majdou/b99c5295b56fd5bc68492fa638d63018

I never had issues installing this project on Mac OS and Windows, but this is the first time I try to install it on Ubuntu.

How can I solve this?

jonrsharpe
  • 115,751
  • 26
  • 228
  • 437
Renaud is Not Bill Gates
  • 1,684
  • 34
  • 105
  • 191

2 Answers2

2

There are two solutions for this.

1. Fix python install for npm

You can tell npm to use the correct version of python by running the following command:

npm config set python python2.7

Hopefully after this you can build node-sass.

However, I personally use another solution:

2. Stop using node-sass

There is a pure-javascript sass implementation on npm called sass. It is compatible with node-sass. Just replace node-sass with sass.

Of course, often you did not decide which sass module to use. Usually some framework like React decided to use binary modules like node-sass so you are forced to use it. Well, you can override it in your projcet.

Open your package.json file and edit the node-sass line in the dependencies to:

"dependencies": {
    ...
    "node-sass": "npm:sass@^1.30.0",
    ...
}

This tells npm to install sass version 1.30.0 as node-sass. Since the sass from the sass module command is compatible with the sass command from node-sass you can now build your project without worrying about building sass. Of course you can use a more recent version of sass if you like.

slebetman
  • 109,858
  • 19
  • 140
  • 171
1

I see from the gist, that you're running node version 16.x on your ubuntu. As can be seen here, it is probably a version incompatibility between node 16 and the version of node-sass you're trying to build. You should be using at least version 6.0.1 of node-sass for node 16 support.

stijndepestel
  • 3,076
  • 2
  • 18
  • 22