0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

Volta × Amplifyで管理しているプロジェクトのNode.jsのバージョンを変更したい場合のトラブルシューティング

Last updated at Posted at 2025-01-22

概要

VoltaでNode.jsのバージョンを管理している環境で、Amplifyを使用しているプロジェクトのNode.jsのバージョンを変更する際、プロジェクト直下の package.json に書かれている volta.node のバージョンを書き換えるだけでは、 amplify コマンドを実行した際には変更前のNode.jsのバージョンが使用されてしまうようです。

具体的には amplify push 時に実行される yarn で、インストールしようとしている環境のNode.jsのバージョンと、インストールしようとしているパッケージのバージョンがが合わないというエラーが出てしまいます。

Command failed with exit code 1: yarn --no-bin-links --production
warning ../../../package.json: No license field
error xxxxx@x.x.x: The engine "node" is incompatible with this module. Expected version "20 || >=22". Got "18.15.0"
error Found incompatible module.
yarn install v1.22.10
[1/4] Resolving packages...
[2/4] Fetching packages...
info Visit https://yarnpkg.com/en/docs/cli/install for documentation about this command.

対応方法

@aws-amplify/cli の再インストールで解決します。

volta uninstall @aws-amplify/cli
volta install @aws-amplify/cli

プロジェクトのNode.jsのバージョンがどこで保持されているのか、保持されているとしてなぜcliの再インストールで解決するのかはよくわかっていません。ご存じの方がおられればぜひコメントで教えてください。

参考

Error Node when i use amplify push · Issue #13218 · aws-amplify/amplify-cli

バージョン情報

amplify -v
12.10.1
0
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
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?