更新 Node.js:在 Mac 上更新 Node.js 时出错
Update Node.js: Error while updating Node.js on Mac
我正在使用 mac。我目前已经安装了 Node.js 4.4.3
Aleeshas-MacBook-Air:~ aleesha$ node -v
v4.4.3
我想按照这些 steps.
将 Node.js 更新到最新版本
首先我尝试执行:brew update
。但是,当我执行命令时出现以下错误:
brew update Error: /usr/local is not writable. You should change the
ownership and permissions of /usr/local back to your user account:
sudo chown -R $(whoami) /usr/local
所以在 Google 上搜索解决方案后,我 运行 这个命令:sudo chown -R $(whoami) /usr/local
之后我再次执行了brew update
命令。我认为它已成功执行,因为我没有看到任何错误消息。命令提示符的最后几行是:
==> Migrating HOMEBREW_REPOSITORY (please wait)...
==> Migrated HOMEBREW_REPOSITORY to /usr/local/Homebrew! Homebrew no longer needs to have ownership of /usr/local.
If you wish you can
return /usr/local to its default ownership with: 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
你好像没有通过brew安装nodejs。如果您在没有使用 brew 的情况下安装了 Node,则 brew 无法识别它。在我意识到我使用 Node Version Manager 安装 Node 之前,我遇到了同样的问题。确保使用 Brew 安装它。
brew list
将向您展示 brew 安装的内容。
您没有使用 Homebrew 安装 Node,请使用 this gist 卸载当前安装的 Node。
然后:
brew update && brew install node
我正在使用 mac。我目前已经安装了 Node.js 4.4.3
Aleeshas-MacBook-Air:~ aleesha$ node -v
v4.4.3
我想按照这些 steps.
将 Node.js 更新到最新版本首先我尝试执行:brew update
。但是,当我执行命令时出现以下错误:
brew update Error: /usr/local is not writable. You should change the ownership and permissions of /usr/local back to your user account: sudo chown -R $(whoami) /usr/local
所以在 Google 上搜索解决方案后,我 运行 这个命令:sudo chown -R $(whoami) /usr/local
之后我再次执行了brew update
命令。我认为它已成功执行,因为我没有看到任何错误消息。命令提示符的最后几行是:
==> Migrating HOMEBREW_REPOSITORY (please wait)... ==> Migrated HOMEBREW_REPOSITORY to /usr/local/Homebrew! Homebrew no longer needs to have ownership of /usr/local.
If you wish you can return /usr/local to its default ownership with: 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
你好像没有通过brew安装nodejs。如果您在没有使用 brew 的情况下安装了 Node,则 brew 无法识别它。在我意识到我使用 Node Version Manager 安装 Node 之前,我遇到了同样的问题。确保使用 Brew 安装它。
brew list
将向您展示 brew 安装的内容。
您没有使用 Homebrew 安装 Node,请使用 this gist 卸载当前安装的 Node。
然后:
brew update && brew install node