I am using the scripts
feature of npm
to conveniently start my service by typing npm start
. In my package.json
file, I have this:
{
...
"scripts": {
"start": "NODE_PATH=. node index.js",
....
}
}
The NODE_PATH
is the troublesome part. I do this so I can write in my javascript files: require('lib/mymodule');
instead of require('../lib/mymodule');
or some variant. There is a different syntax for setting an environment variable for a command on Windows. It would be cmd /C "set NODE_PATH=. && node index.js"
.
How can I accomplish running the right start
command based on the operating system?