Is it ok to link node#6 by force?
$ which node
$ echo $?
1
$ brew link node
Error: No such keg: /usr/local/Cellar/node
$ brew search node
leafnode llnode node node-build node#0.10 node#0.12 node#4 node#5 node#6 ✔ nodebrew nodeenv nodenv
Caskroom/cask/mindnode-pro Caskroom/cask/node-profiler Caskroom/cask/nodebox Caskroom/cask/nodeclipse Caskroom/cask/printnode Caskroom/cask/soundnode
$ brew link node#6
Warning: node#6 is keg-only and must be linked with --force
Note that doing so can interfere with building software.
Edit:
I went ahead and did it:
$ brew link node#6 --force
Linking /usr/local/Cellar/node#6/6.9.5... 7 symlinks created
node and npm work fine now.
Scary warning.
I ran in to the same problem and followed the advice of brew info node#6 and added export PATH="/usr/local/opt/node#6/bin:$PATH to my .bash_profile. All the command line tools worked as expected.
(I've actually removed that line for my .bash_profile now and added an alias to set the path manually when I need it.)
You may (I have) run into some Cellar issues..
What is the output you got from brew doctor?
I had this when executing brew doctor:
Warning: Some keg-only formula are linked into the Cellar.
Linking a keg-only formula, such as gettext, into the cellar with
brew link <formula> will cause other formulae to detect them during
the ./configure step. This may cause problems when compiling those
other formulae.
I had to execute brew unlink node#6 for it to return 'your system is ready to brew'.
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!
I've been trying to debug why is this happening and how can I fix it so that i can work!
The problem looks like this:
➜ ~ node
[1] 2912 killed node
It happens with yarn and npm so i assumed its node. I cant find any node mention in /var/log/system.log.
I tried reinstalling node via brew but error persists. I reinstalled yarn as well.
What else can I do find out why this is hapening? Where is this being logged to?
BTW: I'm not running out of memory, i have available ram and hard disk space
I opened the "Console" utility app and found this error when i try to start nodejs:
proc 4298: load code signature error 2 for file "node"
Thanks
I had exactly the same issue on new Macos Big Sur and I fixed this problem by following those steps, I hope it will save someone's time:
This is what I was getting
➜ ~ node
[1] 12187 killed node
In the Console I found that error message pointed to icu4c
CODE SIGNING: process 11193[node]: rejecting invalid page at address 0x1047f4000 from offset 0x0 in file "/opt/homebrew/Cellar/icu4c/67.1/lib/libicui18n.67.1.dylib" (cs_mtime:1614412395.998493416 == mtime:1614412395.998493416) (signed:1 validated:1 tainted:1 nx:0 wpmapped:0 dirty:0 depth:0)
so I uninstalled the node and icu4c packages (if you have yarn, you may also want to uninstall it)
➜ ~ brew uninstall node
Uninstalling /opt/homebrew/Cellar/node/15.10.0... (3,390 files, 54.9MB)
➜ ~ brew uninstall icu4c
Uninstalling /opt/homebrew/Cellar/icu4c/67.1... (258 files, 72.4MB)
then I ran one additional command, just to remove anything that's not needed.
brew cleanup
after that I ran brew install node and it started working!
Here's a log from my terminal:
➜ ~ brew install node
==> Downloading https://homebrew.bintray.com/bottles/icu4c-67.1.arm64_big_sur.bo
Already downloaded: /Users/pgoca/Library/Caches/Homebrew/downloads/0ead47d11680c7b6ed4d76eb2a934878314e34e9ac979b5306b6fb7a1ac3f8ae--icu4c-67.1.arm64_big_sur.bottle.tar.gz
==> Downloading https://homebrew.bintray.com/bottles/node-15.10.0.arm64_big_sur.
Already downloaded: /Users/pgoca/Library/Caches/Homebrew/downloads/5e38af944729bd333a4217bf8327099595ebec3a5e7c5eb1029399555828e39b--node-15.10.0.arm64_big_sur.bottle.tar.gz
==> Installing dependencies for node: icu4c
==> Installing node dependency: icu4c
==> Pouring icu4c-67.1.arm64_big_sur.bottle.tar.gz
==> Caveats
icu4c is keg-only, which means it was not symlinked into /opt/homebrew,
because macOS provides libicucore.dylib (but nothing else).
If you need to have icu4c first in your PATH, run:
echo 'export PATH="/opt/homebrew/opt/icu4c/bin:$PATH"' >> ~/.zshrc
echo 'export PATH="/opt/homebrew/opt/icu4c/sbin:$PATH"' >> ~/.zshrc
For compilers to find icu4c you may need to set:
export LDFLAGS="-L/opt/homebrew/opt/icu4c/lib"
export CPPFLAGS="-I/opt/homebrew/opt/icu4c/include"
==> Summary
🍺 /opt/homebrew/Cellar/icu4c/67.1: 258 files, 72.4MB
==> Installing node
==> Pouring node-15.10.0.arm64_big_sur.bottle.tar.gz
🍺 /opt/homebrew/Cellar/node/15.10.0: 3,390 files, 54.9MB
==> Caveats
==> icu4c
icu4c is keg-only, which means it was not symlinked into /opt/homebrew,
because macOS provides libicucore.dylib (but nothing else).
If you need to have icu4c first in your PATH, run:
echo 'export PATH="/opt/homebrew/opt/icu4c/bin:$PATH"' >> ~/.zshrc
echo 'export PATH="/opt/homebrew/opt/icu4c/sbin:$PATH"' >> ~/.zshrc
For compilers to find icu4c you may need to set:
export LDFLAGS="-L/opt/homebrew/opt/icu4c/lib"
export CPPFLAGS="-I/opt/homebrew/opt/icu4c/include"
➜ ~ node
Welcome to Node.js v15.10.0.
Type ".help" for more information.
>
FIXED
I fixed by completely removing node and reinstalling via nvm
I am on the M1 Mac Mini. The solution for me was to reinstall Homebrew. Steps:
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)"
brew install node
I have been trying to install node.js on my Mac to use React Native. I tried many different times to install and reinstall node but I'd get a lot of errors.
I have tried installing on a fresh hard drive and I still can't seem to get it to work.
What I would try:
bash-3.2$ brew install node
==> Downloading https://homebrew.bintray.com/bottles/node-12.8.0.mojave.bottle.t
Already downloaded: /Users/malqadi/Library/Caches/Homebrew/downloads/8ea6192c6101b64b58b3ff8bf0cab0b89eb67851ec11f5c95edda2fffcbdbfb0--node-12.8.0.mojave.bottle.tar.gz
==> Pouring node-12.8.0.mojave.bottle.tar.gz
Error: The `brew link` step did not complete successfully
The formula built, but is not symlinked into /usr/local
Could not symlink share/systemtap/tapset/node.stp
Target /usr/local/share/systemtap/tapset/node.stp
already exists. You may want to remove it:
rm '/usr/local/share/systemtap/tapset/node.stp'
To force the link and overwrite all conflicting files:
brew link --overwrite node
To list all files that would be deleted:
brew link --overwrite --dry-run node
Possible conflicting files are:
/usr/local/share/systemtap/tapset/node.stp
/usr/local/lib/dtrace/node.d
Warning: The post-install step did not complete successfully
You can try again using `brew postinstall node`
==> Caveats
Bash completion has been installed to:
/usr/local/etc/bash_completion.d
==> Summary
🍺 /usr/local/Cellar/node/12.8.0: 4,629 files, 53.1MB
I do what it recommends, but its the same:
bash-3.2$ brew postinstall node
==> Postinstalling node
Warning: The post-install step did not complete successfully
You can try again using `brew postinstall node`
So I try brew doctor:
bash-3.2$ brew doctor
Please note that these warnings are just used to help the Homebrew maintainers
with debugging if you file an issue. If everything you use Homebrew for is
working fine: please don't worry or file an issue; just ignore this. Thanks!
Warning: You have unlinked kegs in your Cellar.
Leaving kegs unlinked can lead to build-trouble and cause brews that depend on
those kegs to fail to run properly once built. Run `brew link` on these:
node
How would I get this to work?
Try removing the npm module with this command:
rm '/usr/local/share/systemtap/tapset/node.stp'
before linking node with this command:
brew link node
I'm attempting to get the LTS version of node installed on my machine via homebrew but I seem to be having some issues. If I run brew install node#6 to get the latest LTS version (6.10.3), everything seems to complete with no issues. Then, if I run brew list, I will see node#6 has indeed installed. BUT, if I check which version of node is installed using node -v, I receive zsh: command not found: node. I'm pretty new to homebrew and the command line in general. Where have I gone wrong?
Any help would be greatly appreciated, and I can provide more info if requested. Thanks!
For those curious, I ended up just using brew install node to install the most current version of node. Trying to install node#6 was troublesome, but it seems my struggle was pertaining to an issue where homebrew required node#6 to be linked using brew link node#6 --force. More info can be found here:
https://github.com/Homebrew/brew/issues/2220
Note that I did not try this solution.
As indicated in the GitHub issue linked above, if you run brew info node#10 (replace node#10 with your version) it provides a line to add the non-latest node version to your path:
If you need to have node#10 first in your PATH run:
echo 'export PATH="/usr/local/opt/node#10/bin:$PATH"' >> ~/.zshrc
Running echo 'export PATH="/usr/local/opt/node#10/bin:$PATH"' >> ~/.zshrc adds a line to the bottom of my .zshrc file:
export PATH="/usr/local/opt/node#10/bin:$PATH"
If you're using Bash, it'd be your .bashrc file. I'm guessing Homebrew picks up on that, but worth double checking.
This line will add /usr/local/opt/node#10/bin to my PATH when I start my terminal. I need to restart my terminal to get immediate access. Or I can re-source the .zshrc file. I only have to do this the first time:
source ~/.zshrc
Now node works. I can verify by checking the version:
node -v
# v10.17.0
Could you check if /usr/local/bin is in your $PATH? Also, maybe run brew doctor?
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).