简体   繁体   English

使用 Elastic Beanstalk 在 AWS 上部署 NodeJS API

[英]NodeJS API deployement on AWS with Elastic Beanstalk

I'm looking for deploying my NodeJS API with AWS.我正在寻找使用 AWS 部署我的 NodeJS API。

I tried to use Elastic Beanstalk but I always get this issue:我尝试使用 Elastic Beanstalk,但总是遇到这个问题:

Image of the error I get我得到的错误图片

There is my package.json有我的package.json

  {
    "name": "",
    "scripts": {
      "start": "node server.js"
    },
    "version": "0.0.0",
    "private": true,
    "dependencies": {
      "bcryptjs": "^2.4.3",
      "body-parser": "^1.18.3",
      "express": "^4.16.4",
      "hammerjs": "^2.0.8",
      "jsonwebtoken": "^8.5.1",
      "mongoose": "^5.4.20",
      "mongoose-unique-validator": "^2.0.2",
      "multer": "^1.4.1",
      "tslib": "^1.9.0"
    }
  }

And I also have a nodecommand.config into a folder named ".ebextensions"我还有一个 nodecommand.config 到一个名为“.ebextensions”的文件夹中

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

Also, is Elastic Beanstalk the best way to deploy my API?此外,Elastic Beanstalk 是部署我的 API 的最佳方式吗?

Thx for the answers !谢谢你的答案!

Based on the comments.根据评论。

The primary issue was using rar for deployment packaged instead of zip .主要问题是使用rar进行部署而不是zip After fixing that, config files had to be adjusted to work with Amazon Liunx 2.修复该问题后,必须调整配置文件以与 Amazon Liunx 2 一起使用。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM