Node installed but node cannot be found in Ubuntu VPS

前端 未结 2 1978
一个人的身影
一个人的身影 2020-12-20 09:02

I installed node via NVM. I installed node 0.10.32. using NVM 0.25.0

When I do node -v I get

-bash: /root/.nvm/v0.10.32/bin/node: No suc         


        
相关标签:
2条回答
  • 2020-12-20 10:05

    A lot of things can be wrong here from what you describe. Generally I don't recommend using nvm to install Node on servers. It works fine for your own work on a local machine but when you need to be sure what is installed and where, I recommend doing a real installation.

    I recently wrote a tutorial on how to install Node on Linux:

    • https://gist.github.com/rsp/edf756a05b10f25ee305cc98a161876a

    It is specifically about version 6.7.0 but just change the version number to use any other version of Node.

    You can see other answers showing how to install Node properly and troubleshoot if it isn't installed correctly:

    • Run npm as superuser, it isn't a good idea?
    • node 5.5.0 already installed but node -v fetches with "v4.2.1" on OS X & homebrew?

    Just get the binary or source package of the version that you need, install it where you want and it will work. The most reliable way is to install a source package because you can run make test before you install and because npm will have the correct shebang line (which may not always be the case with binary distribution - which, incidentally, is also used by nvm). No need to use nvm or any other tool to do that.

    The nvm is great if you need to quickly switch Node versions during development on your local machine but if you want a reliable way to install Node on the server then it's best to install it normally.

    0 讨论(0)
  • Check that your ~/.bash_profile has this:

    export NVM_DIR=~/.nvm

    source ~/.nvm/nvm.sh

    https://github.com/creationix/nvm/issues/576

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