I'm very new to this. Back in January 2018 when I installed Homebrew and Nodejs, commands were found. I uninstalled and reinstalled both yesterday along with a mac OSX update. Now neither brew nor node commands are found.
user$ node
-bash: node: command not found
user$ brew doctor
-bash: brew: command not found
I've checked through Finder that they are both installed.
Thanks in advance to anyone who can help.
Related
Not sure if related, but over the weekend I upgraded my OS to Big Sur version 11.1 and then when I began working one thing went wrong after another and now I can't use node or npm at all. I get the following message in zsh:
% node -v
zsh: killed node -v
And the following on bash
node -v
Killed: 9
I've tried to install different versions of node through n, which makes no difference.
How it got this way?
Prior to this issue (after my OS upgrade), I couldn't run npm install, and would get the following message:
Maximum call stack size exceeded
This seems to have been reported on this thread, but as of writing this there are no replies.
As the OP on that thread says, I tried installing npm v7, which initially did solve my problem with the npm install, however caused other issues on the project.
I then decided to use n to install the latest version of node and this caused the errors I have above.
Does anyone know what's going on and how to fix it?
Edit: I was forced to uninstall and reinstall node to be able to go back to work, which did solve it but I am leaving this thread up in case there is a better solution.
TLDR:
brew uninstall git
brew update
brew reinstall pcre2 gettext
brew install git
brew reinstall node
I'm sure there's a more surgical solution (e.g., maybe you don't need brew reinstall pcre2 gettext), but this ^^ worked for me. Below is the path I took:
Skimming some google results, seemed it was at least partly due to the new M1 silicon and the minor MacOS update to 11.2.2. Tried to brew update and got:
Error: Failure while executing; `git config --replace-all homebrew.analyticsmessage true` was terminated by uncaught signal KILL.
Which led me to this: https://github.com/Homebrew/brew/issues/10275#issuecomment-757351887. After doing these uninstall, reinstall, installs, I finished with a brew reinstall node and voilà! Didn't need to uninstall node and install from scratch:
an#As-Air ~ % node -v
v15.11.0
TL;DR
The solution is to reinstall node and all its dependencies. Luckily, Homebrew offers a one-liner all-in-one solution:
brew reinstall $(brew deps node) node
Why?
I had followed #albielin and #Mariusz' solutions without success. I didn't yet want the #bgh's nuclear option to reinstall Homebrew with all its packages.
It seems in my case, the issue wasn't coming from those specific dependencies (pcre2 gettext openssl icu4c), but rather another one. No need to worry about git. But do reinstall all dependencies to be sure and avoid an endless trial-and-error with every one of them.
Had the same issue. Tried #albielin approach but it still didn't work for me. Ive took a look in the console and saw issues with openssl and icu4c when executing node --version and reinstalled both. Now it works.
So in addition to #albielin commands I did:
brew reinstall openssl
brew reinstall icu4c
I had the same issue. The answers above didn't work for me. Looking at the console while running node --version I found the error load code signature error 2 for file "node"
Reinstalling Homebrew as detailed in this Stack Overflow answer did it for me:
Run the official uninstall script: /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/uninstall.sh)"
Clean up: sudo rm -rf /opt/homebrew
Fresh install: /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
Install node: brew install node
The node post-install process ran into a few issues due to symlinks that could not be overwritten. The advice given in this article helped me resolve this; a few sudo chown ... and brew link --overwrite node commands later node was successfully installed!
For my case, i only get the error when opening accessing terminal (zsh) via VS Code.
Upon opening VS Code terminal OR running node command, i get this error:
dyld: Library not loaded: /usr/local/opt/icu4c/lib/libicui18n.63.dylib
Referenced from: /usr/local/bin/node
Reason: image not found
[1] 4506 abort node
However, it runs fine when running via iTerm. Tried running brew update and brew upgrade and a few other recommended answers.
Anything am i missing?
Piggybacking off Jason's answer, another option is to just run
brew upgrade node
Found the answer here
Run this
brew uninstall node icu4c
brew install node
You might follow these steps.
> which node
/usr/local/bin/node
> rm /usr/local/bin/node
> brew unlink node
> brew link --overwrite node
This should solve the problem.
A brew reinstall icu4c fixed the problem on macOS 10.15.6.
It also helps to watch your logs when starting a broken package (node, pg, etc. – for pg it's tail -f /usr/local/var/log/postgresql#11.log – not the server log).
I had to reinstall VSCode using the apple silicon download link here. If I installed the from the command line it kept using the old /usr/bin folders instead of the new M1 brew folder /opt/homebrew
I'm a newbie and I stupidly uninstalled my version 5.6.0 npm without unistalling my nodejs (version 8.9.4). And when I tried to reinstall the npm, it appears "bash: /usr/bin/npm: No such file or directory". I'm using Ubuntu 16.04
Any suggestion will be helpful.
Thank you.
Try
sudo apt-get install nodejs
which might reinstall npm.
or download and run this script
https://www.npmjs.com/install.sh
or grab it from github
https://github.com/npm/npm
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!!
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.