node.js 在 Mac OS Sierra 上使用 brew 安装节点失败

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/43780207/
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

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-02 18:12:13  来源:igfitidea点击:

Installing node with brew fails on Mac OS Sierra

node.jshomebrew

提问by mircealungu

I'm trying to install node with homebrew on macOS Sierra. I run

我正在尝试在 macOS Sierra 上使用自制软件安装节点。我跑

 brew install node

After a seemingly successful install I get the following when trying to run node:

看似成功的安装后,我在尝试运行时得到以下信息node

dyld: Library not loaded: /usr/local/opt/icu4c/lib/libicui18n.58.dylib
  Referenced from: /usr/local/bin/node
  Reason: image not found
Abort trap: 6

回答by mircealungu

This is the series of incantations that eventually worked for me based on thislink suggested by @robertklep and @vovkasm.

这是一系列基于最终对我来说有效的咒语这个环节由@robertklep和@vovkasm建议。

brew uninstall --force node
brew uninstall icu4c && brew install icu4c
brew unlink icu4c && brew link icu4c --force
brew install node

I'm not sure if they're all needed, but given that I can't get my machine in the previous state... I'll just leave this info here, maybe it'll be useful for somebody else.

我不确定它们是否都需要,但鉴于我无法让我的机器处于以前的状态……我将这些信息留在这里,也许对其他人有用。

回答by ice6

In my case, brew upgrade noderesolve the problem :)

就我而言,brew upgrade node解决问题:)

回答by ishandutta2007

Well I got this error trying to install @angular/cli, realized node might be out of date. Following @mircealungu 's exact steps didn't quite work for me, here is the modified version that worked for me.

好吧,我在尝试安装时遇到此错误@angular/cli,意识到节点可能已过时。遵循@mircealungu 的确切步骤对我来说不太适用,这是对我有用的修改版本。

brew uninstall --ignore-dependencies --force node
brew uninstall --ignore-dependencies --force icu4c
brew install icu4c
brew unlink icu4c && brew link icu4c --force
brew install node

回答by mkkrolik

Upgrading node fixed a problem.

升级节点修复了一个问题。

brew upgrade node 

回答by amcvitty

I recently encountered a similar issue (after doing brew switch node 9.8.0to downgrade to a previous version of node)

我最近遇到了类似的问题(在 brew switch node 9.8.0降级到以前版本的节点之后)

dyld: Library not loaded: 
/usr/local/opt/icu4c/lib/libicui18n.60.dylib
  Referenced from: /usr/local/bin/node
  Reason: image not found
Abort trap: 6

The issue is that node is picky about which version of icu4c it's looking for, and the version I had installed (62) was higher than node was expecting.

问题是 node 对它正在寻找的 icu4c 版本很挑剔,而且我安装的版本 (62) 比 node 预期的要高。

To fix, I made sure I had version 60 of icu4c selected.

为了修复,我确保我选择了 icu4c 的 60 版。

First I found which versions I had with brew info icu4c, then did brew switch icu4c 60.2to select the one node was expecting.

首先,我找到了我使用的版本brew info icu4c,然后 brew switch icu4c 60.2选择了期望的一个节点。

回答by Basavaraj Hadimani

For high seirra, just "brew upgrade" makes magic!

对于high seirra,只需“brew upgrade”就可以变魔术!

回答by Basavaraj Hadimani

Seems file /usr/local/opt/icu4c/lib/libicui18n.58.dylibdoes not exists in you system.

/usr/local/opt/icu4c/lib/libicui18n.58.dylib您的系统中似乎不存在文件。

Please ensure that icu4cinstalled with Homebrew.

请确保icu4c与 Homebrew 一起安装。

  1. brew info icu4c
  2. If already installed, try reinstall: brew reinstall icu4c
  3. If not installed, try install: brew install icu4c
  1. brew info icu4c
  2. 如果已经安装,请尝试重新安装: brew reinstall icu4c
  3. 如果没有安装,请尝试安装: brew install icu4c

回答by Renan Bronchart

First I uninstall node and icu4c, force to uninstall all versions

首先卸载node和icu4c,强制卸载所有版本

brew uninstall --force --ignore-dependencies node icu4c

After install version 8 of Node

安装 Node 8 版本后

brew install node@8

If it already install, please just upgrade

如果已经安装,请升级

brew upgrade node@8

And enter

并输入

node -v

v8.11.1

v8.11.1

回答by Kevin Leary

This was triggered for me after a brew upgradeand brew updateran. I was able to fix it by simply re-installing the two items flagged as problems (which made sense to me):

这是在 abrew upgradebrew updaterun之后为我触发的。我能够通过简单地重新安装标记为问题的两个项目来修复它(这对我来说很有意义):

brew reinstall node
brew reinstall icu4c

回答by markashworth

None of the above worked for me. I'm using High Sierra.

以上都不适合我。我正在使用高塞拉。

What fixed it for me was brew upgrade

为我修复的是 brew upgrade