0
1

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 3 years have passed since last update.

【2020年2月】プロジェクトごとのnode.jsのバージョンを、direnv+nvmで【強制】【固定】

Last updated at Posted at 2020-02-06

プロジェクトごとにNode.jsのバージョンが異なって辛みマシマシ

そんな時は以下の処方箋がおススメ。
例えば node.js 10 を強制的に使用する場合は以下のようにプロジェクトのフォルダ直下に.envrcファイルを作成し、nvm で 10 を指定しておきます。

.envrc
[[ -s ~/.nvm/nvm.sh ]] && . ~/.nvm/nvm.sh
nvm use 10

で、コマンドから direnv を有効にします。

$ direnv allow .

以上!

direnv、nvm のリンク

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

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?