Unknown or duplicate parameter: NodeCommand
Asked Answered
D

3

30

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.
Drennan answered 13/5, 2020 at 19:9 Comment(0)
H
73

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!

Hevesy answered 13/5, 2020 at 20:35 Comment(8)
Thanks. This helped a lot. The have contradictory information. Shouldn't it just be npm start though?Drennan
That's great to hear! I think npm start is referencing your scripts in package.json. So yes you should just do that if your "start" script has what you need. I am using an Express server to server my static React app files so I run it using node.Hevesy
This is actually exact solution.Conduction
This worked. Shouldn't this doc be updated then?Prelacy
I resolved this issue by removing the .ebextensions directory. I did not create a Procfile directory either. When you do not provide an Procfile ElasticBeanstalk will run npm start if you provide a package.json file. The link above will provide some insight.Gonroff
Thanks! AWS documentation is not up to date.Krieger
docs.aws.amazon.com/elasticbeanstalk/latest/dg/…Cell
it's been >2 years and aws docs are still misleading peopleGintz
C
13

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"
  },
Carmel answered 11/11, 2020 at 1:44 Comment(0)
A
1

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?).

Abigael answered 28/7, 2020 at 4:21 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.