简体   繁体   中英

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

I've been having issues deploying my app to elastic beanstalk all day today. I have following project structure (single page app built with react)

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

I zip it and upload to elastic beanstalk running node.js

here is 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 .

You will be able to find further info on this via logs that eb produces.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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