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
Related
nicolasrulli#Nicolas-Rullis-MacBook-Pro / % brew install node
Running `brew update --preinstall`...
==> Auto-updated Homebrew!
Updated 1 tap (homebrew/core).
==> Updated Formulae
Updated 55 formulae.
==> Downloading https://ghcr.io/v2/homebrew/core/node/manifests/18.2.0
Already downloaded: /Users/nicolasrulli/Library/Caches/Homebrew/downloads/d3348030d8404d01cc32c085f75250b04ad35d8c17b9c7e5cbb2d1bc3617e697--node-18.2.0.bottle_manifest.json
==> Downloading https://ghcr.io/v2/homebrew/core/node/blobs/sha256:bc6d55e53035991aaa6d1917f396d2f0cd9e0281e80d1ba79e99211c5e82a
Already downloaded: /Users/nicolasrulli/Library/Caches/Homebrew/downloads/5daf56787ecaf72b3065acd64fff548c38ec43c7572d18b603bc33da86aa53a2--node--18.2.0.monterey.bottle.tar.gz
==> Pouring node--18.2.0.monterey.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/doc/node/gdbinit
/usr/local/share/doc/node is not writable.
You can try again using:
brew link node
Warning: The post-install step did not complete successfully
You can try again using:
brew postinstall node
==> Summary
🍺 /usr/local/Cellar/node/18.2.0: 1,930 files, 49.2MB
==> Running `brew cleanup node`...
Disable this behaviour by setting HOMEBREW_NO_INSTALL_CLEANUP.
Hide these hints with HOMEBREW_NO_ENV_HINTS (see `man brew`).
nicolasrulli#Nicolas-Rullis-MacBook-Pro / % brew link node
Linking /usr/local/Cellar/node/18.2.0...
Error: Could not symlink share/doc/node/gdbinit
/usr/local/share/doc/node is not writable.
nicolasrulli#Nicolas-Rullis-MacBook-Pro / % brew postinstall node
==> Postinstalling node
Warning: The post-install step did not complete successfully
You can try again using:
brew postinstall node
nicolasrulli#Nicolas-Rullis-MacBook-Pro / %
I ran brew uninstall --force node and that 'worked'. I then ran brew cleanup and it worked also. Next was brew install node. This started to run but then gave errors saying the link command couldn't run. Any advice?
Node.js uninstall command this
brew uninstall --force node
Node.js install
Then you can download the version you want by entering https://nodejs.dev/download. The advice I can give you is to install nvm. In this way, you can use more versions.
I hope it works for you :)
So, brew isn't really working for me, it keeps giving me these errors. When I tried to re-install it, it gave me this:
virtu0us:~ lik20$ brew install node
Updating Homebrew...
Warning: node 14.5.0 is already installed, it's just not linked
You can use `brew link node` to link this version.
So when I tried to do that,
virtu0us:~ lik20$ brew install node
Updating Homebrew...
Warning: node 14.5.0 is already installed, it's just not linked
You can use `brew link node` to link this version.
virtu0us:~ lik20$ brew link node
Linking /usr/local/Cellar/node/14.5.0...
Error: Could not symlink include/node/common.gypi
Target /usr/local/include/node/common.gypi
already exists. You may want to remove it:
rm '/usr/local/include/node/common.gypi'
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
So I did this:
virtu0us:~ lik20$ brew link node
Linking /usr/local/Cellar/node/14.5.0...
Error: Could not symlink include/node/common.gypi
Target /usr/local/include/node/common.gypi
already exists. You may want to remove it:
rm '/usr/local/include/node/common.gypi'
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
virtu0us:~ lik20$ brew link --overwrite node
Linking /usr/local/Cellar/node/14.5.0...
Error: Could not symlink include/node/common.gypi
/usr/local/include/node is not writable.
Is there a way I can fix this?
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 met an error while doing "brew cleanup":
$ brew cleanup
Warning: Skipping opam: most recent version 2.0.3 not installed
Warning: Skipping python: most recent version 3.7.2_2 not installed
Warning: Skipping sqlite: most recent version 3.27.1 not installed
Error: Permission denied # unlink_internal - /usr/local/lib/node_modules/#angular/cli/node_modules/.bin/in-install
Does anyone know how to fix this?
PS: brew link node returns an error, though I don't know if it is related.
$ brew install node
Warning: node 11.9.0 is already installed, it's just not linked
You can use `brew link node` to link this version.
$ brew link node
Linking /usr/local/Cellar/node/11.9.0...
Error: Could not symlink include/node/common.gypi
Target /usr/local/include/node/common.gypi
already exists. You may want to remove it:
rm '/usr/local/include/node/common.gypi'
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
First fix permissions causing the error:
sudo chown -R "$(whoami)":admin /usr/local
On macOS Mojave, the chown command needs to be run on the specific directory, an example for the permissions issue in /usr/local/lib directory, this command would be
sudo chown -R "$(whoami)":admin /usr/local/lib
Then relink node with the --force option as directed:
brew link --overwrite node
This worked for me:
brew unlink node && brew link node
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'.