Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

node-gyp error while doing npm install

Tags:

node.js

pty

I am doing npm install from a project and I am getting this wierd error in node-gyp.

> [email protected] install /home/charizard/Open/terminal-codelearn/node_modules/pty.js
> node-gyp rebuild

npm http GET https://registry.npmjs.org/commander
npm http GET https://registry.npmjs.org/nan
npm http GET https://registry.npmjs.org/tinycolor
npm http GET https://registry.npmjs.org/options
gyp ERR! configure error 
gyp ERR! stack Error: "pre" versions of node cannot be installed, use the --nodedir flag instead
gyp ERR! stack     at install (/usr/local/lib/node_modules/npm/node_modules/node-gyp/lib/install.js:65:16)
gyp ERR! stack     at Object.self.commands.(anonymous function) [as install] (/usr/local/lib/node_modules/npm/node_modules/node-gyp/lib/node-gyp.js:66:37)
gyp ERR! stack     at getNodeDir (/usr/local/lib/node_modules/npm/node_modules/node-gyp/lib/configure.js:228:20)
gyp ERR! stack     at /usr/local/lib/node_modules/npm/node_modules/node-gyp/lib/configure.js:110:9
gyp ERR! stack     at ChildProcess.exithandler (child_process.js:659:7)
gyp ERR! stack     at ChildProcess.EventEmitter.emit (events.js:106:17)
gyp ERR! stack     at maybeClose (child_process.js:773:16)
gyp ERR! stack     at Socket.<anonymous> (child_process.js:986:11)
gyp ERR! stack     at Socket.EventEmitter.emit (events.js:103:17)
gyp ERR! stack     at Pipe.close (net.js:458:12)
gyp ERR! System Linux 3.5.0-37-generic
gyp ERR! command "node" "/usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd /home/charizard/Open/terminal-codelearn/node_modules/pty.js
gyp ERR! node -v v0.11.8-pre
gyp ERR! node-gyp -v v0.10.10
gyp ERR! not ok 
npm ERR! weird error 1

When I do npm list, I get this following message.

npm ERR! missing: pty.js@>=0.2.2, required by [email protected]
npm ERR! not ok code 0

Sorry, I am completely new to nodejs.

like image 811
Charizard_ Avatar asked Sep 13 '13 03:09

Charizard_


People also ask

How install npm install node gyp?

On Windows Install tools and configuration manually: Install Visual C++ Build Environment: Visual Studio Build Tools (using "Visual C++ build tools" workload) or Visual Studio Community (using the "Desktop development with C++" workload) Launch cmd, npm config set msvs_version 2017.

Does node gyp need Visual Studio?

It works without Visual Studio, but you'll need to install Windows SDK: Get Windows SDK from https://www.microsoft.com/en-us/download/details.aspx?id=8442.

Is python required for node gyp?

node-gyp requires that you have installed a compatible version of Python, one of: v3. 7, v3. 8, v3. 9, or v3.


1 Answers

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.

like image 51
hexacyanide Avatar answered Sep 22 '22 07:09

hexacyanide