Forever.js in WebStorm 2016.2


I just updated my WebStorm 2016 IDE and I'm having a bad time trying to startup my Node.js webserver using the forever.js process monitor.

Basically, I have node.js debug profile set up to run my node script with the -w flag (watch files for changes). Today, after updating WS, this profile works no more. Standard node.js debug configuration works. Also, I updated all my node packages to the latest version, i.e. I'm running forever.js 0.15.2.


Below the traceback for the error i get:

/home/user/.npm-packages/bin/forever -w /home/user/prj/ws/init.js -e dev -ll verbose
warn: --minUptime not set. Defaulting to: 1000ms
warn: --spinSleepTime not set. Your script will exit if it does not stay up for at least 1000ms
error: Could not read .foreverignore file.
error: ENOENT, open '/.foreverignore'
error: restarting script because unlinkDir changed

throw er; // Unhandled 'error' event
Error: watch EACCES
at errnoException (fs.js:1024:11)
at FSWatcher.start (fs.js:1056:11)
at (fs.js:1081:11)
at createFsWatchInstance (/home/user/.npm-packages/lib/node_modules/forever/node_modules/forever-monitor/node_modules/chokidar/lib/nodefs-handler.js:37:15)
at setFsWatchListener (/home/user/.npm-packages/lib/node_modules/forever/node_modules/forever-monitor/node_modules/chokidar/lib/nodefs-handler.js:80:15)
at FSWatcher.NodeFsHandler._watchWithNodeFs (/home/user/.npm-packages/lib/node_modules/forever/node_modules/forever-monitor/node_modules/chokidar/lib/nodefs-handler.js:228:14)
at FSWatcher.NodeFsHandler._handleDir (/home/user/.npm-packages/lib/node_modules/forever/node_modules/forever-monitor/node_modules/chokidar/lib/nodefs-handler.js:407:19)
at FSWatcher.<anonymous> (/home/user/.npm-packages/lib/node_modules/forever/node_modules/forever-monitor/node_modules/chokidar/lib/nodefs-handler.js:455:19)
at FSWatcher.<anonymous> (/home/user/.npm-packages/lib/node_modules/forever/node_modules/forever-monitor/node_modules/chokidar/lib/nodefs-handler.js:460:16)
at Object.oncomplete (fs.js:107:15)

Process finished with exit code 8


Any idea on how to fix this?


Comment actions Permalink

Does the same command (/home/user/.npm-packages/bin/forever -w /home/user/prj/ws/init.js -e dev -ll verbose) work for you in your system terminal?


looks similar to, but it doesn't give any solutions unfortunately

Comment actions Permalink

Yes it does work outside of WS.

Also, I have been googling before writing here and found the links you sent.

In addition, I have been testing the debug configuration without the --watch switch and the scripts starts without problems.

Looks like a compatibility issue of the new version of WS with Forever.js CLI... :(

Comment actions Permalink

Hmm... I've recreated the ' ENOENT, open '/.foreverignore'' issue using similar command. But, to me, it works exactly in the same way in terminal - all errors are the same. And it still works despite the error. The other issue (Error: watch EACCES) doesn't happen to me:

Comment actions Permalink

Ok here are my terminals... not quite the same though (don't mind the -ll arg of the server, it just sets the log level).


Comment actions Permalink

Please try running EXACTLY the same command in terminal - paths, working directory, etc.

Comment actions Permalink

also, please attach a screenshot of your Run configuration

Comment actions Permalink

Sorry. Below the screenshot of my terminal running the same command as WS.

And here is my debug config

Comment actions Permalink

The problem is caused by a bug in Forever: it uses wrong working directory when being run with  absolute path to file.

 Just check if with process.cwd() - it returns your working dir when using relative path and / - for absolute. 


Suggested run configuration that helps to avoid the issue:


You need to set a path to forever/bin/forever as javaScript file, the folder where your application main file is located - as working directory, and specify all arguments as application parameters


Comment actions Permalink

It worked. Thanks!

So, what changed since last version? Was WS using relative paths and now switched to absolute ones?

Comment actions Permalink

I didn't change the previous version. But Node.js run configuration is supposed to be used for running Node, it was not designed for using arbitrary tools as node interpreters. So I can't see any WebStorm issues here. This is clearly the problem of the tool and configuration


Please sign in to leave a comment.