NPM install giving error installing express

后端 未结 2 637
你的背包
你的背包 2020-12-06 03:22

When I give command npm install express it throws following error. On ubuntu machine

gaurav@gaurav-Mini-Monster:~/TestScripts$ sudo npm install          


        
2条回答
  •  离开以前
    2020-12-06 04:15

    You are running a much-too-old version of node and npm. You have node v0.5 which is very out of date. Upgrade to node v0.10 and things will work.

    Modern node.js versions for Ubuntu are available via this PPA from Chris Lea

    To install:

    sudo apt-get install python-software-properties
    sudo add-apt-repository --yes ppa:chris-lea/node.js
    sudo apt-get install nodejs
    

    UPDATE

    It looks like your old version of node is installed at /usr/local/bin/node. The new version from the Chris Lea PPA will be at /usr/bin/node. So to verify all is well, do:

    /usr/bin/npm --version #Should be approx 1.2
    /usr/bin/node --version #should be approx v0.10
    /usr/bin/npm install -g express
    

    You should uninstall the local node, or fix your PATH:

    export PATH=/usr/bin:$PATH
    

提交回复
热议问题