LoginSignup
1
4

More than 5 years have passed since last update.

macOS の Node をアップデートする(トラブルシューティング)

Last updated at Posted at 2019-03-19

macにて、npm init react-app した時に、Nodeのバージョンが古いぜ。と言われたのでアップデートした時のメモです。

$ npm init react-app my-app
npx: 63個のパッケージを4.154秒でインストールしました。
You are running Node 6.9.4.
Create React App requires Node 8 or higher.
Please update your version of Node.
$ node -v
v6.9.4

古すぎる。

恐らく最初にNodeをインストールした時に、macOS Installer (.pkg) を使ってインストールしたんだと思う。

途中からHomebrewでインストールしてたので、それをアンインストールして

$brew uninstall node
Uninstalling /usr/local/Cellar/node/11.12.0... (4,417 files, 50.2MB)

再度インストール

$ brew install node
==> Downloading https://homebrew.bintray.com/bottles/node-11.12.0.high_sierra.bottle.t
Already downloaded: /Users/zzz/Library/Caches/Homebrew/downloads/2083cfa12d866a973b37a64ed53a9f5a52cc4c4d054b26ab09881c503cff53ff--node-11.12.0.high_sierra.bottle.tar.gz
==> Pouring node-11.12.0.high_sierra.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 lib/dtrace/node.d
Target /usr/local/lib/dtrace/node.d
already exists. You may want to remove it:
  rm '/usr/local/lib/dtrace/node.d'

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/lib/dtrace/node.d
==> Caveats
Bash completion has been installed to:
  /usr/local/etc/bash_completion.d
==> Summary
🍺  /usr/local/Cellar/node/11.12.0: 4,417 files, 50.2MB
$ node -v
-bash: /usr/local/bin/node: No such file or directory
$ sudo rm '/usr/local/lib/dtrace/node.d'
$ brew link node
Linking /usr/local/Cellar/node/11.12.0...
Error: Could not symlink lib/dtrace/node.d
/usr/local/lib/dtrace is not writable.
$ brew link --overwrite node
Linking /usr/local/Cellar/node/11.12.0... 197 symlinks created
$ node -v
v11.12.0

/usr/local/lib/dtrace/node.d を削除して、
brew link --overwrite node でリンクし直して、最新版のNodeをインストールできました。

1
4
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
4