Mac os uninstall nodejs

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 Install / Uninstall Node JS, NPM On Mac

This article will tell you how to install/uninstall Node JS and NPM(node package manager) on macOS step by step. There are three ways to install/uninstall it on macOS, run the official installer, install node binary for macOS directly, or use mac HomeBrew package manager. We will introduce them all.

1. Install / Uninstall Node.js Use Node Installer For macOS.

  1. Download Node.js mac installer (pkg file) from Node.js official site.
  2. Click the downloaded file to open the installer. Process the installation as normal by clicking the next or continue button. Please note where Node.js is installed. It will be installed to /usr/local/bin/node directory. And the npm( node package manager ) will be installed to /usr/local/bin/npm directory.
  3. After installation, open a terminal in macOS, run node -v and npm -v in the terminal to verify the installation.
  4. Uninstall node js in this way is just to delete node, node_modules folder under below global or your personal folders ( for example/usr/local/lib/node,/usr/local/lib/node_modules).
  5. You can also run the below command which is provided by the node official website to uninstall Node.js completely.

2. Install / Uninstall Node,js Use macOS Binary.

If you want to use multiple Node.js versions in your macOS. You can also download different versions of Node.js zip file, then unzip and save them in different folders. Then you can use different versions Node.js.

  1. Download node js MacOS version binary file.
  2. Unzip the zip file to a local folder, and cd into that folder in terminal. Then you can find the bin folder under it. The node and npm executable file are all saved in the bin folder.
  • Cd into the bin folder, and execute ./node -v and ./npm -v to verify node and npm version.
  • If you want to use this Node.js version conveniently, you can add the bin folder full path ( /Users/zhaosong/Downloads/node-v8.12.0-darwin-x64/bin ) to os system environment variable $PATH. Please read the article How To Set JAVA_HOME, MAVEN_HOME Environment Variable In macOS to learn how to add node bin folder in macOS $PATH value.
  • After the above step, you can run the node command from any directory in the terminal, you do not need to go to the node js bin folder to run it.
  • Uninstall node js in this method is similar to section one in this article. You need to remove the unzip node js folder and related installed node modules.
  • 3. Install / Uninstall Node.js Use macOS Homebrew.

    Homebrew is a macOS package manager tool. You can use it to install macOS software ( such as Node.js ) easily.

    1. Run brew -v in terminal to check whether homebrew is installed or not.
    2. If homebrew does not exist, then run the below command in the terminal to install it on your macOS.
    3. Then you can install node js use homebrew easily.
    4. Upgrade homebrew command.
    5. To upgrade node with homebrew.
    6. It is also very easy to uninstall node js with homebrew.

    Источник

    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.

    Источник

    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.

    Источник

    Читайте также:  Linux лучший музыкальный плеер для
    Оцените статью