简体   繁体   English

将node.js应用程序部署到弹性beantalk(使用express)

[英]Deploy node.js application to elastic beanstalk (using express)

I've been having issues deploying my app to elastic beanstalk all day today. 我今天整天都在将应用程序部署到弹性beantalk时遇到问题。 I have following project structure (single page app built with react) 我有以下项目结构(使用react构建的单页应用程序)

dist/
  index.html
  bundle.js
package.json
app.js

I zip it and upload to elastic beanstalk running node.js 我将其压缩并上传到运行node.js的弹性beantalk

here is app.js 这是app.js

var express = require('express');
var app = express();

app.use(express.static(__dirname + '/dist'));

app.get('/*', function(req, res){
  res.sendFile(__dirname + '/dist/index.html');
});

app.listen(8080, function() {
  console.log('Listening on port: ' + 8080);
});

Locally, it all wоrks fine, but aws thrоws warnings. 在本地,一切正常,但是会发出警告。

For anyone who comes across similar issue, it turned out that it was related to some of the dependencies I used, so it could be worth downgrading them, and not use ^ version . 对于遇到类似问题的任何人,事实证明它与我使用的某些依赖项有关,因此值得降级它们,而不要使用^ version

You will be able to find further info on this via logs that eb produces. 您将可以通过eb生成的日志找到有关此信息的更多信息。

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

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