Node installed, but not NPM - node.js

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!!

Related

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

node-0.12.7_1 already installed, it's just not linked

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.

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.

Uninstalling / Removing npm and node package on Mac

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.

Node.js not linked error

I've literally searched everything on web. But I could not find the solution for the error node-0.8.8 already installed, it's just not linked. Is it related to a path file issue?
Execute this list of commands in this particular order:
sudo brew uninstall node
brew update
brew upgrade
brew cleanup
brew install node
sudo chown -R $(whoami) $(brew --prefix)
brew link --overwrite node
brew postinstall node
After you've run brew upgrade to update node to the latest version, run brew doctor to see what potential problems there are. It might tell you that node is unlinked, in which case, running brew link node will link it. (You might need to first run brew unlink node)
I got the same error today and it told me that Node was not properly linked and there were unexpected header files as well.
When I tried to reinstall node, It told me that it was already installed, just not linked.
Warning: /usr/local/include isn't writable
/usr/local/bin/node already exists. Remove it
Solution
To fix this, I took ownership of it by using:
sudo chown -R `whoami` /usr/local/
Then I force linked all files by using:
brew link --overwrite node
After that I did the post install routine with:
brew postinstall node
Then I checked if node was properly installed with:
node -v
I received output v5.1.0 and It was fixed :). Hope this helps.
This may not be the perfect fix out there since I have started dabbling with node and homebrew just 10 minutes ago but it did the job for me.
Your old version of Node 0.5 was probably not installed with Homebrew (or Homebrew's script changed in the large gap between the 0.5 beta releases to the 0.8 stable releases (the 0.6 and 0.7 releases in-between).
Both Homebrew and the official Node installer try to install to /usr/local/bin so I'd recommend starting by simply deleting /usr/local/bin/node, /usr/local/bin/npm, and /usr/local/lib/node and try again.
hardcorepunk's answer worked. However, we can no longer chown /usr/local in High Sierra. So, execute the commands in this order:
sudo brew uninstall node
brew update
brew upgrade
brew cleanup
brew install node
sudo chown -R $(whoami) $(brew --prefix)/*
brew link --overwrite node
brew postinstall node
To link the node, run following command:
brew link homebrew/versions/node<version no>
And to check whether it is properly installed or not, run:
node -v
If node will get properly linked, it will not through any error, and will print node version. You can read nice explanation about it from here.
For line did the job:
brew link --overwrite node
It forces the link and overwrite all conflicting files:
You can change the permission of the file "/usr/local/bin/node", like "chmod +w /usr/local/bin/node", to make it writable.

Resources