installing particular version of node with homebrew is giving error - node.js

I neeed to install node version 10 and has followed below steps
brew install node#10
brew link node#10
above command gives error, thus tried
brew link node#10 --force
Now I'm getting error
If you need to have this software first in your PATH instead consider running:
echo 'export PATH="/usr/local/opt/node#10/bin:$PATH"' >> ~/.bash_profile
I've checked .bash_profile and above entry does exist, not getting why above error keeps on showing ?

As commented by #quentin, this is not an error, it is an informational message.
Secondly, I prefer using the package n for installing a specific version of Node. https://www.npmjs.com/package/n
Initially, you get the default version of node installed. And then you use n to play around with the Node versions.
Install n - $ npm install -g n
Installing node 10 - $ n 10
Installing node stable - $ n stable
Installing node latest - $ n latest
Installing node lts - $ n lts

I believe that you are still running an older node version. First, try to uninstall it with brew uninstall node#8 assuming that node 8 is installed.
Then
brew uninstall --ignore-dependencies --force node
brew uninstall --ignore-dependencies --force icu4c
brew install icu4c
brew unlink icu4c && brew link icu4c --force
brew install node#10
I experienced the same problem few days ago and I found tis blog post helpful: Mac Brew Node 10 upgrade

Related

Switching from Node installed with brew to Node installed with n

I have problem with switching from one version of node to another. When I run node -v i got: v10.24.0. And this version was installed with brew. Now I have to run something with older version of node (10.16.3), so I installed n package (npm install -g n ) and switched to desired version: sudo n 10.16.3. And I got:
installed : v10.16.3 to /usr/local/bin/node
active : v10.24.0 at /usr/local/opt/node#10/bin/node
Version .24 is installed with brew and .16 with n library. I was trying to remove version installed with brew (brew unlink node, brew uninstall --ignore-dependencies node), but still while checking versions I got v10.24.0. Could somebody tell me what else should I do to use the older version?

Unable to change version of node with brew switch

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

How to downgrade Node version

