npm install doesn't work because of node-sass on ubuntu - node.js

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?

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.

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.

Related

Node-sass Python version compatibility

I am using 4.14.1 in my project and with Node 14. I need to know which version of Python is needed to run node-gyp.
I also went through the repo link: https://www.npmjs.com/package/node-sass, but not able to find the details of Python version.
Solution
Install and use sass instead of node-sass.
Because node-sass is now deprecated.
npm uninstall node-sass
npm install sass
It works all the same (no additional changes needed)
Change it to sass and remove node-sass
node-gyp requires Python version 2.7, 3.5, or 3.6 to be installed on your system in order to run properly. It is recommended to use the version that is most commonly installed on your system, which is usually 2.7.

error in npm start vs code , react project

H!
i tryin to run my React Project using npm start command in terminal :
npm v7.4.3
node v15.7.0
error in terminal
./src/index.scss (./node_modules/css-loader/dist/cjs.js??ref--6-oneOf-5-1!./node_modules/postcss-loader/src??postcss!./node_modules/resolve-url-loader??ref--6-oneOf-5-3!./node_modules/sass-loader/dist/cjs.js??ref--6-oneOf-5-4!./src/index.scss)
Error: Node Sass does not yet support your current environment: Windows 64-bit with Unsupported runtime (88)
For more information on which environments are supported please see:
https://github.com/sass/node-sass/releases/tag/v4.14.1
and face this error in localhost:8888
Failed to compile
./src/index.scss (./node_modules/css-loader/dist/cjs.js??ref--6-oneOf-5-1!./node_modules/postcss-loader/src??postcss!./node_modules/resolve-url-loader??ref--6-oneOf-5-3!./node_modules/sass-loader/dist/cjs.js??ref--6-oneOf-5-4!./src/index.scss)
Error: Node Sass does not yet support your current environment: Windows 64-bit with Unsupported runtime (88)
For more information on which environments are supported please see:
https://github.com/sass/node-sass/releases/tag/v4.14.1
i trying tso solve problem with this commands
npm rebuild node-sass
and other way was reinstall node-sass
im trying to delete node_modules and run npm install
but seem doesnt work for me.
any answers ?
Downgrade node.js to a stable version (LTS) like 14.15.4
Install the compatible node-sass version via npm install node-sass#5.0.0; you can find the list here or use the GitHub releases page, or even install gulp-sass with npm i gulp-sass`.

Unclear - Unsupported node-sass with current environment

Trying to set up instance of Facebook CTF on an AWS EC2 instance running Ubuntu 16.04 and am running into the following error when doing the quick setup.
My current version of node-sass and node are
$ node -v
v15.4.0
$ npm node-sass -v
7.0.15
Interestingly, I get another vesion of node
$ npm node -v
7.0.15
The first two are supposedly compatible according to the Node Version Support Policy table on GitHub. The node version 7.0.15 is not compatible with the version of node-sass.
However, when I run grunt, it indicates an unsupported environment.
Note: I have tried using individual sass commands and it works.
grunt --force
Loading "sass.js" tasks...ERROR
>> Error: Node Sass does not yet support your current environment: Linux 64-bit with Unsupported runtime (88)
>> For more information on which environments are supported please see:
>> https://github.com/sass/node-sass/releases/tag/v3.13.1
What I have tried/done-
Uninstall node-sass (include using -g, clear cache, remove package-lock.json) but oddly enough, node-sass does not get uninstalled.
Questions -
Why does the error log reference an older release of node-sass (v3.13.1)?
How do I reconcile versions?
Does it make a difference if some packages were installed as root user vs. regular user?
Solved it!
Why was I getting the error?
Tracing package.json and package-locked.json files both indicate the older version
"node-sass": "^3.7.0" and not the version I installed manually.
Solution -
uninstall node-sass, node
delete their node_module folders
run "npm install" to install any dependencies missing (node-sass and node)
Such that now when I check the versions installed, my output is as follow -
user#IP:/var/www/user# node -v
v6.17.1
user#IP:/var/www/user# npm node-sass -v
3.10.10
When reviewing the Node Sass support policy table on GitHub, these two versions are compatible. When I run grunt --force, there are no issues for node-sass.

Node Sass could not find a binding for your current environment: Linux 32-bit with Node.js 12.x

When I try to compile my sass files (node-sass -o css/ css/) I run into Node Sass could not find a binding for your current environment error. I followed similiar question and none of npm scripts mentioned solve the problem like npm rebuild node-sass, or deleting node_modules and run npm install.
I read in this answer that if none of npm scripts solve the problem, then you have to download the missed binding and place it in the appropriate destination folder.
In my case the missed binding is linux-ia32-72_binding.node as mentioned in the error message
Error: Missing binding /home/saad/Documents/bOGnMCzEEeiTdA5yoE99Fg_6da6f2f02cc411e8b484f7e801bd0278_Bootstrap4-starter/Bootstrap4/conFusion/node_modules/node-sass/vendor/linux-ia32-72/binding.node
Node Sass could not find a binding for your current environment: Linux 32-bit with Node.js 12.x
The problem is that I don't find that binding here to download it! the last version I found was linux-ia32-51_binding.node!
I can't compile my sass files now, and I forced to compile it online, how can I solve this?
Note: npm version is npm#7.0.5 and node version node#v12.18.4
Update: When I run uname -m the output is x86_64 which means that my linux is 64-bit, so why the error said Node Sass could not find a binding for your current environment: Linux 32-bit
Node no longer supports x86 in v10 and above, so node-sass has no "ia32" for Node 12 (72). You can see the supported minimum node-sass versions here https://github.com/sass/node-sass#node-version-support-policy

"Node Sass could not find a binding for your current environment: OS X 64-bit with Node.js 4.x" error BUT my current environment is 6.11

This always happen to me when I change my node version globally and is not the same as the project version installed by Maven.
Things normally work ok but node-sass always gives error. I recently updated my node version from 4.4.4 globally to stable version with nvm.
Our project setting also changed to be 6.11.3
I deleted project node-modules many times. I cleaned npm cache many times both in global and in project local.
But Grunt watch does not work because I get this
Error: Missing binding /Users/Tekin/bitbucket/ark/code/emport-web/node_modules/node-sass/vendor/darwin-x64-46/binding.node
Node Sass could not find a binding for your current environment: OS X 64-bit with Node.js 4.x
Found bindings for the following environments:
- OS X 64-bit with Node.js 6.x
This is driving me insane. What is happening? I am not using 4.x anymore I rebuilt npm node-sass also even forced it.
May be there is an order of things that someone can explain.
And this is what I get when I do npm install or Jetty clean run to rebuild the project.
node-sass#4.5.3 install /Users/Tekin/bitbucket/ark/code/emport-web/node_modules/node-sass
node scripts/install.js
node-sass build Binary found at /Users/Tekin/bitbucket/ark/code/emport->web/node_modules/node-sass/vendor/darwin-x64-48/binding.node
node-sass#4.5.3 postinstall /Users/Tekin/bitbucket/ark/code/emport-web/node_modules/node-sass node scripts/build.js
Binary found at /Users/Tekin/bitbucket/ark/code/emport-web/node_modules/node-sass/vendor/darwin-x64-48/binding.node
Testing binary
Binary is fine
node-sass#4.5.3 /Users/Tekin/bitbucket/ark/code/emport-web/node_modules/node-sass

Resources