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?

【AWS】CDKで「Node 18 has reached end-of-life on...」という警告が出た場合

Posted at

概要

cdk deployをすると「Node 18 has reached end-of-life on...」という警告が出ました。毎回出てきて煩わしいなと思い対応したので、備忘も込めて書きます。

原因と解決方法

利用しているのはpython版のCDKコード。
cdk deploy実行時の警告の全文は以下の通り。

b'!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\n'
b'!! !!\n'
b'!! Node 18 has reached end-of-life on 2025-04-30 and will no longer be supported in new releases after 2025-11-30. !!\n'
b'!! Please upgrade to a supported node version as soon as possible. !!\n'
b'!! !!\n'
b'!! This software is currently running on node v18.16.0. !!\n'
b'!! As of the current release of this software, supported node releases are: !!\n'
b'!! - ^24.0.0 (Planned end-of-life: 2028-04-30) !!\n'
b'!! - ^22.0.0 (Planned end-of-life: 2027-04-30) !!\n'
b'!! - ^20.0.0 (Planned end-of-life: 2026-04-30) !!\n'
b'!! - ^18.0.0 (Planned end-of-life: 2025-04-30) [DEPRECATED] !!\n'
b'!! !!\n'
b'!! This warning can be silenced by setting the JSII_SILENCE_WARNING_DEPRECATED_NODE_VERSION environment variable. !!\n'
b'!! !!\n'
b'!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\n'

Node.jsの警告が出ているのは、AWS CDKは内部的にNode.jsを利用しているため(jsiiという仕組みを利用しているらしい)。

また、意味は

  • 現在使っているNode.js(v18.16.0)は2025年4月30日でサポート終了
  • 2025年11月30日以降は新リリースでサポートされなくなる

ということがわかります。

ということで、私のホストマシンはMacでHomebrewを使っているので、以下のコマンドでNode.jsをアップグレードしていきます。

node -v # バージョンを確認
brew install node@20 #Node.js 20にアップグレード
node -v # バージョンを確認

※ちなみに以下のコマンドでnode.jsを管理しているかわかります

which node

必要であれば(node@18などがインストールされていて消したい場合)、以下も実施します。

brew unlink node@18
brew link --force --overwrite node@20

node@20を優先的に使いたい場合は以下でPATHを通します。

echo 'export PATH="/opt/homebrew/opt/node@20/bin:$PATH"' >> ~/.bash_profile
source ~/.bash_profile

これで毎回cdkコマンドで出ていた警告がなくなりました...
以上!

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?