You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

运行eb init时出现ServiceError:'express'非有效键值对,求解决方案

Fixing the 'express' not a valid key=value pair ServiceError in eb init

Hey there! Let's sort out this eb init error you're seeing. That "not a valid key=value pair" message means AWS Elastic Beanstalk was expecting a configuration entry in the format key=value (or key: value in YAML), but instead got the raw string express which it can't parse. Here's exactly what to do to get eb init working:

Step 1: Rerun eb init and watch your inputs closely

The most common cause is a misstep during the interactive setup:

  • When prompted to choose a platform, don't type express directly—Elastic Beanstalk doesn't have a dedicated "express" platform. Express is a Node.js framework, so pick the appropriate Node.js platform from the numbered list (e.g., Node.js 18 running on 64bit Amazon Linux 2). Just enter the corresponding number, not the framework name.
  • If you were setting environment variables when the error popped up, make sure every entry follows the KEY=VALUE format (like PORT=3000), not just a standalone word like express.

Step 2: Clean up invalid config in .elasticbeanstalk/config.yml

If you already tried initializing the project once, your local config file might have the bad express entry stuck in it:

  1. Open the .elasticbeanstalk/config.yml file in your project root.
  2. Look for any line that just says express (no key, no equals sign/colon). Delete that line, or adjust it to a valid configuration. For example, if you meant to set the platform, it should look like:
    platform: Node.js 18 running on 64bit Amazon Linux 2
    
  3. Save the file and try eb init again.

Step 3: Bypass interactive prompts (optional)

If you want to avoid interactive input entirely, run eb init with the platform explicitly specified. Replace the platform string with the one matching your project's Node.js version:

eb init --platform "Node.js 18 running on 64bit Amazon Linux 2"

This skips the setup prompts and directly configures the correct Node.js platform for your Express app.

Step 4: Validate your config

After fixing things, run eb config to view your current Elastic Beanstalk configuration. Double-check that every entry uses valid key: value YAML format—no random standalone strings allowed.

If you're still hitting issues, feel free to share the content of your .elasticbeanstalk/config.yml file, and I can help spot any remaining problems.

内容的提问来源于stack exchange,提问作者fds

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.05.08 18:22:55