How to completely uninstall Node.js, and then reinstall from scratch (Mac OS X)

This translation from: How do the I Completely Uninstall Node.js, and REINSTALL from Beginning (the X-Mac OS)

My version of node is always v0.6.1- pre even after I install brew node and NVM install v0.6.19. My version is always the node v0.6.1-pre, even though I installed brew node and v0.6.19 NVM also installed .

My node version is: My node version is:

node -v
v0.6.1-pre

(Pic) the this NVM (A Version of the After the I install the Node for First Time in One bash at The Terminal): NVM say (I bash in a terminal node in a version for the first time after installation):

nvm ls
v0.6.19
current:    v0.6.19

But when I restart bash, this is what I see: but when I restart bash, this is what I saw:

nvm ls
v0.6.19
current:    v0.6.1-pre
default -> 0.6.19 (-> v0.6.19)

So where is this phantom node 0.6.1- pre version and how can I get rid of it? Well, this phantom nodes where version 0.6.1-pre, how do I get rid of it? Trying to install the Libraries'm the I Via NPM that the I CAN SO ON A Work Project. , So that you can work on a project by NPM I'm trying to install the library.

I tried using BREW to update before NVM , using "brew update" and "brew install node". I try to use BREW be updated before the NVM, use the "brew update" and "brew install node". I've tried deleting the "node" directory in my / usr / local / include and the "node" and "node_modules" in my "/ usr / local / lib". I try to delete / usr / local / include in the " node "directory and" / usr / local / lib "in the" node "and" node_modules ". Npm I've Tried uninstalling and the I Reinstalling IT following THESE Instructions. I have tried to follow the following instructions to uninstall and re-install npm.

All of this because I was trying to update an older version of node to install the "zipstream" library. All of this is because I'm trying to update the old version of the node to install "zipstream" library. Now there's folders in my users directory , and the node version STILL is not up to date, even though NVM says it's using 0.6.19. Now, I have a folder in the user directory, and the node is not the latest version STILL, even if NVM said it is using 0.6.19.

Ideally, I'd like to uninstall nodejs , npm, and nvm, and just reinstall the entire thing from scratch on my system. Ideally, I would like to unload nodejs, npm and nvm, then reinstall the entire system from scratch.


#1st Floor

Reference: https://stackoom.com/question/ktta/ Node-js- how to completely uninstall and then reinstall from scratch -Mac-OS-X


#2nd Floor

Apparently, there WAS A /Users/myusername/localFolder that Contained A includewith nodeand libwith nodeand node_modules. Obviously, there is a /Users/myusername/localfolder that contains a include nodeand liband nodeand node_modules. Why the this WAS the Created and How INSTEAD of in My /usr/localFolder, the I do not know. I do not know how and why it was created, but not in my /usr/localcreated folder.

Deleting these local references fixed the phantom v0.6.1 -pre. Delete these local references repairable Mirage v0.6.1-pre. If anyone has an explanation, I'll choose that as the correct answer. If someone has to explain, I would choose it as the correct answer.

EDIT: Editor:

You may need to do the additional instructions as well: You may need to perform additional instructions:

sudo rm -rf /usr/local/{lib/node{,/.npm,_modules},bin,share/man}/{npm*,node*,man1/node*}

