【问题标题】:Update Node.js: Error while updating Node.js on Mac更新 Node.js:在 Mac 上更新 Node.js 时出错
【发布时间】:2017-04-26 05:43:58
【问题描述】:

我正在使用 mac。我目前已经安装了 Node.js 4.4.3

Aleeshas-MacBook-Air:~ aleesha$ node -v
v4.4.3

我想按照这些steps 将 Node.js 更新到最新版本。

首先我尝试执行:brew update。但是,当我执行命令时出现以下错误:

brew update 错误:/usr/local 不可写。你应该改变 /usr/local 的所有权和权限还给您的用户帐户: sudo chown -R $(whoami) /usr/local

所以在谷歌上搜索解决方案后,我运行了这个命令:sudo chown -R $(whoami) /usr/local

之后我再次执行了brew update 命令。我认为它已成功执行,因为我没有看到任何错误消息。命令提示符的最后几行是:

==> 正在迁移 HOMEBREW_REPOSITORY(请稍候)... ==> 将 HOMEBREW_REPOSITORY 迁移到 /usr/local/Homebrew! Homebrew 不再需要拥有 /usr/local 的所有权。

如果你愿意 使用以下命令将 /usr/local 恢复为其默认所有权:sudo chown root:wheel /usr/local Aleeshas-MacBook-Air:~ aleesha$

但是在我执行升级命令的这一步之后,它失败了。

Aleeshas-MacBook-Air:~ aleesha$ brew upgrade node
Error: node not installed
Aleeshas-MacBook-Air:~ aleesha$

我不确定这里到底需要做什么。

谢谢

编辑:执行brew doctor 以检查系统异常。

Aleeshas-MacBook-Air:~ aleesha$ 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: "config" scripts exist outside your system or Homebrew directories.
`./configure` scripts often look for *-config scripts to determine if
software packages are installed, and what additional flags to use when
compiling and linking.

Having additional scripts in your path can confuse software installed via
Homebrew if the config script overrides a system or Homebrew provided
script of the same name. We found the following "config" scripts:
  /Library/Frameworks/Python.framework/Versions/3.5/bin/python3-config
  /Library/Frameworks/Python.framework/Versions/3.5/bin/python3.5-config
  /Library/Frameworks/Python.framework/Versions/3.5/bin/python3.5m-config

Warning: No developer tools installed.
Install the Command Line Tools:
  xcode-select --install


Warning: Python is installed at /Library/Frameworks/Python.framework

Homebrew only supports building against the System-provided Python or a
brewed Python. In particular, Pythons installed to /Library can interfere
with other software installs.

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/android-ifaddrs.h
  /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

【问题讨论】:

  • 它说你没有安装节点。你有没有安装节点?
  • 是,版本:v4.4.3

标签: node.js homebrew


【解决方案1】:

看来您没有通过 brew 安装 nodejs。如果您在没有 brew 的情况下安装了 Node,则 brew 无法识别它。在我意识到我使用 Node Version Manager 安装 Node 之前,我遇到了同样的问题。确保您使用 Brew 安装它。

brew list

将向您展示 brew 安装的内容。

【讨论】:

  • 谢谢,你说得对。感谢您的帮助。
【解决方案2】:

您没有使用 Homebrew 安装 Node,请使用 this gist 卸载当前安装的 Node。

然后:

brew update && brew install node

【讨论】:

  • 谢谢我必须卸载然后重新安装节点到最新版本
  • 我也一样;我的procdeure
猜你喜欢
  • 2013-07-10
  • 1970-01-01
  • 2021-10-14
  • 2018-03-19
  • 1970-01-01
  • 1970-01-01
  • 2021-12-20
  • 1970-01-01
  • 2022-10-19
相关资源
最近更新 更多