I am trying to remove the package download of npm and node that I installed to install them with Homebrew instead. However I am having great difficulty in doing this. How can I get the package version of node.js and npm totally removed from my Mac so I can install the Homebrew version?
Note: I have tried sudo npm rm --global node however I get the error sudo: npm: command not found
check the link below for uninstalling node/npm
How do I uninstall nodejs installed from pkg (Mac OS X)?
and the brew error is happening due to permmision issue.
Since brew basically don't allow to be executed with sudo so change the directory permission before brew command.
changing permission:
sudo chown -R $USER:admin /usr/local
brew link command:
brew link node
and then you can use npm or node commands.
Related
I have npm v 5.6 and I installed node version 10.1 so the current npm doesn't support node version while updating npm I am getting EACCES permission denied error. I tried removing npm directory and updating via several command the npm version is stuck at 5.6. Help!!
Using Ubuntu v16.04 LTS.
I tried installing different nodejs version too but it also doesnt change npm version(npm v5.6).
visit here for the screenshot
I'd recommend using a version manager (such as nvm) to install multiple versions of Node.js and switch between them at will.
First off, make sure you have git and the build-essential package installed:
sudo apt-get update
sudo apt-get install build-essential git
Then install nvm with cURL (run this command in your terminal):
curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.33.11/install.sh | bash
This will clone the nvm repository to ~/.nvm and will make the required changes to your bash profile, so that nvm is available from anywhere in your terminal.
Reload your bash profile:
source ~/.bashrc
and verify the install by typing:
command -v nvm
which should output 'nvm' if the installation was successful.
(if this doesn't work, just close, then reopen your terminal)
And that’s it, nvm is installed and ready to be used.
Now, to download, compile, and install the latest release of Node, run the following from your terminal:
nvm install node
And then in any new shell just use the installed version:
nvm use node
Finally, verify the correct version is being used:
node -v
=> 10.5.0
There's a lot more to using nvm, such as installing multiple Node versions.
You can read more about that here: https://www.sitepoint.com/quick-tip-multiple-versions-node-nvm/
HTH
I installed node with brew 'brew install node', and I get a warning message
'Warning: The post-install step did not complete successfully'.
When I put in node -v, I can indeed see the current version of node, however when I try to find the current version of npm, I get this error.
-bash: /usr/local/bin/npm: No such file or directory
Is the reason that NPM does not exist because the post-install step did not complete successfully ?
Yup, that thing happened to me too. After a lot of searching I came to a solution. I think this would help you.
sudo brew uninstall node
brew update
brew upgrade
brew cleanup
brew install node
sudo chown -R myusername /usr/local
brew link --overwrite node
sudo brew postinstall node
Thanks!!
Homebrew and the Node download page install node.js in different locations that apparently conflict. Brew will complain after a 'brew doctor' if both locations are used.
So, is there a preferred way to put node on my Mac(Yosemite 10.10.5).
This is what I'm getting now while attempting to install node via brew.
node-4.1.0 already installed, it's just not linked
DONs-iMac:Erlang-Elixir donfox1$ brew link node
Linking /usr/local/Cellar/node/4.1.0...
Error: Could not symlink share/systemtap/tapset/node.stp
/usr/local/share/systemtap/tapset is not writable.
Have you tried chmoding 755 /usr/local/share/systemtap/tapset so it is writable? That could fix it?
chmod 755 /usr/local/share/systemtap/tapset
brew link node
Also try this if it does not work (may work):
brew cleanup
brew link node
brew uninstall node
brew install node
sudo chown -R $USER /usr/local/share/
brew doctor
brew install node
Uninstall node:
sudo rm -rf /usr/local/share/systemtap/ && brew uninstall node
and install nvm with brew - so you can control you node versions.
Read this article: suggested way to install npm with brew
If you are not sure about what version of node you need now and potentially need in the future I would also reccomend to install NVM - node version manager.
Download the nvm install script via cURL:
curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.33.0/install.sh | bash
Ensure that nvm was installed correctly with nvm --version, which should return the version of nvm installed.
Install the version of Node.js you want
Install the latest version with nvm install node
Use the latest version with nvm use node
Install the latest LTS version with nvm install --lts
Use the latest LTS verison with nvm use --lts
You can also check the tutorials:
installing-node-js-tutorial-using-nvm-on-mac-os-x-and-ubuntu
Best way to install and use nvm on Mac
So, lately i checked my npm version and got this error message:
Yogies-MacBook-Pro:bin yogieputra$ node --version
v0.12.7
Yogies-MacBook-Pro:bin yogieputra$ npm --version
-bash: /usr/local/bin/npm: No such file or directory
Yogies-MacBook-Pro:bin yogieputra$ brew install npm
Warning: node-0.12.7_1 already installed, it's just not linked
Anyone know how to fix this issue?
Run brew link nodeor brew doctor.
You could need sudo so sudo brew link node
To link already installed node, run following command:
brew link homebrew/versions/node012
For further explanation, you can go through this.
I'm new to this. I would like to use Grunt to run do some image optimalization. But I can't get it installed for some reason.
I've installed Homebrew by copying this in terminal:
ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
I've also installed node on my system (by downloading the .pkg and installing it).
When I check if Homebrew and Node are installed I get this:
Joost:~ jvd$ which brew
/usr/local/bin/brew
Joost:~ jvd$ which node
/usr/local/bin/node
When I try to install Grunt by using this code: npm install -g grunt-cli i get (also when I use $ sudo)
Joost:~ jvd$ npm install -g grunt-cli
-bash: npm: command not found
Same goes for: npm update -g npm.
Like I said Im fairly new to this so most of the things I just searched on the web. But can't figure this out. Does somebody know what is wrong?
Thanks!
Joost
This worked for me a couple weeks ago:
$ brew update
$ brew uninstall node
$ brew install node
$ sudo brew postinstall node
Might have to use sudo if you get any access errors. Sometimes installing node through homebrew causes errors. So another alternative would be to uninstall it and download the node.js package and install it yourself without homebrew.