5

This is the error I encountered with package.json when running foreman start with Heroku Toolbelt for Node.js

 "dependencies": 
{
    "express": "~4.4.0",
    "jade": "~1.3.1"
}

enter image description here

Jek
  • 5,546
  • 9
  • 37
  • 67

2 Answers2

7

I had the same issues as Jek. I was using express 4.4.4. I downgraded express 3.2.6 and it worked, but I shouldn't be forced to use an older version of express just because foreman doesn't support it.

I tried node-foreman. And it worked for me. I followed the instructions that included these steps:

  1. npm install -g foreman
  2. nf start

I would like to know if anyone has additional suggestions.

Mike Barlow - BarDev
  • 11,087
  • 17
  • 62
  • 83
  • I've had this same issue for months, I gave up a while ago. I have been trying again, building up a simple app from scratch. This WORKS. Very simple. Thank you. – Patrick Jan 27 '15 at 00:24
2

I managed to fix this issue by changing express version to 3.2.6 as seen below

 "dependencies": 
{
    "express": "~3.2.6",
    "jade": "~1.3.1"
}

Then I deleted node_modules and did a npm install. Following this a foreman start works perfectly fine.

However I have no idea why it doesn't work when it runs on express 4 but it works when running on express 3.

Jek
  • 5,546
  • 9
  • 37
  • 67
  • I'm getting the [same](http://stackoverflow.com/questions/24127434/write-einval-error-on-foreman-for-heroku-on-node-js-and-on-port-5000-immediate) problem with EINVAL. – geoyws Jun 09 '14 at 19:24
  • Any other solution ? :( – httpete Jun 23 '14 at 22:27
  • 2
    Thanks for the answer. This answer worked for me, but not acceptable. I can run my node application successfully with express 4.4.4 locally without using foreman. I can also run my application with express 4.4.4 on a Heroku Dyno with no problem. If I run "foreman start" multiple time in a row, i get different errors. Foreman is a pain in the a**. I'm about to give up on Heroku and look for a different solution. – Mike Barlow - BarDev Jul 04 '14 at 19:29
  • @BarDev it's the same pain point that we face. I'm about to give up on it too. If you do find a different solution, could you share that with me. I'll be glad to try new stuff. – Jek Jul 07 '14 at 04:03
  • 2
    Since my post on July 4 I've been using node-foreman and it's been working without issue. – Mike Barlow - BarDev Jul 08 '14 at 12:37