4

When I install nvm using the command wget or curl (OS X El Capitan 10.11.4), the console prints

=> nvm is already installed in /Users/weichuang/.nvm, trying to update using git

=> 
=> Source string already in /Users/weichuang/.bashrc
npm ERR! error in /usr/local/lib/node_modules/love: ENOTDIR: not a directory, open '/usr/local/lib/node_modules/love/package.json'
npm ERR! missing: npmlog@, required by npm-registry-client@7.0.7
npm ERR! missing: prompt@^0.2.14, required by react-native-cli@0.1.4
=> You currently have modules installed globally with `npm`. These will no
=> longer be linked to the active version of Node when you install a new node
=> with `nvm`; and they may (depending on how you construct your `$PATH`)
=> override the binaries of modules installed with `nvm`:

/usr/local/lib
├── commander@2.9.0
├── cordova@5.3.3
├── download-cli@1.0.1
├── express@4.13.3
├── express-generator@4.13.1
├── forever@0.14.1
├── hexo@3.1.1
├── http-server@0.8.5
├── ionic@1.7.14
├── ios-deploy@1.8.2
├── ios-sim@5.0.3
├── JSONStream@1.0.6
├── koa@1.1.2
├──  error: ENOTDIR: not a directory, open '/usr/local/lib/node_modules/love/package.json
├── marked@0.3.5
├── n@2.0.2
├── node-gyp@3.2.0
├── nw@0.12.3
├── nw-gyp@0.12.4
├── react-native-cli@0.1.4
├── react-tools@0.13.3
├── remem@1.0.3 -> /Users/weichuang/Desktop/rem/remem
├── showdown@1.2.3
├── supervisor@0.6.0
└── typescript@1.6.2

=> If you wish to uninstall them at a later point (or re-install them under your
=> `nvm` Nodes), you can remove them from the system Node as follows:

     $ nvm use system
     $ npm uninstall -g a_module

=> Close and reopen your terminal to start using nvm

Though i Close and reopen my terminal to start using nvm,the problem is still -bash: nvm: command not found

Cœur
  • 37,241
  • 25
  • 195
  • 267
WflytoC
  • 215
  • 2
  • 4
  • 11
  • Possible duplicate of [Node Version Manager install - nvm command not found](http://stackoverflow.com/questions/16904658/node-version-manager-install-nvm-command-not-found) – gnerkus Mar 26 '16 at 20:23

2 Answers2

15

Type in terminal

source ~/.nvm/nvm.sh
source ~/.profile
source ~/.bashrc
Penny Liu
  • 15,447
  • 5
  • 79
  • 98
Slavik Muz
  • 1,157
  • 1
  • 15
  • 28
2

My answer is based on Mac OS X but I am sure it should work for other Linux based system.

Installing & using nvm on Mac OS X

  • Install homebrew from here.
  • Using homebrew install nvm

    brew update brew install nvm

  • Create .nvm directory at ~/.nvm location.

    mkdir ~/.nvm

  • Now if you don't have .bash_profile file setup for OS X terminal then please create a .bash_profile at the root level:

    nano ~/.bash_profile

  • Paste below code in the .bash_profile and press CTRL + O and press enter to save .bash_profile file. Press CTRL + X to exit from editor:

    export NVM_DIR=~/.nvm source $(brew --prefix nvm)/nvm.sh

  • Now either quite (CMD + Q) the terminal or run below command to load .bash_profile settings:

    source ~/.bash_profile

  • Now run nvm ls command to get the list of all installed nodejs versions.

S.Mishra
  • 3,394
  • 28
  • 20