I want to downgrade my Node version from the latest to v6.10.3.
But nothing worked so far. Tried NVM and it gives an error as well by saying make command is not found. How can I downgrade Node?
Warning:
This answer does not support Windows OS
You can use n for node's version management. There is a simple intro for n.
$ npm install -g n
$ n 6.10.3
this is very easy to use.
then you can show your node version:
$ node -v
v6.10.3
For windows nvm is a well-received tool.
For windows:
Steps
Go to Control panel> program and features>Node.js then uninstall
Go to website: https://nodejs.org/en/ and download the version and install.
Determining your Node version
node -v // or node --version
npm -v // npm version or long npm --version
Ensure that you have n installed
sudo npm install -g n // -g for global installation
Upgrading to the latest stable version
sudo n stable
Changing to a specific version
sudo n 10.16.0
Answer inspired by this article.
In Mac there is a fast method with brew:
brew search node
You see some version, for example: node#10 node#12 ... Then
brew unlink node
And now select a before version for example node#12
brew link --overwrite --force node#12
Ready, you have downgraded you node version.
This may be due to version incompatibility between your code and the version you have installed.
In my case I was using v8.12.0 for development (locally) and installed latest version v13.7.0 on the server.
So using nvm I switched the node version to v8.12.0 with the below command:
> nvm install 8.12.0 // to install the version I wanted
> nvm use 8.12.0 // use the installed version
NOTE: You need to install nvm on your system to use nvm.
You should try this solution before trying solutions like installing build-essentials or uninstalling the current node version because you could switch between versions easily than reverting all the installations/uninstallations that you've done.
For windows 10,
Uninstalling the node from the "Add or remove programs"
Installing the required version from https://nodejs.org/en/
worked for me.
curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.33.11/install.sh | bash
sudo npm install -g n
sudo n 10.15
npm install
npm audit fix
npm start
If you're on Windows I suggest manually uninstalling node and installing chocolatey to handle your node installation. choco is a great CLI for provisioning a ton of popular software.
Then you can just do,
choco install nodejs --version $VersionNumber
and if you already have it installed via chocolatey you can do,
choco uninstall nodejs
choco install nodejs --version $VersionNumber
For example,
choco uninstall nodejs
choco install nodejs --version 12.9.1
If you are on macOS and are not using NVM, the simplest way is to run the installer that comes from node.js web site. It it clever enough to manage substitution of your current installation with the new one, even if it is an older one. At least this worked for me.
Try using the following commands
//For make issues
sudo apt-get install build-essential
curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.33.4/install.sh | bash
//To uninstall a node version
nvm uninstall <current version>
nvm install 6.10.3
nvm use 6.10.3
//check with
node -v
Steps to downgrade to node8
brew install node#8
brew link node#8 --force
if warning remove the folder and files as indicated in the warning then again the command :
brew link node#8 --force
For windows users, you guys can downgrade using following commands.
npm uninstall -g node
npm install -g node#version
#version is your specified version, example : 12.22.3(little old)
Can find node releases here https://nodejs.org/en/download/releases/
I have used brew in mac to downgrade the node
follow the steps you will have the result:
brew search node (here you can see the version eg: node#10, node#12, node#14)
brew unlink node
brew install < node version > (eg: node#12)
brew link --overwrite node#12
If you are using nvm, following are the ways -
1. nvm install node_version
2. nvm use --delete-prefix node_version
For more insights, see this image -
Ubuntu:
nvm list
nvm use <version>
nvm list // Shows all the versions on your machine. Of course have your version installed.
nvm use // Use this version
it seems to be a compatibility issue, run
sudo n 14
then npm install or yarn install again. It will work
In case of windows, one of the options you have is to uninstall current version of Node. Then, go to the node website and download the desired version and install this last one instead.
I had to downgrade node to v10.16.0
sudo n 10.16.0
nvm use v10.16.0
this solved the problem for me
WINDOWS: Best way that you can do it and to not lose time.
Go to control panel
Uninstall Program
Uninstall node
Then go and find the version that you want to install, install it from the beginning.
Link with node versions: https://nodejs.org/uk/blog/release/
Here is a simple solution
Go to this link and download & install the suitable nvm setup on your computer
https://github.com/coreybutler/nvm-windows
Type nvm list to get list of installed node versions
Type nvm install <node-version>
Type nvm use <version>
here we go you got node version you want.
Browse here to find node versions => https://nodejs.org/en/download/releases/
The Node.js team suggests to use the following Node.js version managers to switch between different versions of Node:
OSX or Linux:
nvm
n
Windows:
nodist
nvm-windows
I personally made good experiences using "nvm-windows" on Windows 11.
I would recommend using NVS (Node Version Switcher).
You can see the source here and all you need is a package manager. Like Chocolatey or Homebrew.
Install it
choco install nvs
Add a version:
nvs add v16
Switch to any version you installed
nvs use v16
At the end if you "run node -v" you'll get the current you've switched.

Installing node with brew fails on Mac OS Sierra

I'm trying to install node with homebrew on macOS Sierra.
I run
brew install node
After a seemingly successful install I get the following when trying to run node:
dyld: Library not loaded: /usr/local/opt/icu4c/lib/libicui18n.58.dylib
Referenced from: /usr/local/bin/node
Reason: image not found
Abort trap: 6
This is the series of incantations that eventually worked for me based on this link suggested by #robertklep and #vovkasm.
brew uninstall --force node
brew uninstall icu4c && brew install icu4c
brew unlink icu4c && brew link icu4c --force
brew install node
I'm not sure if they're all needed, but given that I can't get my machine in the previous state... I'll just leave this info here, maybe it'll be useful for somebody else.
In my case, brew upgrade node resolve the problem :)
Well I got this error trying to install #angular/cli, realized node might be out of date. Following #mircealungu 's exact steps didn't quite work for me, here is the modified version that worked for me.
brew uninstall --ignore-dependencies --force node
brew uninstall --ignore-dependencies --force icu4c
brew install icu4c
brew unlink icu4c && brew link icu4c --force
brew install node
Upgrading node fixed a problem.
brew upgrade node
I recently encountered a similar issue (after doing
brew switch node 9.8.0 to downgrade to a previous version of node)
dyld: Library not loaded:
/usr/local/opt/icu4c/lib/libicui18n.60.dylib
Referenced from: /usr/local/bin/node
Reason: image not found
Abort trap: 6
The issue is that node is picky about which version of icu4c it's looking for, and the version I had installed (62) was higher than node was expecting.
To fix, I made sure I had version 60 of icu4c selected.
First I found which versions I had with brew info icu4c, then did
brew switch icu4c 60.2 to select the one node was expecting.
For me it was apparently a problem with the icu4c installation from brew.
brew reinstall icu4c
will reinstall icu4c.
if you don't have it installed,
brew install icu4c
Seems file /usr/local/opt/icu4c/lib/libicui18n.58.dylib does not exists in you system.
Please ensure that icu4c installed with Homebrew.
brew info icu4c
If already installed, try reinstall: brew reinstall icu4c
If not installed, try install: brew install icu4c
For high seirra, just "brew upgrade" makes magic!
First I uninstall node and icu4c, force to uninstall all versions
brew uninstall --force --ignore-dependencies node icu4c
After install version 8 of Node
brew install node#8
If it already install, please just upgrade
brew upgrade node#8
And enter
node -v
v8.11.1
This was triggered for me after a brew upgrade and brew update ran. I was able to fix it by simply re-installing the two items flagged as problems (which made sense to me):
brew reinstall node
brew reinstall icu4c
None of the above worked for me. I'm using High Sierra.
What fixed it for me was brew upgrade
I found a solution that works great over here. I'll briefly give the commands below.
First, cd into the homebrew formula directory:
cd $(brew --prefix)/Homebrew/Library/Taps/homebrew/homebrew-core/Formula
Git log:
git log --follow icu4c.rb
Choose the commit hash that matches the version you need. I needed version 61.1, thus chose the 6d9815 commit:
git checkout -b icu4c-61.1 6d9815
Reinstall:
brew reinstall ./icu4c.rb
Switch:
brew switch icu4c 61.1
That fixed it for me.
Credit: hanxue
Nothing worked for me but running this worked
brew link --overwrite node
brew uninstall --force node
brew uninstall --ignore-dependencies icu4c
brew unlink icu4c && brew link icu4c --force
brew install node
This error was given to me after migrating machines.
Even though everything was installed, when I went to check node -v or npm version, I'd get this error.
What fixed it was brew reinstall icu4c.
I had the same problem with my local php installation.
dyld: Library not loaded: /usr/local/opt/icu4c/lib/libicui18n.62.dylib
Referenced from: /usr/local/bin/php
Reason: image not found
Abort trap: 6
Solved the problem with this command. (check your version)
brew link --overwrite --force php#7.1
I removed export PATH="/usr/local/opt/icu4c/bin:$PATH" from my ~/.bash_profile file and it fixed my problem.
My error was:
dyld: Library not loaded: /usr/local/opt/icu4c/lib/libicui18n.63.dylib
Referenced from: /usr/local/opt/node#10/bin/node
Reason: image not found
Abort trap: 6
My /usr/local/opt/icu4c/lib contains libicui18n.64.dylib
I fixed by
cd /usr/local/Cellar
rm -rf node*/
rm -rf icu4c/
brew install node
it seems like your icu4u Reference path is not set properly
first check you might instal icu4c or not by putting below comment in comment promt
brew info icu4c
or else reinstall
brew reinstall icu4c
If you need to have this software first in your PATH run:
echo 'export PATH="/usr/local/opt/icu4c/bin:$PATH"' >> ~/.bash_profile
hope This might help !!!!!
It's as easy as a common software, just download installation package from official site:NodeJS
and then download a recommended version(currently 8.11.3, end with .pkg), install it as a common software, then u can use it. I tried so many methods, and only this works for me.
Try restarting your machine. That helped me.
i run this on macos:
git -C /usr/local/Homebrew/Library/Taps/homebrew/homebrew-core fetch --unshallow
it takes around 20 minu

Can't install Grunt on OSX 10.6.8

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.

Resources