How to fix "yo: command not found" after installing Yeoman

macos, node.js, npm, osx-mountain-lion, yeoman

Solution

The source of the problem is that you have NODE_PATH set while using NVM at the same time. When you use NVM you shouldn't have a NODE_PATH variable at all, since NVM installs global packages in its version specific root.

Delete all packages that are in your NODE_PATH, remove the environment variable, and install yo and the generators or any other global packages you need. You will see that it stops complaining and everything ends up in the nvm subdirectory matching the current version.

When you start using a different Node version in NVM, reinstall the global packages. This will keep everything organised neatly by version like its meant to be.

More info on this discussion here: https://github.com/creationix/nvm/pull/97

Problem

Following these instructions, I tried to install yeoman using npm twice: http://yeoman.io/learning/index.html After the first failure, I uninstalled node using these instructions: How do I completely uninstall Node.js, and reinstall from beginning (Mac OS X) Then, I installed nvm and node/npm (via nvm) with one error: ``` [Yeoman Doctor] Uh oh, I found potential errors on your machine --------------- [Error] NPM root value is not in your NODE_PATH [info] NODE_PATH = /Users/joanna/.nvm/v0.10.22/lib/node_modules:. NPM root = /Users/joanna/.node/lib/node_modules [Fix] Append the NPM root value to your NODE_PATH variable Add this line to your .bashrc export NODE_PATH=$NODE_PATH:/Users/joanna/.node/lib/node_modules Or run this command echo "export NODE_PATH=$NODE_PATH:/Users/joanna/.node/lib/node_modules" >> ~/.bashrc && source ~/.bashrc ``` I pasted that command in, and then I ran `npm install -g yo` again. After following the instructions from the yeoman site again, it still can't find yeoman. I receive this error: -bash: yo: command not found What is wrong? The Yeoman Doctor says: "Everything looks alright!"

Original source

Related problems