1

I am beginner in node JS. I have it a month ago. Implemented a basic rest API using express and its working in my localhost perfectly.

Now I try to deploy that on AWS beanstalk using eb CLI. when do eb create command than it says that

2021-12-06 06:21:39    INFO    Using elasticbeanstalk-us-east-2-187234582143 as Amazon S3 storage bucket for environment data.
2021-12-06 06:21:58    INFO    Created target group named: arn:aws:elasticloadbalancing:us-east-2:187234582143:targetgroup/awseb-AWSEB-QB71GQAXNSNM/029cf54bd0029c58
2021-12-06 06:21:58    INFO    Created security group named: sg-038e16d78bbbe7b2f
2021-12-06 06:22:14    INFO    Created security group named: awseb-e-b3kg2ksm7c-stack-AWSEBSecurityGroup-1OKFQPW85UGII
2021-12-06 06:22:14    INFO    Created Auto Scaling launch configuration named: awseb-e-b3kg2ksm7c-stack-AWSEBAutoScalingLaunchConfiguration-13VMAOEPR6RFV
2021-12-06 06:23:15    INFO    Created Auto Scaling group named: awseb-e-b3kg2ksm7c-stack-AWSEBAutoScalingGroup-UVOBZD4IN60U
2021-12-06 06:23:15    INFO    Waiting for EC2 instances to launch. This may take a few minutes.
2021-12-06 06:23:16    INFO    Created Auto Scaling group policy named: arn:aws:autoscaling:us-east-2:187234582143:scalingPolicy:3251c481-2411-467a-ae3a-30725747c2a1:autoScalingGroupName/awseb-e-b3kg2ksm7c-stack-AWSEBAutoScalingGroup-UVOBZD4IN60U:policyName/awseb-e-b3kg2ksm7c-stack-AWSEBAutoScalingScaleDownPolicy-19YJB1MRW9A0
2021-12-06 06:23:16    INFO    Created Auto Scaling group policy named: arn:aws:autoscaling:us-east-2:187234582143:scalingPolicy:74efad3a-9579-4d0e-ab38-5112deba1de8:autoScalingGroupName/awseb-e-b3kg2ksm7c-stack-AWSEBAutoScalingGroup-UVOBZD4IN60U:policyName/awseb-e-b3kg2ksm7c-stack-AWSEBAutoScalingScaleUpPolicy-IK6FQYMW5EEF
2021-12-06 06:23:16    INFO    Created CloudWatch alarm named: awseb-e-b3kg2ksm7c-stack-AWSEBCloudwatchAlarmLow-9SQ05QBJTZP3
2021-12-06 06:23:16    INFO    Created CloudWatch alarm named: awseb-e-b3kg2ksm7c-stack-AWSEBCloudwatchAlarmHigh-1N6M4CF239G1B
2021-12-06 06:23:31    INFO    Created load balancer named: arn:aws:elasticloadbalancing:us-east-2:187234582143:loadbalancer/app/awseb-AWSEB-1M017GYW2YXTZ/01049b3c5b655b3b
2021-12-06 06:23:33    INFO    Created Load Balancer listener named: arn:aws:elasticloadbalancing:us-east-2:187234582143:listener/app/awseb-AWSEB-1M017GYW2YXTZ/01049b3c5b655b3b/b2fc2089d35e2669
2021-12-06 06:23:37    INFO    Instance deployment: You didn't specify a Node.js version in the 'package.json' file in your source bundle. The deployment didn't install a specific Node.js version.
2021-12-06 06:23:40    INFO    Instance deployment completed successfully.
2021-12-06 06:24:47    INFO    Successfully launched environment: Node-template-dev

Also environment health status is showing severe

my package.json is

{
  "name": "node-template",
  "version": "1.0.0",
  "description": "",
  "main": "index.js",
  "scripts": {
    "start": "node ./index.js"
  },
  "author": "Chirag patel",
  "license": "ISC",
  "dependencies": {
    "express": "^4.17.1",
    "nodemon": "^2.0.15"
  },
  "devDependencies": {
    "babel-cli": "^6.26.0",
    "babel-preset-env": "^1.7.0",
    "babel-preset-stage-0": "^6.24.1"
  }
}
  • Does this answer your question? [How can I specify the required Node.js version in package.json?](https://stackoverflow.com/questions/29349684/how-can-i-specify-the-required-node-js-version-in-package-json) – jordanm Dec 06 '21 at 07:22
  • No, I tried it but not working for me. – chirag patel Dec 06 '21 at 09:30

1 Answers1

0

You need to specify the platform version with --platform when you use eb create if you want a specific version of Node.js. For example:

$ eb create --platform "64bit Amazon Linux 2 v5.4.4 running Node.js 14"
Blair Nangle
  • 1,221
  • 12
  • 18