Can't start foreman cos node.js complains about some obscure module it can't find

trying to get a project working on my debian vm but foreman refuses to start. the node.js error message is not very helpful cos it doesn't even tell me what module can't be found.

sissi@debian:/media/fancystuff$ foreman start
22:05:33 web.1     | started with pid 2949
22:05:33 web.1     |
22:05:33 web.1     | module.js:337
22:05:33 web.1     |     throw new Error("Cannot find module '" + request + "'");
22:05:33 web.1     |           ^
'2:05:33 web.1     | Error: Cannot find module '/media/fancystuff/web.js
22:05:33 web.1     |     at Function._resolveFilename (module.js:337:11)
22:05:33 web.1     |     at Function._load (module.js:279:25)
22:05:33 web.1     |     at Array.0 (module.js:484:10)
22:05:33 web.1     |     at EventEmitter._tickCallback (node.js:190:38)
22:05:33 web.1     | process terminated
22:05:33 system    | sending SIGTERM to all processes

btw 1: the error message is the same no matter if web.js is there of if it's deleted....which just adds to my confusion.

btw 2: "foreman check" gives me "valid procfile detected (web)"

sigh.

From this line:

'2:05:33 web.1     | Error: Cannot find module '/media/fancystuff/web.js

it looks like there is a non-printing character at the end of the line in your Procfile where you call node web.js since the ' character that was put after module name string ended up at the beginning of the line.

Editing Procfile and making sure that that special character is gone, your problem will probably be solved. I could replicate this on my Debian dev. server by adding <32 characters at the end of the line after web.js before EOL.

Most probably the Procfile was coppied from different OS that append carriage return e.g \r\n that not compatible with foreman. Just remove the trailing spaces or character in the Procfile and rerun. Or the simplest is to remove the Procfile and create using same OS

Example Procfile:

web: node web.js

And start the apps:

ubuntu@yadayada:~/heroku/web$ foreman start