When testing it on my local computer, I use supervisor (npm install -g supervisor) instead of using node directly. That is, to start my script, I use:
supervisor app.jsinstead of:
node app.jsHowever, since I'm using the harmony mode (for keyword such as 'let'), supervisor seems can't start node with the '--harmony' flags, I must modify the script myself.
- Using 'find . | grep supervisor' to find the location of the script: /usr/local/share/npm/lib/node_modules/supervisor
- Edit ./lib/supervisor.js.
- In 'function run (args)' :
function run (args) {And:
var arg, next, watch, ignore, program, extensions, executor, poll_interval, debugFlag, debugBrkFlag, debugBrkFlagArg, harmony;
while (arg = args.shift()) {
if (arg === "--help" || arg === "-h" || arg === "-?") {
return help();
} else if (arg === "--quiet" || arg === "-q") {
debug = false;
util.debug = function(){};
util.puts = function(){};
} else if (arg == '--harmony') {
harmony = true;
} else if (arg === "--verbose" || arg === "-V") {
verbose = true;
if (debugBrkFlag) {Save, and that's all.
program.unshift(debugBrkFlagArg);
}
if (harmony) {
program.unshift('--harmony');
}
Now I can use:
supervisor --harmony app.js
to start my project :)
Your change has been added to the library: https://github.com/isaacs/node-supervisor/pull/121
ReplyDeleteGreat, thanks!
DeleteNice,thanks!
ReplyDelete