node.js 无法酿造安装节点
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/31691626/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
can't brew install node
提问by Francis
I am trying to upgrade my node via homebrew but ran into a problem because I think I tried to download through the website. I am very new to terminal. I've tried to search for answers but many people say you can just delete the unbrewed header files. I am not sure how to do that. but for some reason when I try to brew install node, it says the brew link step did not complete successfully.
我正在尝试通过自制软件升级我的节点,但遇到了问题,因为我想我试图通过网站下载。我对终端很陌生。我试图寻找答案,但很多人说你可以删除未生成的头文件。我不知道该怎么做。但是由于某种原因,当我尝试 brew install node 时,它说 brew link 步骤没有成功完成。
I also tried to brew link node but that doesn't work either. I ran out of options so I came here.
我也尝试 brew link node 但这也不起作用。我没有选择,所以我来到了这里。
[SICNARF@WOPR ~]$ brew install node
==> Downloading https://homebrew.bintray.com/bottles/node-0.12.7.yosemite.bottle.tar.gz
Already downloaded: /Library/Caches/Homebrew/node-0.12.7.yosemite.bottle.tar.gz
==> Pouring node-0.12.7.yosemite.bottle.tar.gz
==> Caveats
Bash completion has been installed to:
/usr/local/etc/bash_completion.d
Error: The `brew link` step did not complete successfully
The formula built, but is not symlinked into /usr/local
Could not symlink include/node/android-ifaddrs.h
/usr/local/include/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/0.12.7: 2726 files, 31M
this is what happens when i brew doctor
这就是我酿造医生时发生的事情
[SICNARF@WOPR ~]$ 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 and just ignore them. Thanks!
Warning: Unbrewed header files were found in /usr/local/include.
If you didn't put them there on purpose they could cause problems when
building Homebrew formulae, and may need to be deleted.
Unexpected header files:
/usr/local/include/node/ares.h
/usr/local/include/node/ares_version.h
/usr/local/include/node/libplatform/libplatform.h
/usr/local/include/node/nameser.h
/usr/local/include/node/node.h
/usr/local/include/node/node_buffer.h
/usr/local/include/node/node_internals.h
/usr/local/include/node/node_object_wrap.h
/usr/local/include/node/node_version.h
/usr/local/include/node/openssl/aes.h
/usr/local/include/node/openssl/asn1.h
/usr/local/include/node/openssl/asn1_mac.h
/usr/local/include/node/openssl/asn1t.h
/usr/local/include/node/openssl/bio.h
/usr/local/include/node/openssl/blowfish.h
/usr/local/include/node/openssl/bn.h
/usr/local/include/node/openssl/buffer.h
/usr/local/include/node/openssl/camellia.h
/usr/local/include/node/openssl/cast.h
/usr/local/include/node/openssl/cmac.h
/usr/local/include/node/openssl/cms.h
/usr/local/include/node/openssl/comp.h
/usr/local/include/node/openssl/conf.h
/usr/local/include/node/openssl/conf_api.h
/usr/local/include/node/openssl/crypto.h
/usr/local/include/node/openssl/des.h
/usr/local/include/node/openssl/des_old.h
/usr/local/include/node/openssl/dh.h
/usr/local/include/node/openssl/dsa.h
/usr/local/include/node/openssl/dso.h
/usr/local/include/node/openssl/dtls1.h
/usr/local/include/node/openssl/e_os2.h
/usr/local/include/node/openssl/ebcdic.h
/usr/local/include/node/openssl/ec.h
/usr/local/include/node/openssl/ecdh.h
/usr/local/include/node/openssl/ecdsa.h
/usr/local/include/node/openssl/engine.h
/usr/local/include/node/openssl/err.h
/usr/local/include/node/openssl/evp.h
/usr/local/include/node/openssl/hmac.h
/usr/local/include/node/openssl/idea.h
/usr/local/include/node/openssl/krb5_asn.h
/usr/local/include/node/openssl/kssl.h
/usr/local/include/node/openssl/lhash.h
/usr/local/include/node/openssl/md4.h
/usr/local/include/node/openssl/md5.h
/usr/local/include/node/openssl/mdc2.h
/usr/local/include/node/openssl/modes.h
/usr/local/include/node/openssl/obj_mac.h
/usr/local/include/node/openssl/objects.h
/usr/local/include/node/openssl/ocsp.h
/usr/local/include/node/openssl/opensslconf.h
/usr/local/include/node/openssl/opensslv.h
/usr/local/include/node/openssl/ossl_typ.h
/usr/local/include/node/openssl/pem.h
/usr/local/include/node/openssl/pem2.h
/usr/local/include/node/openssl/pkcs12.h
/usr/local/include/node/openssl/pkcs7.h
/usr/local/include/node/openssl/pqueue.h
/usr/local/include/node/openssl/rand.h
/usr/local/include/node/openssl/rc2.h
/usr/local/include/node/openssl/rc4.h
/usr/local/include/node/openssl/ripemd.h
/usr/local/include/node/openssl/rsa.h
/usr/local/include/node/openssl/safestack.h
/usr/local/include/node/openssl/seed.h
/usr/local/include/node/openssl/sha.h
/usr/local/include/node/openssl/srp.h
/usr/local/include/node/openssl/srtp.h
/usr/local/include/node/openssl/ssl.h
/usr/local/include/node/openssl/ssl2.h
/usr/local/include/node/openssl/ssl23.h
/usr/local/include/node/openssl/ssl3.h
/usr/local/include/node/openssl/stack.h
/usr/local/include/node/openssl/symhacks.h
/usr/local/include/node/openssl/tls1.h
/usr/local/include/node/openssl/ts.h
/usr/local/include/node/openssl/txt_db.h
/usr/local/include/node/openssl/ui.h
/usr/local/include/node/openssl/ui_compat.h
/usr/local/include/node/openssl/whrlpool.h
/usr/local/include/node/openssl/x509.h
/usr/local/include/node/openssl/x509_vfy.h
/usr/local/include/node/openssl/x509v3.h
/usr/local/include/node/pthread-fixes.h
/usr/local/include/node/smalloc.h
/usr/local/include/node/stdint-msvc2008.h
/usr/local/include/node/tree.h
/usr/local/include/node/uv-aix.h
/usr/local/include/node/uv-bsd.h
/usr/local/include/node/uv-darwin.h
/usr/local/include/node/uv-errno.h
/usr/local/include/node/uv-linux.h
/usr/local/include/node/uv-sunos.h
/usr/local/include/node/uv-threadpool.h
/usr/local/include/node/uv-unix.h
/usr/local/include/node/uv-version.h
/usr/local/include/node/uv-win.h
/usr/local/include/node/uv.h
/usr/local/include/node/v8-debug.h
/usr/local/include/node/v8-platform.h
/usr/local/include/node/v8-profiler.h
/usr/local/include/node/v8-testing.h
/usr/local/include/node/v8-util.h
/usr/local/include/node/v8.h
/usr/local/include/node/v8config.h
/usr/local/include/node/v8stdint.h
/usr/local/include/node/zconf.h
/usr/local/include/node/zlib.h
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
[SICNARF@WOPR ~]$ brew link
This command requires a keg argument
[SICNARF@WOPR ~]$ brew link node
Linking /usr/local/Cellar/node/0.12.7...
Error: Could not symlink include/node/android-ifaddrs.h
/usr/local/include/node is not writable.
回答by Sahil Chhabra
There are two steps involved.
有两个步骤。
- Simply run these four commands:
- 只需运行这四个命令:
sudo chown -R `whoami`:admin /usr/local/include/node
sudo chown -R `whoami`:admin /usr/local/bin
sudo chown -R `whoami`:admin /usr/local/share
sudo chown -R `whoami`:admin /usr/local/lib/dtrace
- Finally, run the overwrite command:
- 最后,运行覆盖命令:
brew link --overwrite node
回答by Brad
I ran into this same issue under the same circumstances. I was able to get the brew version to install successfully by:
我在同样的情况下遇到了同样的问题。我能够通过以下方式成功安装 brew 版本:
- Run
brew install node - Make note of the module that is causing the issue and delete it. In your case, this would be
/usr/local/include/node - Uninstall -
brew uninstall node - Re-install -
brew install node
- 跑
brew install node - 记下导致问题的模块并将其删除。在你的情况下,这将是
/usr/local/include/node - 卸载 -
brew uninstall node - 重新安装——
brew install node
I had to repeat this process a few times for each remaining problematic directory (about 3 different ones in actuality), and the install eventually succeeded without any issues.
对于每个剩余的有问题的目录(实际上大约有 3 个不同的目录),我不得不重复此过程几次,并且安装最终成功而没有任何问题。
回答by JimTri
I ran into this problem on a new MacBook Pro on Mac OS High Sierra. I gleaned brew was trying to use directories named include and lib under /usr/local that was not there. Since root owns /usr I had to do it manually - making sure that whoamiowner matches peer directories in /usr/local:
我在 Mac OS High Sierra 上的新 MacBook Pro 上遇到了这个问题。我收集到 brew 试图使用 /usr/local 下不存在的名为 include 和 lib 的目录。由于 root 拥有 /usr,我必须手动执行此操作 - 确保whoami所有者与 /usr/local 中的对等目录匹配:
sudo mkdir /usr/local/include
chown `whoami`:admin /usr/local/include
sudo mkdir /usr/local/lib
chown `whoami`:admin /usr/local/lib
And then to match the other directories in /usr/local I did:
然后为了匹配 /usr/local 中的其他目录,我做了:
chmod 775 /usr/local/include
chmod 775 /usr/local/lib
then the following worked:
然后以下工作:
brew uninstall node
brew install node
回答by Mullefa
You need to make /usr/local/binand /usr/local/sharewritable. I used thisanswer to achieve this. Below is the key advice in the answer replicated in case the link breaks:
你需要制作/usr/local/bin和/usr/local/share可写。我用这个答案来实现这一点。以下是链接断开时复制的答案中的关键建议:
sudo chown -R `whoami`:admin /usr/local/bin
sudo chown -R `whoami`:admin /usr/local/share
回答by Manjunath Bheemappa
I had the same error:
我有同样的错误:
Linking /usr/local/Cellar/node/11.10.0...
Error: Could not symlink include/node /usr/local/include is not writable.
Solution:
解决方案:
$ sudo mkdir /usr/local/include
$ sudo chown -R $(whoami) $(brew --prefix)/*
$ brew link node
Linking /usr/local/Cellar/node/11.10.0... 7 symlinks created
链接 /usr/local/Cellar/node/11.10.0 ... 创建了 7 个符号链接
$ node -v=> v11.10.0
$ node -v=> v11.10.0
$ npm -v=> 6.7.0
$ npm -v=> 6.7.0
回答by Ethan Parker
For those running high sierra on MacOS:
对于那些在 MacOS 上运行高山脉的人:
I tried giving permissions using the chowncommand and uninstalling then reinstalling node via homebrew but nothing worked.
我尝试使用该chown命令授予权限并通过自制软件卸载然后重新安装节点,但没有任何效果。
I just went to this site https://nodejs.org/en/download/and downloaded the 64 bit macOS .pkg and it worked perfectly. I tested it by just entering the command nodein terminal.
我刚刚访问了这个站点https://nodejs.org/en/download/并下载了 64 位 macOS .pkg,它运行良好。我只是通过node在终端中输入命令来测试它。
回答by Dave
I had a very similar problem with linking. I couldn't get it to work. I tried to chmod /usr/local/include/node so I could write the link to it but ran into another error. As a final solution, I just reinstalled node from https://nodejs.org/download/
我有一个非常相似的链接问题。我无法让它工作。我试图 chmod /usr/local/include/node 以便我可以写入指向它的链接,但遇到了另一个错误。作为最终解决方案,我刚刚从https://nodejs.org/download/重新安装了节点
I have a working node prompt again! I would love to go through brew to update but it saved me a lot of hassle just using the pkg installer from the site. I know this may not be the solution you are looking for but I just wanted to share my experience with the same issue. I hope it helps!
我再次有一个工作节点提示!我很想通过 brew 进行更新,但仅使用网站上的 pkg 安装程序就为我省去了很多麻烦。我知道这可能不是您正在寻找的解决方案,但我只是想分享我对同一问题的经验。我希望它有帮助!
回答by farinspace
brew postinstall nodeor brew link --overwrite nodedoesn't seem to help.
brew postinstall node或brew link --overwrite node似乎没有帮助。
After several rounds of brew uninstall nodeand brew install nodethe following were the offending directories and files:
几个回合之后brew uninstall node,并brew install node以下是有问题的目录和文件:
sudo rm -r /usr/local/include/node
sudo rm -r /usr/local/share/doc/node
sudo rm -r /usr/local/lib/node_modules
sudo rm /usr/local/lib/dtrace/node.d
sudo rm /usr/local/share/man/man1/node.1
sudo rm /usr/local/share/systemtap/tapset/node.stp
After the offending files are removed brewwill do all the proper linking with permissions for you.
删除有问题的文件后,brew将为您执行所有具有权限的正确链接。
Likely permissions were set as root:wheelbecause of a past install with sudoor perhaps manual installation, etc.
可能的权限是root:wheel由于过去安装sudo或手动安装等而设置的。
回答by Marlon Mingo
For me I had to run brew doctor which showed me that I did not have write access and had to run sudo chown -R $(whoami) /usr/local/bin /usr/local/share /usr/local/share/manto fix the issue.
对我来说,我必须运行 brew doctor ,这表明我没有写权限,必须运行sudo chown -R $(whoami) /usr/local/bin /usr/local/share /usr/local/share/man才能解决问题。
I suggest running brew doctorto see if it can provide some hints on the issue
我建议运行brew doctor看看它是否可以提供有关该问题的一些提示
回答by Adam Durey
brew link --overwrite node
Error: Could not symlink (...)
错误:无法符号链接 (...)
/usr/xxx
/usr/xxx
sudo chown -R 'whoami?':admin xxx
brew link --overwrite node
Rinse and repeat
冲洗并重复


