nodejs vs node on ubuntu 12.04

前端 未结 20 2153
Happy的楠姐
Happy的楠姐 2020-11-22 12:29

I installed nodejs on ubuntu from instructions given here

When I write node --version in the terminal I see this :
-bash: /usr/sbin/node: No

20条回答
  •  天涯浪人
    2020-11-22 13:21

    This happened to me as well.

    node -v => 0.10.2
    nodejs -v => 5.5.0
    

    The issue was that I had installed node from source some time ago. Running

    which node
    

    always pointed to this local installation. Also,

    echo NODE_PATH
    

    pointed to the local installation.

    deleting the directory with the source install didn't help. It just broke the node command. In the end, unsetting the NODE_PATH environmental variable and purging then reinstalling nodejs did the trick.

    unset NODE_PATH
    sudo apt-get --purge remove nodejs
    sudo apt-get install nodejs
    

    After this,

    node -v => 5.5.0
    

    and npm install started to work for packages depending on Node => 5.0.

提交回复
热议问题