1

I am getting heroku starting "npm start" on web process no matter I include Procfile or not. I am building a simple page with React/Redux and using webpack to bundle.

Actually my project structure is:

/projectName
 /public -->folder create during bundling with bundle.js and new html file 
 /src --> contains React and Redux components 
 .babelrc
 .gitignore
 index.html -->original html
 index.js --> express server (nothing special, just serving public/index.html on the root ("./) request)
 package.json
 Procfile (no extension, uppercase P in the name so no error there)
 webpack.config.js

All is working in local.

the Package.json file :

/ {
    "name": "redux-heroku",
    "version": "1.0.0",
    "description": "",
    "engines": {
       "node":"6.10.1"
    },

   "scripts": {
        "prod": "webpack -p",
        "start":"node index.js",
        "start:web": "webpack-dev-server"
   },

  "author": "",
  "license": "ISC",
  "dependencies": {
     "babel-core": "^6.25.0",
     "express": "^4.15.3",
     "react": "^15.6.1",
     "react-dom": "^15.6.1",
     "react-redux": "^5.0.5",
     "react-router": "^4.1.1",
     "react-router-redux": "^4.0.8",
     "redux": "^3.6.0",
      "redux-thunk": "^2.2.0"
   },
  "devDependencies": {
      "babel": "^6.23.0",
      "babel-loader": "^7.1.1",
      "babel-preset-es2015": "^6.24.1",
      "babel-preset-react": "^6.24.1",
      "css-loader": "^0.28.4",
      "html-webpack-plugin": "^2.29.0",
      "webpack": "^3.2.0",
      "webpack-dev-server": "^2.5.1"
   }
 }

The index.js express file :

var express = require('express');
var app = express(); 
var port = process.env.port || 3000; 

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

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

app.listen(port);

The Procfile: web: node index.js

So I delete the Procile et push all on heroku, getting the same thing, anyway I was expecting that according to this Stopping Heroku from running npm start + what to run instead?

I am a bit lost, thank you for you insight!!

KKoku
  • 31
  • 1
  • 9

1 Answers1

0

do you want to know when to use procfile or just npm scripts?

Procfiles can contain additional process types. For example, you might declare one for a background worker process that processes items off of a queue.

Package.json scripts are executed when procfile is not found and only limited scrips are available

If you have custom scrips you use procfile

HEROKU DEV

Ronald Cardenas
  • 146
  • 1
  • 4