After I updated homebrew, I can't use homebrew to upgrade node. It can't find node.
Updated Brew on mac M1
After getting this error
Error: Cannot install in Homebrew on ARM processor in Intel default prefix (/usr/local)!
Please create a new installation in /opt/homebrew using one of the
"Alternative Installs" from:
https://docs.brew.sh/Installation
You can migrate your previously installed formula list with:
brew bundle dump
I updated homebrew using:
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)" for my mac M1.
Then I followed the instructions for two commands brew said to run.
Then I ran these commands:
$ cd ~
$ brew bundle dump
UPDATE: $ brew bundle dump didn't do what I expected. When I look in /opt/homebrew/bin not all of the contents from /usr/local/bin are there, but I would expect them to move there.
Now Brew can't find node
$ brew upgrade node
Gave me:
Error: node not installed
but $ node -v gives
v12.6.0
And the BrewFile that $ brew bundle dump created shows node: brew "node".
I misunderstood what brew bundle dump does. It only creates a file that says the packages that brew should install.
BrewFile works like a package.json file in node.js. You have to run brew bundle install to install the packages listed in BrewFile.
So my node package was still in the old location usrs/local/bin and node was not in opt/homebrew/bin where it should be.
To fix, I moved the BrewFile into the new brew location opt/homebrew then ran brew bundle install from in that directory. Now node is in the correct place opt/homebrew/bin along with all my other brew packages.
Now which node gives:
/opt/homebrew/bin/node
It looks like this also updated node. But you have to open a new terminal. node -v will then show the newly instaled version. Your old version is still in usrs/local/bin but it looks like the paths corrected for me.
Related
I am trying to link to an older version of node using homebrew in my mac (because netlify doesn't work with v17 - which is my default).
When I search which versions of node I have installed, I can see that both 16 and 14 are available.
brew search node
==> Formulae libbitcoin-node node ✔ node-sass node#12 node#16 nodebrew nodenv
llnode node-build node#10 node#14
node_exporter nodeenv ode
I expect to be able to run brew unlink node (which works fine) and then
brew link node#16 or brew link node#14, but in both cases, I get an error that says:
Error: No such keg: /usr/local/Cellar/node#16
How can I ask homebrew to use an old version of node?
This is what I did:
brew install node#16
export PATH="/opt/homebrew/opt/node#16/bin:$PATH" (you need to put into ~/.bash_profile or ~/.zprofile to persist the change)
And then I can see the node points to node##16
$ which node
/opt/homebrew/opt/node#16/bin/node
$ node --version
v16.14.2
You could do
brew link --overwrite node#16
I'm trying to use node 8.9.1 but when trying to update using brew it says 8.9.1 is already installed
James-MacBook:~ james$ brew upgrade node
Error: node 8.9.1 already installed
But when checking the version it shows
James-MacBook:~ james$ node --version
v0.10.48
So then I tried to switch to 8.9.1
James-MacBook:~ james$ brew switch node 8.9.1
Cleaning /usr/local/Cellar/node/8.9.1
7 links created for /usr/local/Cellar/node/8.9.1
But it is still showing as 0.10.48
James-MacBook:~ james$ node --version
v0.10.48
It sounds like you have some version of node that is installed without using Homebrew.
First of all, check if you installed your node with nvm by check if you have a .nvm directory in home directory ls -la
if you do, remove that directory
brew update && brew install node#8 (whichever node you want)
brew unlink node#0
brew link --force node#8
Do brew update && brew upgrade node#8
Happy coding
Nvm package... kind of slows down your terminal upon startup. I found it annoying....
You can always just uninstall node and install node that’s compatible with npm on
Nodejs.org link below
All node version link <- !
look for pkg if your mac user, and msi for windows users
I'm trying to specifically install Node.js v6, which is proving confusingly difficult.
On a new MacBook running Sierra, I've run:
brew install node#6
This gave me:
Please note by default only English locale support is provided. If you need
full locale support you should either rebuild with full icu:
`brew reinstall node --with-full-icu`
or add full icu data at runtime following:
https://github.com/nodejs/node/wiki/Intl#using-and-customizing-the-small-icu-build
This formula is keg-only, which means it was not symlinked into /usr/local.
This is an alternate version of another formula.
If you need to have this software first in your PATH run:
echo 'export PATH="/usr/local/opt/node#6/bin:$PATH"' >> ~/.zshrc
For compilers to find this software you may need to set:
LDFLAGS: -L/usr/local/opt/node#6/lib
CPPFLAGS: -I/usr/local/opt/node#6/include
Bash completion has been installed to:
/usr/local/etc/bash_completion.d
==> Summary
🍺 /usr/local/Cellar/node#6/6.9.5: 3,891 files, 41.3M
If I run which node, I get node not found. If I run brew link node, I get Error: No such keg: /usr/local/Cellar/node. I also ran sudo chown -R $USER /usr/local.
How can I "link" Node.js v6 so that other software can find it? Do I run echo 'export PATH="/usr/local/opt/node#6/bin:$PATH"' >> ~/.zshrc? I don't want to run anything I'm not sure of.
Don't use Homebrew to install node.
I like the Node Version Manager (NVM), and there is n (as mentioned by #ntalbs in the comments). These are better options on a Mac for node, to avoid certain. issues. later.
Note, you can install nvm and n via Homebrew. (brew install nvm or brew install n).
I have been trying to update nodejs for a long time now. When I run node -v, it tells me I am using: v0.10.40. But when I look at nodejs.org it says the v7.4.0?
I have cleaned the npm cache and done a reinstall with sudo n stable but still v0.10.40, and the last time that I updated npm it prompted me that my node version is too old and outdated.
What am I doing wrong. And can somebody tell me if v0.10.40 is the current or an outdated version?
You likely have two versions of node installed and in your path. If you are on OSX or linux, run which node (if on Windows, you may npm i -g #raider/which, and then run which node). This should give you the location of the old version of node.
Then run mv path/to/old/node path/to/old/node.bak, replacing with the actual path, and rerun node --version to see if it picks up the right version now.
UPDATE: If you are on Ubuntu or another Debian based Linux, you should install the latest with the following commands:
curl -sL https://deb.nodesource.com/setup_7.x | sudo -E bash -
sudo apt-get install -y nodejs
UPDATE: If you are using nvm, run nvm install node followed by nvm use node in a new terminal to get the latest that nvm supports.
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.