当我使用全局nodemon运行程序时出现此错误,但仅当我使用节点
时它很好[nodemon] 1.11.0
[nodemon] to restart at any time, enter `rs`
[nodemon] watching: *.*
[nodemon] starting `node server.js`
events.js:160
throw er; // Unhandled 'error' event
^
Error: spawn cmd ENOENT
at exports._errnoException (util.js:1018:11)
at Process.ChildProcess._handle.onexit (internal/child_process.js:193:32)
at onErrorNT (internal/child_process.js:367:16)
at _combinedTickCallback (internal/process/next_tick.js:80:11)
at process._tickCallback (internal/process/next_tick.js:104:9)
without nodemon it works correctly but globally run gives error.
答案 0 :(得分:0)
您应该运行nodemon
代替node
。看起来您正在运行nodemon node server.js
而不是运行
nodemon server.js