Apparently, there was a /Users/myusername/local
folder that contained a include
with node
and lib
with node
and node_modules
. How and why this was created instead of in my /usr/local
folder, I do not know.
Deleting these local references fixed the phantom v0.6.1-pre. If anyone has an explanation, I'll choose that as the correct answer.
EDIT:
You may need to do the additional instructions as well:
sudo rm -rf /usr/local/{lib/node{,/.npm,_modules},bin,share/man}/{npm*,node*,man1/node*}
which is the equivalent of (same as above)...
sudo rm -rf /usr/local/bin/npm /usr/local/share/man/man1/node* /usr/local/lib/dtrace/node.d ~/.npm ~/.node-gyp
or (same as above) broken down...
To completely uninstall node + npm is to do the following:
- go to /usr/local/lib and delete any node and node_modules
- go to /usr/local/include and delete any node and node_modules directory
- if you installed with brew install node, then run brew uninstall node in your terminal
- check your Home directory for any local or lib or include folders, and delete any node or node_modules from there
- go to /usr/local/bin and delete any node executable
You may also need to do:
sudo rm -rf /opt/local/bin/node /opt/local/include/node /opt/local/lib/node_modules
sudo rm -rf /usr/local/bin/npm /usr/local/share/man/man1/node.1 /usr/local/lib/dtrace/node.d
Additionally, NVM modifies the PATH variable in $HOME/.bashrc
, which must be reverted manually.
Then download nvm and follow the instructions to install node. The latest versions of node come with npm, I believe, but you can also reinstall that as well.
The command is simply npm uninstall <name>
The Node.js documents https://npmjs.org/doc/ have all the commands that you need to know with npm.
A local install will be in the node_modules/
directory of your application. This won't affect the application if a module remains there with no references to it.
If you're removing a global package, however, any applications referencing it will crash.
Here are different options:
npm uninstall <name>
removes the module from node_modules
but does not update package.json
npm uninstall <name> --save
also removes it from dependencies
in package.json
npm uninstall <name> --save-dev
also removes it from devDependencies
in package.json
npm uninstall -g <name> --save
also removes it globally
Best Answer
I have also faced the same issue in recent past for me I have do the following commands one by one in terminal.
After this run
If still get angular-cli version 1.0.0-beta.2x.x then run the following command
It will show the ng path. Go to the path and if it is linked with any file remove the same the link and actual ng file. In my case the link is in /usr/bin/ng and actual path of ng file is /lib/node_modules/@angular/cli/bin/ng.
Next you need to install @angular/cli using
Close all the terminal and run ng -v and you are on. May be it will help someone. Thanks :)