Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Failed doing npm install showing error "Undefined variable standalone_static_library in binding.gyp" and node-sass chokidar error

I'm updating a 3 years ago ruby on rails and react project trying to npm install but im stuck here getting this error

$ npm install

gyp: Undefined variable standalone_static_library in binding.gyp while trying to load binding.gyp
gyp ERR! configure error 
gyp ERR! stack Error: `gyp` failed with exit code: 1

$ npm start

sh: node-sass-chokidar: command not found
npm ERR! code ELIFECYCLE
npm ERR! syscall spawn
npm ERR! file sh
npm ERR! errno ENOENT
npm ERR! [email protected] build-css: `node-sass-chokidar src/styles -o src/styles`
npm ERR! spawn ENOENT
npm ERR! 
npm ERR! Failed at the [email protected] build-css script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

I tried removing node_modules, update node version and npm version.

like image 850
Stefano Rueda Avatar asked Sep 05 '25 01:09

Stefano Rueda


1 Answers

For me this issue happened with NodeJS 19 (specifically 19.2.0) Run node --version to get your version (or you might see the output of that command in the gyp error logs, in my case again later when I use NodeJS v20 I still have an error: npm ERR! gyp ERR! node -v v20.10.0)

The issue is fixed when I reverted to NodeJS 18; aka NodeJS LTS (at the time I wrote this answer, 12/9/2022). I used nvm install 18 and nvm use 18 as described here here and here)

NodeJS LTS = Long Term Support; "recommended for most users". At the time I wrote this answer (12/9/2022), Node Long Term Support (LTS) is NodeJS version 18.12.1

It seems like this issue (Undefined variable standalone_static_library...) may have been introduced in NodeJS version 19 because:

node 19.0.0 has been changed to make process.config read only #43627

After reverting, it may still be mentioned as a warning, but not an error:

npm ERR! (node:7120) [DEP0150] DeprecationWarning: Setting process.config is deprecated. In the future the property will be read-only.

And while we're talking about versions, be careful about Python3 vs Python2!

npm ERR! gyp verb which failed Error: not found: python2

like image 96
The Red Pea Avatar answered Sep 07 '25 13:09

The Red Pea