Error installing node-gyp on ubuntu

前端 未结 12 1000
执念已碎
执念已碎 2020-12-02 09:39
npm http 200 https://registry.npmjs.org/weak/-/weak-0.2.2.tgz
npm http GET https://registry.npmjs.org/bindings
npm http 304 https://registry.npmjs.org/bindings

>         


        
相关标签:
12条回答
  • 2020-12-02 09:53

    On Fedora 20, reinstalling gyp fixed this for me.

    sudo yum reinstall gyp
    
    0 讨论(0)
  • If your python version isn't the source of error, check if you have "gyp" installed. This is conflicting with the gyp version in node-gyp.

    apt-get remove gyp

    https://github.com/TooTallNate/node-gyp/issues/363#issuecomment-32234646

    0 讨论(0)
  • 2020-12-02 10:01

    This is what worked. You need python 2.6 during the installation.

    #!/bin/bash
    #On Ubuntu Saucy:
    sudo add-apt-repository ppa:fkrull/deadsnakes
    sudo apt-get update
    sudo apt-get install python2.6
    sudo update-alternatives --install /usr/bin/python python /usr/bin/python2.6 20
    sudo update-alternatives --install /usr/bin/python python /usr/bin/python2.7 10
    
    #you can switch between 2.6 & 2.7 using:
    sudo update-alternatives --config python
    
    #Btw I installed node using ppa:chris-lea/node.js
    

    https://github.com/TooTallNate/node-gyp/issues/363

    0 讨论(0)
  • 2020-12-02 10:01

    FWIW, I had a similar problem trying to install Protractor on Ubuntu 14.04 (DigitalOcean). Reinstalling node-gyp fixed the it:

    apt-get install node-gyp
    
    0 讨论(0)
  • 2020-12-02 10:06

    Here are the steps to install node-gyp successfully on a Ubuntu system:

    1.First of all, install the "make" build tool in Ubuntu with the following commands:

    sudo apt-get update && \
    sudo apt-get install build-essential software-properties-common -y;
    

    2. Then you need to install the a proper C/C++ compiler toolchain. We will be installing GCC here with the following commands:

    sudo add-apt-repository ppa:ubuntu-toolchain-r/test -y && \
    sudo apt-get update && \
    sudo apt-get install gcc-snapshot -y && \
    sudo apt-get update && \
    sudo apt-get install gcc-6 g++-6 -y && \
    sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-6 60 --slave 
    /usr/bin/g++ g++ /usr/bin/g++-6 && \
    sudo apt-get install gcc-4.8 g++-4.8 -y && \
    sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-4.8 60 --slave 
    /usr/bin/g++ g++ /usr/bin/g++-4.8;
    

    3. Install python 2.7 version. (Note: Python 3 is not supported by node-gyp).

    sudo apt update
    sudo apt upgrade
    sudo apt install python2.7 python-pip
    

    4. And finally install, node-gyp npm package:

    npm install -g node-gyp
    

    Additional but not important: If you have any atom keyboard-layout related issue with node-gyp then install the following one more package:

    sudo apt-get install libxkbfile-dev
    

    Thats all! It should be working fine now.

    0 讨论(0)
  • 2020-12-02 10:07

    This command sudo apt-get install build-essential helped in my case.

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