which is the equivalent of (same as above) ... is equivalent to (the 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 ... or (same as above) ... corrupted

To completely uninstall node + npm is to do the following: To completely uninstall node + npm, do the following:

  1. to Go / usr / local / lib and the Delete the any the Node and node_modules go to / usr / local / lib and remove any node and node_modules
  2. to Go / usr / local / include and the Delete the any node and node_modules Directory to / usr / local / include and remove any node and node_modules directory
  3. Installed with you IF BREW install the Node , the then RUN BREW Uninstall the Node in your Terminal if you installed the brew install node and run on your terminal, BREW unloading nodes
  4. your Home Directory for the any the Check local or lib or the include Folders, and the Delete the any the Node or node_modules from there if there are any inspection home directory local or lib or contain folders from here and remove any node or node_modules
  5. to Go / usr / local / bin and the Delete the any the Node Executable go to / usr / local / bin and delete any node executable file

You may also need to do: You may also need to do the following:

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, The PATH variable in the NVM MODIFIES $HOME/.bashrc, Which MUST BE reverted Manually . Further, the NVM modify $HOME/.bashrcthe PATH variable that must be manually restored .

Downloads the Then nvm and Follow Instructions The Node to the install. Then download nvm to get the latest node. Latest versions of node Come at The with npm , the I Believe, But Also REINSTALL that you CAN AS Well. I believe the latest version node is npm incidental, but you can reinstall it.


#3rd floor

I have been by an issue during uninstall . Hit of Node.js on my mac Problems uninstalling Node.js on your Mac. HAD some Strange behavior like the I npmIS Still Their Removing the even the After the HAVING IT with All the this. Even if all these elements removed, I still have some strange behavior, for example, npmis still their behavior.

It was because I had an old install done with macport. This is because I finished the old installation macport. So you also have to uninstall it using port: Therefore, you must also use the port to uninstall it:

sudo port uninstall nodejs

It may have install many different versions of Node.js so uninstall them all (one by one). Many different versions of Node.js it may be installed, so (eleven unload) them.


#4th floor

On Mavericks I install it from the node pkg (from nodejs site) and I uninstall it so I can re-install using brew. On the Mavericks, I (from nodejs site) to install it from node pkg, and uninstalled it, it can be use brew reinstalled. I only run 4 commands in the terminal : I only run four commands in a terminal:

  1. sudo rm -rf /usr/local/lib/node_modules/npm/
  2. brew uninstall node
  3. brew doctor
  4. brew cleanup --prune-prefix

If there is still a node installation, repeat step 2. After all is ok, I install using brew install node if nodes still installed, repeat step 2. After everything is normal, I will use brew install nodebebrew install node


#5th Floor

I know this post is a little dated but just wanted to share the commands that worked for me in Terminal when removing Node.js. I know this article somewhat outdated, but just wanted to share when deleting Node.js useful to me in the Terminal The command.

lsbom -f -l -s -pf /var/db/receipts/org.nodejs.pkg.bom | while read f; do  sudo rm /usr/local/${f}; done

sudo rm -rf /usr/local/lib/node /usr/local/lib/node_modules /var/db/receipts/org.nodejs.*

UPDATE: 23 SEP 2016 Update:23 SEP 2016


If you're afraid of running these commands ... If you are concerned about running these commands ...

To Thanks jguixfor this quick tutorial. Thank jguixprovided this quick tutorial.

First, create an intermediate file: First, create an intermediate file:

lsbom -f -l -s -pf /var/db/receipts/org.nodejs.node.pkg.bom >> ~/filelist.txt

Review your File Manually (located block in your HomeFolder) manually check your files (located in the Homefolder)

 ~/filelist.txt

Then delete the files: Then delete the file:

cat ~/filelist.txt | while read f; do sudo rm /usr/local/${f}; done

sudo rm -rf /usr/local/lib/node /usr/local/lib/node_modules /var/db/receipts/org.nodejs.*

For 10.10.5 and above applies to 10.10.5 and above

Thanks Lenar Hoyt thanksLenar Hoyt

Gist Comment Source: gistcomment-1572198 Highlights comment Source: gistcomment-1572198

Original Gist: TonyMtz/d75101d9bdf764c890ef Original points: TonyMtz/d75101d9bdf764c890ef

lsbom -f -l -s -pf /var/db/receipts/org.nodejs.node.pkg.bom | while read f; do sudo rm /usr/local/${f}; done

sudo rm -rf /usr/local/lib/node /usr/local/lib/node_modules /var/db/receipts/org.nodejs.*

#6th floor

maybe you need to make maybe you need

hash -r 

it helps with problem of symlink it helps to solve the problem of a symbolic link

$ node -v
$ bash: /opt/local/bin/node: No such file or directory
Original articles published 0 · won praise 73 · views 550 000 +

Guess you like

Origin blog.csdn.net/w36680130/article/details/105265486