LoginSignup
4
0

More than 1 year has passed since last update.

NVM for Windows利用時にNode.jsバージョン変更後「npm ERR! Unexpected token '.'」が出るとき

Posted at

経緯

NVM for Windows 1.1.7を利用中、Node.jsのバージョンを14系から16系に上げた際、

npm ERR! Unexpected token '.'

が出てビルドできなくなってしまう事象が発生。

対応

NOTICE: If you downloaded this version before Dec 15, 2021 and are affected by issue #706, please re-download. This fix was not present in the initial binary and has since been corrected.
https://github.com/coreybutler/nvm-windows/releases/tag/1.1.9

https://github.com/npm/cli/issues/4234#issuecomment-1080927985
のコメントを参考に、

  1. まずNVM for Windowsを、「1.1.9」までバージョンアップ
  2. nvm uninstall v16.14.2 (管理者権限プロンプトで/エラーが出てしまったバージョンを一回消す)
  3. nvm install v16.14.2 (指定バージョンを入れなおす)
  4. nvm use v16.14.2

といった形で入れ直してから、npmのビルドをかけると解消された模様。

NVMのバージョンアップ後に、使いたいバージョンのNode.jsを入れるのが良さげです。

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