node-gyp error while doing npm install

后端 未结 2 1969
悲哀的现实
悲哀的现实 2020-12-30 09:04

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

> pty.js@0.2.3 install /home/charizard/Open/terminal-codelearn/node_m         


        
相关标签:
2条回答
  • 2020-12-30 09:32

    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
    
    0 讨论(0)
  • 2020-12-30 09:49

    The reason this happens is that node-gyp evaluates the -pre part of node@0.11.8-pre 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.

    0 讨论(0)
提交回复
热议问题