node.js - node-gyp error while doing npm install

node.js – node-gyp error while doing npm install

node.js – node-gyp error while doing npm install

The reason this happens is that node-gyp evaluates the -pre part of [email protected] as -1. The install then receives a 404 and fails.

gyp http GET http://nodejs.org/dist/v0.8.-1/node-v11.8.-1.tar.gz
gyp http 404 http://nodejs.org/dist/v0.8.-1/node-v11.8.-1.tar.gz

To solve this problem, use a stable release of Node.js. Otherwise, you need to have the Node source lying around, and use the --nodedir flag.

npm install --nodedir=/node/src/

You can read more about this issue here.

I solved this by upgrading my version of node to a stable version (e.g. not a pre version – your version is 0.8.13-pre) with the following:

sudo npm install -g n # install node version manager n
sudo n stable # install the latest stable version of node

node.js – node-gyp error while doing npm install

I faced the same problem while installing node-sass as well as windows-build-tools. I was using node-v16.2.0, so it wasnt any -pre release. I also updated to the latest version (node-v16.3.0) but it did not solve my issue either.

Finally, I solved it by uninstalling the existing version and installing the LTS version (v14.17.0 at the time of posting).

Related posts on node.js  :

Leave a Reply

Your email address will not be published. Required fields are marked *