Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

119
Views
Deploying an Anguilarjs app on Heroku using CI/CD

I have made a small Angularjs based on a typical directory structure that stores source on al "src" directory and deploys to a "dist" directory. So fa I haven't had problem with code being deployed on local server as in github pages. I already built a CodeShip CI/CD instance, it runs testing fine and deploys but it crushes there.

The code is being deployed to heroku, but I can't find the way to make it work inside heroku.

I already made a Procfile:

web: node node_modules/gulp/bin/gulp build
web: node server.js

And also a basic servers.js

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

// I found somewhere that process.env.PORT lets the port be set by Heroku,
// but its 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 this one 

// home page route
app.get('/', function(req, res) {
    res.render('index');
});

app.listen(port, function() {
    console.log('App is running fine on port:' + port +' ++');
});

Of Course I already added express to my node package. It actually works fine in my localhost (Linux and Windows)

On Heroku log, there is no much info, I suspect that I cant make express find the correct path, so it crashes.

2017-03-29T13:58:27.459049+00:00 app[web.1]:     at Module.runMain (module.js:605:10)
2017-03-29T13:58:27.554976+00:00 heroku[web.1]: State changed from starting to crashed

HEROKU On Heroku Log

CODESHIP (using node 6.10.2) CodeShip Log

about 4 years ago · Santiago Trujillo
1 answers
Answer question

0

To run your build step, you can do it with npm scripts like this:

"scripts": {
  "start": "node server.js",
  "test": "mocha",
  "postinstall": "node node_modules/gulp/bin/gulp build"
}

Then your Procfile can be simple like this -

web: npm start

As far as the error goes, it's hard to say because I don't have the full error to look at. Make sure your server.js file is in the right spot, and you have a package.json file that lists all of your dependencies.

about 4 years ago · Santiago Trujillo Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!