ruby の rbenv には、対象リポジトリをどの ruby を用いて実行するかを指定する .ruby-version
があります。 nodejs の nodenv にも同様のものがあるのではないかと思いました。
質問
- nodenv に、リポジトリ(ディレクトリ)の隠しファイルで、そこにバージョンを記述しておくと、 nodenv がよろしくそのバージョンでもって実行してくれるようなファイルのしくみは存在しますか?
スタック・オーバーフローはプログラマーとプログラミングに熱心な人のためのQ&Aサイトです。すぐ登録できます。
登録してこのコミュニティに参加するruby の rbenv には、対象リポジトリをどの ruby を用いて実行するかを指定する .ruby-version
があります。 nodejs の nodenv にも同様のものがあるのではないかと思いました。
はい、nodenv にも .node-version
というローカル用設定ファイルが存在します。
以下、nodenv の README.md の "Coosing the Node Version" からの引用です。
- The first
.node-version
file found by searching the directory of the script you are executing and each of its parent directories until reaching the root of your filesystem.- The first
.node-version
file found by searching the current working directory and each of its parent directories until reaching the root of your filesystem. You can modify the.node-version
file in the current working directory with thenodenv local
command.
和訳:
- スクリプトを実行したディレクトリから、ファイルシステムのルートに達するまで親ディレクトリを探索していき、最初に見つかった
.node-version
ファイル- 現在作業中のディレクトリから、ファイルシステムのルートに達するまで親ディレクトリを探索していき、最初に見つかった
.node-version
ファイル。この.node-version
ファイルは、作業中のディレクトリでnodenv local
コマンドを使うことで変更できます。