Reputation: 7470
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.
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.
Upvotes: 7
Views: 7945
Reputation: 43
I was getting this error while running command npm run dev
.
But when I tried with command npm start
, then it started working and I was able to open documentation.
Upvotes: 0
Reputation: 2326
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
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.
Upvotes: 1
Reputation: 2160
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:
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/uninstall.sh)"
sudo rm -rf /opt/homebrew
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
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!
Upvotes: 0
Reputation: 517
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
Upvotes: 0
Reputation: 590
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
Upvotes: 1