angularjs - Deploying an Anguilarjs app on Heroku using CI/CD -
this question has answer here:
i have made small angularjs based on typical directory structure stores source on al "src" directory , deploys "dist" directory. fa haven't had problem code being deployed on local server in github pages. built codeship ci/cd instance, runs testing fine , deploys crushes there.
the code being deployed heroku, can't find way make work inside heroku.
i made procfile:
web: node node_modules/gulp/bin/gulp build web: node server.js and basic servers.js
var express = require('express'); var app = express(); // found somewhere process.env.port lets port set heroku, // not working var port = process.env.port || 8080; app.use(express.static(path.join(__dirname + '/dist'))); //app.use(express.static(process.env.pwd + '/dist')); //already tried 1 // home page route app.get('/', function(req, res) { res.render('index'); }); app.listen(port, function() { console.log('app running fine on port:' + port +' ++'); }); of course added express node package. works fine in localhost (linux , windows)
on heroku log, there no info, suspect cant make express find correct path, crashes.
2017-03-29t13:58:27.459049+00:00 app[web.1]: @ module.runmain (module.js:605:10) 2017-03-29t13:58:27.554976+00:00 heroku[web.1]: state changed starting crashed
to run build step, can npm scripts this:
"scripts": { "start": "node server.js", "test": "mocha", "postinstall": "node node_modules/gulp/bin/gulp build" } then procfile can simple -
web: npm start as far error goes, it's hard because don't have full error at. make sure server.js file in right spot, , have package.json file lists of dependencies.


Comments
Post a Comment