Delete node js mac os

How to completely uninstall and re-install Node.js and npm in Mac OS

In this tutorial, we are going to learn how to uninstall and re-install node and npm in mac os using terminal and nvm (node version manager).

Uninstalling Node and Npm

To completely uninstall node and npm follow the below steps.

Open your terminal.

Now, run the below command by hitting the enter key.

  1. At final run the following commands, to delete any node or node_modules inside the bin directory.
  1. Verify if the node is completely uninstalled or not using node -v command.

If the output shows command not found then you are successfully uninstalled.

Installing node and npm using nvm

We are using the node version manager (nvm) to download and install the latest version of node.js (with npm included).

  1. Run the following command in your terminal to install the nvm.
  1. If your using bash or zsh, you need to add the following code to

To open bashrc file in vscode use code

To open zshrc file in vscode use code

  1. Verify the nvm installation by running the below command.

If the output shows a version number then you are successfully installed.

  1. Now, run the following command to download and install the latest version of node.

If you want to install a long term support (LTS) version use this command.

Источник

How to Uninstall Node.js from Mac OSX

If you read one of my earlier posts on how to install Node.js, you probably noticed there are quite a few ways to install it on your computer. This could be from a package manager, from the source code, or from a pre-compiled binary distribution. So, what do you do when you want to uninstall Node.js?

Here I’ll be describing a few ways you can uninstall it from your Mac OSX computer. Just keep in mind that these commands will remove the Node executable, and not necessarily all of the Node projects or NPM cache.

Manually

If you installed Node either by source or from a binary distribution then you’ll likely have to delete the executable and other resources manually. Unfortunately, this isn’t easy since there are quite a few directories containing Node resources, like npm and node_modules .

To completely uninstall the node executable as well as npm , here are some instructions on what to do:

Note that not all of the directories listed here may exist on your system depending on your install method.

  • Delete node and/or node_modules from /usr/local/lib
  • Delete node and/or node_modules from /usr/local/include
  • Delete node , node-debug , and node-gyp from /usr/local/bin
  • Delete .npmrc from your home directory (these are your npm settings, don’t delete this if you plan on re-installing Node right away)
  • Delete .npm from your home directory
  • Delete .node-gyp from your home directory
  • Delete .node_repl_history from your home directory
  • Delete node* from /usr/local/share/man/man1/
  • Delete npm* from /usr/local/share/man/man1/
  • Delete node.d from /usr/local/lib/dtrace/
  • Delete node from /opt/local/bin/
  • Delete node from /opt/local/include/
  • Delete node_modules from /opt/local/lib/
  • Delete node from /usr/local/share/doc/
  • Delete node.stp from /usr/local/share/systemtap/tapset/

This list should include just about all the references to Node on your system. Keep in mind there may be more. Please let me know if you find any others (and how you installed Node originally)!

Homebrew

The Homebrew method is arguably one of the easiest ways to get Node on and off your system. The command to remove it is just as simple as the command to install it. Assuming you used brew install node to install it, just execute this to get rid of it:

And that’s it! All traces of the executable will be gone from your system.

The Node Version Manager (NVM) is almost as convenient as Homebrew, but in a different way. It allows you to install multiple versions of Node on your system so you can easily switch from one to the other.

Eventually, you’ll probably want to get rid of one of the versions when you’re done with it. And like Homebrew, you can easily do this using a command similar to the way you installed it:

And a complete example of this might be something like:

Free eBook: Git Essentials

Check out our hands-on, practical guide to learning Git, with best-practices, industry-accepted standards, and included cheat sheet. Stop Googling Git commands and actually learn it!

And now only version v0.12.2 of Node will be uninstalled. Keep in mind that if you had multiple versions installed, then Node will still be on your system, but not v0.12.2 (using the example above).

Phantom Installs

If for some reason none of the above methods worked for you, then you can always hunt down the executable using the command line tool which . This command shows you the location of the file for a given command.

We can use this to find where Node is installed on your system. You can try this with:

You can see in the output that my node command is linked to an NVM version, although yours may be located somewhere else. Now I can use this info to uninstall it.

Using this tool should help you find out how the executable was installed or how to remove it manually.

Источник

Как удалить NodeJS, установленный из pkg (Mac OS X)?

Я установил NodeJS из файла pkg на моем Mac. Теперь мне нужно удалить его. Скажите, пожалуйста, как это сделать. Я попытался удалить файлы из этого списка:

но узел все еще на моем компьютере.

10 ответов

обновление Кажется, квитанции .bom имя файла может быть изменено, поэтому вам может потребоваться заменить org.nodejs.pkg.bom С org.nodejs.node.pkg.bom в выше. Суть была обновлена соответствующим образом.

Если вы установили узел из их сайт, попробуйте это:

после предыдущих сообщений, вот полный список, который я использовал

для удаления «родного» узла.установка js, я использовал метод, предложенный в предыдущих ответах sudo npm uninstall npm -g дополнительные sudo rm -rf /usr/local/lib/node /usr/local/lib/node_modules /var/db/receipts/org.nodejs.* .

