Unknown or duplicate parameter: NodeCommand

Viewed 10092

I'm trying to deploy a Node.js API with Elastic beanstalk.

I want to set the node command to start the app.

This is my nodecommand.config:

option_settings:
  aws:elasticbeanstalk:container:nodejs:
    NodeCommand: "npm start"

This is my file structure: enter image description here

Whenever I try to run eb deploy, I get this error:

2020-05-13 19:03:44    INFO    Environment update is starting.      
2020-05-13 19:03:48    ERROR   "option_settings" in one of the configuration files failed validation. More details to follow.
2020-05-13 19:03:48    ERROR   Unknown or duplicate parameter: NodeCommand 
2020-05-13 19:03:48    ERROR   Failed to deploy application.        

ERROR: ServiceError - Failed to deploy application.
3 Answers

I just encountered this very same issue. Upon investigation I found that "NodeCommand" is the legacy way to run your application with custom commands.

https://docs.aws.amazon.com/elasticbeanstalk/latest/dg/create_deploy_nodejs.container.html

I removed the ".ebextensions" directory and added a file called "Procfile" to my source directory.

Inside Procfile, try putting the following:

web: npm start

Make sure you update your repository with these changes if necessary before trying to deploy.

Hope this helps!

I used Procfile to deploy app

in Procfile

web: npm run deploy

In package.json, added new command deploy

 "scripts": {
    "deploy": "npm run build && npm run start"
  },

For those who came here through Google, I had a similar problem and was getting this response:

ERROR: ServiceError - Configuration validation exception: Unknown or duplicate parameter: NodeVersion

After trying a lot of things I learned this is now legacy. I deleted that file and added a ProcFile at the root of my application (file name is case sensitive, there doesn't seem to be a required extension), with this line: web: npm start

That error disappeared (to be replaced by a different one about role permissions, but any progress is good progress, right?).

Related