1
1

More than 1 year has passed since last update.

No version is set for command npm Consider adding one of the following versions in your config file at nodejs <version>

Posted at

概要

'npm install'コマンドを行おうとした際、下記のエラーが起きたので、自分の備忘録としても記載
「No version is set for command npm Consider adding one of the following versions in your config file at nodejs ~version~」

結論

インストールしたnode.jsをグローバルに設定できていなかったため。

解決策

asdf global nodejs <バージョン>

これにより、Node.jsの指定のバージョンに設定され、プロジェクトを作成する際にデフォルトでこのバージョンが使用されるようになる。

補足

asdf
複数のプログラミング言語のバージョンを管理するツールの1つ。
asdfを使用することで、異なるバージョンのプログラミング言語を簡単に切り替えることが可能。
asdfは、Node.js、Ruby、Python、Javaなどのプログラミング言語のバージョン管理に広く使用されている。
asdfを使用するには、まずasdfをインストールし、対象の言語(この場合はNode.js)のプラグインをインストールしておくことが必要。

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