Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

120
Vistas
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 Respuestas
Responde la pregunta

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 Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda