NodeJS 4 & 5 npm install fail for bcrypt and db-migrate

后端 未结 3 1537
灰色年华
灰色年华 2021-02-15 10:36

Some time ago I installed NodeJS (v0.10.31) and worked on a project without problems, but just recently I decided to update to Node v5.0.0. Everything was fine until I decided t

3条回答
  •  挽巷
    挽巷 (楼主)
    2021-02-15 11:05

    After much google searching, somebody pointed out that for NodeJS V4 (and newer versions) a newer version of GCC is needed (4.8 I think).

    My current version was a 4.6.3 as you can see:

    $ gcc --version
    gcc (Ubuntu/Linaro 4.6.3-1ubuntu5) 4.6.3
    

    So all it took was updating it, and was able to do it with the help of these links:

    How to install Gcc 4.8

    How do I use the latest GCC 4.9 on Ubuntu 14.04

    The sequence of commands I ended up using were:

    $ sudo apt-get install python-software-properties
    $ sudo add-apt-repository ppa:ubuntu-toolchain-r/test
    $ sudo apt-get update
    $ sudo apt-get install gcc-4.8 g++-4.8
    $ sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-4.8 60 --slave /usr/bin/g++ g++ /usr/bin/g++-4.8
    

    Checking again the GCC version

    $ gcc --version
    gcc (Ubuntu 4.8.1-2ubuntu1~12.04) 4.8.1
    

    After that I was able to call 'npm install' and things went on flawlessly.

提交回复
热议问题