nodejs vs node on ubuntu 12.04

前端 未结 20 1961
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:15

    Best way to install nodejs is through NVM (Node Version Manager)

    Delete previous versions :

    $ sudo apt-get purge node
    $ sudo apt autoremove

    Also delete all node_modules by $ sudo rm -rf node_modules in the directory containing this folder.

    Node & Nodejs are technically the same thing. Just the naming changed.

    First Install or update nvm

    to run as root

    $ sudo su 

    Then

    $ curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.31.7/install.sh | bash

    OR

    $ wget -qO- https://raw.githubusercontent.com/creationix/nvm/v0.31.7/install.sh | bash

    Check nvm to path

    $ source ~/.profile
    $ nvm ls-remote

    if you get error regarding the listing then install git.

    $ sudo apt-get install git

    Re-run :

    $ nvm ls-remote
    OR
    $ sudo nvm ls-remote

    $ nvm install version-you-require 

    Checking Version

    # node --version
    nvm use version-you-require

    INFORMATION COURTESY :

    https://www.digitalocean.com/community/tutorials/how-to-install-node-js-with-nvm-node-version-manager-on-a-vps

提交回复
热议问题