17
7

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.

nvmとdirenvを使ってディレクトリ毎にnodeのバージョンを指定する方法

Posted at

いつも一回書くとcpで取ってきて、忘れてしまうので、残しておく。

##1 .nvmrcにnode versionを書く

 .nvmrc
8.12.0

##2 .envrcにdirenvの設定を書く
.nvmrcと同じディレクトリーに.envrcを置く

 .envrc
nvmrc=~/.nvm/nvm.sh
source $nvmrc
nvm use

これで2つを配置したディレクトリにcdするだけで、node versionが切り替わる。

17
7
2

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

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?