но мне также пришлось удалить следующие два каталога:

только после этого я смог установить узел.js с Homebrew.

Это полный список команд, которые я использовал (спасибо плакатов выше):

используйте npm для удаления. Просто бегу sudo npm uninstall npm -g удаляет все файлы. Чтобы избавиться от посторонних вещей, таких как bash pathnames, запустите это (из ответа nicerobot):

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

Я взял список Арба, добавив еще три файла. Вот полный список, который я использовал:

небольшой удобный скрипт, расширяющийся на предыдущие ответы.

сохраните его в файл и запустите с:

мне пришлось удалить следующие файлы, так как brew пожаловался в install позже после ручного удаления всех файлов.

а затем сделайте следующее

следующее работало после проб и ошибок, и эти каталоги не были доступны для записи, поэтому я удалил их и, наконец, смог заменить node & npm.

Источник

dotcomputercraft / gist:b7283bd52f4b5389e748

the best way (I’ve found) 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 need to do the additional instructions as well:
sudo rm /usr/local/bin/npm
sudo rm /usr/local/share/man/man1/node.1
sudo rm /usr/local/lib/dtrace/node.d
sudo rm -rf

/.npm sudo rm -rf

/.node-gyp sudo rm /opt/local/bin/node sudo rm /opt/local/include/node sudo rm –rf /usr/local/bin/node sudo rm -rf /opt/local/lib/node_modules sudo rm -rf /Users/[homedir]/.npm sudo rm -rf /usr/local/bin/npm sudo rm -rf /usr/local/share/man/man1/node.1 sudo rm -rf /usr/local/lib/dtrace/node.d Then install nodeJS via Node Version Manager 1. Install NVM by running the following in Terminal using cURL: curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.25.4/install.sh | bash or Wget: wget -qO- https://raw.githubusercontent.com/creationix/nvm/v0.25.4/install.sh | bash 2. Update «$HOME/.bash_profile» to include the following lines: export NVM_DIR=»$HOME/.nvm» [ -s «$NVM_DIR/nvm.sh» ] && . «$NVM_DIR/nvm.sh» # This loads nvm nvm use v0.12.4 3. Install Node.js by running the following in Terminal: nvm install v0.10.31 nvm install v0.12.0 nvm install v0.12.4 nvm alias default 0.12.4 nvm use v0.12.4 4. source «$HOME/.bash_profile»

This comment has been minimized.

Copy link Quote reply

priyankamalviya commented Jan 22, 2018

I get a bunch of EPERM errors on sudo rm -rf

/.node-gyp
sudo rm /opt/local/bin/node.. 🙁

This comment has been minimized.

Copy link Quote reply

great2gether commented Feb 9, 2018

Better with homebrew from the terminal:
$ brew uninstall node

This comment has been minimized.

Copy link Quote reply

jtiscione commented Mar 2, 2018

Unfortunately homebrew has a habit of corrupting Node installations on OSX.

This comment has been minimized.

Copy link Quote reply

danfoy commented Aug 31, 2018

I’m 80% confident I’ve buggered nodejs on my new MacBook by trying to install via homebrew, which is how I found this gist. Lessons learned.

This comment has been minimized.

Copy link Quote reply

brandonimitch commented Feb 14, 2019

Thank you for this, really helpful!

This comment has been minimized.

Copy link Quote reply

DavidODonovan commented Mar 9, 2019

This comment has been minimized.

Copy link Quote reply

vikramvi commented Jul 22, 2019

Even after doing these steps on Mac 10.13.5, still I could see npm and node what may be going wrong ?

Источник

How To Uninstall Node JS and (NPM) from MacOS?

I am going to share with you step by step process about how to uninstall Node JS and Node Package Manager(NPM) from MacOS. I will use MacOS terminal to uninstall Node JS and NPM completely.

Follow the Step by Step Process to Uninstall Node Js from MacOS.

Go to MacOS Terminal

You can check out the Node installation in mac by using the below command. It will show node js version installed in your device.

Open the terminal and enter the given below command to know your current directory.

Go to your root directory.

Then enter into the usr directory by using following command.

Go to locale directory.

Enter into include folder by using given below command.

Now if you enter the ls command then you’ll see the node folder inside the include folder like given below.

We have to remove this node folder to completely uninstall the Node js from MacOS.

Remove node_modules from MacOS

In next step we have to completely remove node_modules from our system.

Follow the steps

Enter the below command to go back to previous folder.

Go to lib directory, hit the below command to enter into the lib directory.

Use the below command to remove the node_modules (NPM) folder.

Enter the below command to come out from the directory.

Go to bin folder using below command.

Here you also have to delete the node folder to uninstall the Node js completely.

Enter the below command to remove the Node js from MacOS.

Finally, we’ve successfully uninstalled the Node JS from MacOS, use the given below command to check whether the Node and NPM completely removed from our system.

We have completed our task if you are getting below output.

Источник

Читайте также:  Установить aimp плеер для windows 10
Оцените статью