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?

More than 1 year has passed since last update.

EC2 Amazon Linux2にVoltaでnode18を入れたけどエラーが出る

Last updated at Posted at 2023-05-15

概要

  • 下記の方法でAL2のEC2にVoltaをインストールした。その後$ volta install node@18を実行したディレクトリで$ node -vを実行したところエラーが発生した。解決方法を簡単にまとめてみる。

情報

  • どうやらEC2はNode.js18をサポートしてない模様。。。

チュートリアル__Amazon_EC2_インスタンスでの_Node_js_のセットアップ_-_AWS_SDK_for_JavaScript.png

方法

  1. 下記のコマンドをEC2インスタンスにsshして実行する。

    sudo amazon-linux-extras install docker
    sudo systemctl enable docker
    sudo systemctl start docker
    sudo usermod -a -G docker ec2-user
    
  2. 一旦EC2インスタンスへのssh接続を終了する。

  3. EC2インスタンスへssh接続する。

  4. 下記を実行してNode.jsのDockerイメージを取得する。

    docker pull node:18
    
  5. 下記を実行してNode.jsのコンテナを起動する。

    docker run -it --rm node:18 /bin/bash
    
  6. コンテナ内で$ node -vを実行したところ問題なくバージョンが返された。

    # node -v
    v18.16.0
    
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?