jfromaniello / winser

Run a node.js application as a window service using nssm.
270 stars 47 forks source link

'winser -i' doesn't work #41

Closed khackskjs closed 8 years ago

khackskjs commented 8 years ago

Hello. I've faced the problem that I can't register my service. It doesn't work.

  1. I made "test_winser" folder
  2. in the folder, "npm init" with all default parameters
  3. added "index.js" file that just calls console.log("hi");
  4. following Method 2, added 2 scripts in package.json. "install-windows-service": "winser -i", "uninstall-windows-service": "winser -r",
  5. "npm run-script install-windows-service" in command shell.

finally, error occurs npm-debug.log is below.

my environment is windows7 64

0 info it worked if it ends with ok
1 verbose cli [ 'C:\\Program Files\\nodejs\\node.exe',
1 verbose cli   'C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js',
1 verbose cli   'run-script',
1 verbose cli   'install-windows-service' ]
2 info using npm@2.14.12
3 info using node@v4.3.2
4 verbose run-script [ 'preinstall-windows-service',
4 verbose run-script   'install-windows-service',
4 verbose run-script   'postinstall-windows-service' ]
5 info preinstall-windows-service test_winser@1.0.0
6 info install-windows-service test_winser@1.0.0
7 verbose unsafe-perm in lifecycle true
8 info test_winser@1.0.0 Failed to exec install-windows-service script
9 verbose stack Error: test_winser@1.0.0 install-windows-service: `winser -i`
9 verbose stack Exit status 1
9 verbose stack     at EventEmitter.<anonymous> (C:\Program Files\nodejs\node_modules\npm\lib\utils\lifecycle.js:214:16)
9 verbose stack     at emitTwo (events.js:87:13)
9 verbose stack     at EventEmitter.emit (events.js:172:7)
9 verbose stack     at ChildProcess.<anonymous> (C:\Program Files\nodejs\node_modules\npm\lib\utils\spawn.js:24:14)
9 verbose stack     at emitTwo (events.js:87:13)
9 verbose stack     at ChildProcess.emit (events.js:172:7)
9 verbose stack     at maybeClose (internal/child_process.js:821:16)
9 verbose stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:211:5)
10 verbose pkgid test_winser@1.0.0
11 verbose cwd D:\workspace_test\test_winser
12 error Windows_NT 6.1.7601
13 error argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "run-script" "install-windows-service"
14 error node v4.3.2
15 error npm  v2.14.12
16 error code ELIFECYCLE
17 error test_winser@1.0.0 install-windows-service: `winser -i`
17 error Exit status 1
18 error Failed at the test_winser@1.0.0 install-windows-service script 'winser -i'.
18 error This is most likely a problem with the test_winser package,
18 error not with npm itself.
18 error Tell the author that this fails on your system:
18 error     winser -i
18 error You can get their info via:
18 error     npm owner ls test_winser
18 error There is likely additional logging output above.
19 verbose exit [ 1, true ]
khackskjs commented 8 years ago

I've found out! the solution is that my project doesn't require dependency stdio, async in my project's nodemodule folder. I can't understand why It's needed in my project's node_module folder. anyway after I install 2 module, works well. Good luck