0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

nodenvで指定したバージョンを使ってくれない時

0
Posted at

現象

nodenv をインストールしてプロジェクトのディレクトリに .node_version を作成したところ、指定したバージョンを使ってくれませんでした。

$ nodenv local
x.x.x
$ node -v
y.y.y
$ which node 
/usr/local/bin

解決

nodenv をインストールした時に指定したパスが間違っていました。

node コマンド実行時に PATH に指定された順(export -pで左から順)に実行ファイルを探します。
間違っていた PATH は /usr/local/bin -> .nodenv/shims の順に設定していたので /usr/local/bin にヒットして実行されていたようです。

.nodenv/shims -> /usr/local/bin の順にしたところ期待通りの動きになりました。

$ which node
/Users/myaccount/.nodenv/shims/node

最後に

マニュアルにしっかり書いてありました。日本語のインストールブログだけではなくまず公式ドキュメントを読みましょうという話でした。

0
0
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
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?