How do I completely uninstall Node.js, and reinstall from beginning (Mac OS X)
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.
How to uninstall node v14 from MacOS 10.15?
Execute this commands in your terminal:
sudo rm -rf ~/.npm ~/.nvm ~/node_modules ~/.node-gyp ~/.npmrc ~/.node_repl_history
sudo rm -rf /usr/local/bin/npm /usr/local/bin/node-debug /usr/local/bin/node /usr/local/bin/node-gyp
sudo rm -rf /usr/local/share/man/man1/node* /usr/local/share/man/man1/npm*
sudo rm -rf /usr/local/include/node /usr/local/include/node_modules
sudo rm -rf /usr/local/lib/node /usr/local/lib/node_modules /usr/local/lib/dtrace/node.d
sudo rm -rf /opt/local/include/node /opt/local/bin/node /opt/local/lib/node
sudo rm -rf /usr/local/share/doc/node
sudo rm -rf /usr/local/share/systemtap/tapset/node.stp
References:
https://www.codegrepper.com/code-examples/delphi/how+uninstall+node+mac
https://stackabuse.com/how-to-uninstall-node-js-from-mac-osx/
How to uninstall node.js
Complete uninstall Node.js on macOS Monterey version 12.0.1
To check the current node version installed on your system:
# node -v
# v14.15.0
Enter the given below commands to delete Node from your system:
# cd /usr/local/include
# sudo rm -R node
# cd ../lib
# sudo rm -R node_modules
# cd ../bin
# sudo rm -R node
to check that node doesn't exist anymore
# node -v
# -bash: node: command not found //if this came that means it uninstall successfully
How do I uninstall nodejs installed from pkg (Mac OS X)?
I ran:
lsbom -f -l -s -pf /var/db/receipts/org.nodejs.pkg.bom \
| while read i; do
sudo rm /usr/local/${i}
done
sudo rm -rf /usr/local/lib/node \
/usr/local/lib/node_modules \
/var/db/receipts/org.nodejs.*
Coded into gist 2697848
Update
It seems the receipts .bom
file name may have changed so you may need to replace org.nodejs.pkg.bom
with org.nodejs.node.pkg.bom
in the above. The gist has been updated accordingly.
npm uninstall not working in Mac terminal
If you want to install a new version of Node.js, then you can simply download it from the website (nodejs.org).
When you install a new version and run the installer, it will automatically remove the old version.
If you want to remove Node.js and npm altogether, then you need to follow the steps below.
Open the terminal, and navigate to the home directory.
Type the following commands (ignore the $; they are just to indicate a new command to enter).
$ cd /usr
$ cd local
$ cd include
$ lsThen, delete the Node directory by typing in the following command.
$ sudo rm -rf node
Go back to the local directory, and enter the
lib
directory by entering the following commands.$ cd ..
$ cd libDelete the
node_modules
folder by entering the following command.$ sudo rm -rf node-modules
To delete Node from the
bin
directory, type in the following commands.$ cd ..
$ cd bin
$ sudo rm -rf nodeNote:
npm
andnpx
can both be deleted from thebin
directory.
Uninstalling and Reinstalling Node with Homebrew
First check where your node is installed by doing
$ which node
If you have a path something like /usr/local/bin/node try reinstalling node.
If you have a path something like ~/.nvm/versions/node/v11.13.0/bin/node then your are running your node from nvm.
If that is the case, check if your ~/.bashrc
or your ~/.zshrc
depending on your terminal, and confirm if there are any commands that looks something like this.
export NVM_DIR="$HOME/.nvm"
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" # This loads nvm
[ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion" # This loads nvm bash_completion
Remove these lines, and run the following command depending on your terminal.
$ source ~/.bashrc
$ source ~/.zshrc
Then check your node version again. Hopefully that solves your problem.
Mac OS 10.13.5 npm and node complete uninstall is failing
I would suggest checking with which node
to find the full path executable (ref).
Once you have the location you can remove the folder and that should help removing the last instance of node still available on your machine.
How do I completely uninstall Node.js, and reinstall from beginning (Mac OS X)
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.
Related Topics
JavaScript Equivalent to Printf/String.Format
Accessing the Web Page'S Http Headers in JavaScript
Why Is Setstate in Reactjs Async Instead of Sync
How Does the "This" Keyword in JavaScript Act Within an Object Literal
How to Get the Current Date in JavaScript
How to Display a JavaScript Object
What Does "JavaScript:Void(0)" Mean
Get the Name of an Object'S Type
What Is JavaScript Garbage Collection
Origin Null Is Not Allowed by Access-Control-Allow-Origin
What Characters Are Valid For JavaScript Variable Names
Counting the Occurrences/Frequency of Array Elements
What Does "Use Strict" Do in JavaScript, and What Is the Reasoning Behind It
Updating a Nested Array With Mongodb
Remove Empty Elements from an Array in JavaScript
How Does "This" Keyword Work Within a Function