jfromaniello / winser

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

can't work at windows server 2003 #14

Open xionglun opened 11 years ago

xionglun commented 11 years ago

I test this at windows 7 64bit, and it works well. But at windows server 2003, the cmd window stay on winser -i .

mbarchein commented 11 years ago

Same on Windows XP SP3. Stuck on winser -i

jfromaniello commented 11 years ago

Would you mind to debug it or just put a bunch of console.log to see what's going on El 29/06/2013 20:18, "mbarchein" notifications@github.com escribió:

Same on Windows XP SP3. Stuck on winser -i

— Reply to this email directly or view it on GitHubhttps://github.com/jfromaniello/winser/issues/14#issuecomment-20239042 .

neoqing commented 11 years ago

On window7, I cannot run it successfully. log shows below

c:\mycode\node_modules\winser\bin\winser:62 program.confirm(message, function(ok){ ^ TypeError: Object # has no method 'confirm' at sequence.then.then.then.npmPath (c:\mycode\node_modules\winser\bin\winser:62:21) at next (c:\mycode\node_modules\winser\node_modules\sequence\sequence.js:33:20) at Sequence.then (c:mycode\node_modules\winser\node_modules\sequence\sequence.js:49:14) at Object. (c:mycode\node_modules\winser\bin\winser:56:6) at Module._compile (module.js:456:26) at Object.Module._extensions..js (module.js:474:10) at Module.load (module.js:356:32) at Function.Module._load (module.js:312:12) at Function.Module.runMain (module.js:497:10) at startup (node.js:119:16) npm ERR! myservice@1.0.0 postinstall: winser -i -s -c npm ERR! cmd "/c" "winser -i -s -c" failed with 8 npm ERR! npm ERR! Failed at the myservice@1.0.0 postinstall script. npm ERR! This is most likely a problem with the myservice package, npm ERR! not with npm itself. npm ERR! Tell the author that this fails on your system: npm ERR! winser -i -s -c npm ERR! You can get their info via: npm ERR! npm owner ls myservice npm ERR! There is likely additional logging output above.

npm ERR! System Windows_NT 6.1.7600 npm ERR! command "C:\Program Files\nodejs\node.exe" "C:\Program Files\nodejs\node_modules\npm\bin\npm-cli.js" "run-script" "postinstall" npm ERR! cwd c:\mycode npm ERR! node -v v0.10.4 npm ERR! npm -v 1.2.18 npm ERR! code ELIFECYCLE npm ERR! npm ERR! Additional logging details can be found in: npm ERR! c:\mycode\npm-debug.log npm ERR! not ok code 0

jfromaniello commented 11 years ago

Seems TJ removed prompt in last version and I am being too permissive with the version :

https://github.com/visionmedia/commander.js/blob/master/index.js

I will fix this quickly El 06/08/2013 05:24, "neoqing" notifications@github.com escribió:

On window7, I cannot run it successfully. log shows below

c:\mycode\node_modules\winser\bin\winser:62 program.confirm(message, function(ok){ ^ TypeError: Object # has no method 'confirm' at sequence.then.then.then.npmPath (c:\mycode\node_modules\winser\bin\winser:62:21) at next (c:\mycode\node_modules\winser\node_modules\sequence\sequence.js:33:20) at Sequence.then (c:mycode\node_modules\winser\node_modules\sequence\sequence.js:49:14) at Object. (c:mycode\node_modules\winser\bin\winser:56:6) at Module._compile (module.js:456:26) at Object.Module._extensions..js (module.js:474:10) at Module.load (module.js:356:32) at Function.Module._load (module.js:312:12) at Function.Module.runMain (module.js:497:10) at startup (node.js:119:16) npm ERR! myservice@1.0.0 postinstall: winser -i -s -c npm ERR! cmd "/c" "winser -i -s -c" failed with 8 npm ERR! npm ERR! Failed at the myservice@1.0.0 postinstall script. npm ERR! This is most likely a problem with the myservice package, npm ERR! not with npm itself. npm ERR! Tell the author that this fails on your system: npm ERR! winser -i -s -c npm ERR! You can get their info via: npm ERR! npm owner ls myservice npm ERR! There is likely additional logging output above.

npm ERR! System Windows_NT 6.1.7600 npm ERR! command "C:\Program Files\nodejs\node.exe" "C:\Program Files\nodejs\node_modules\npm\bin\npm-cli.js" "run-script" "postinstall" npm ERR! cwd c:\mycode npm ERR! node -v v0.10.4 npm ERR! npm -v 1.2.18 npm ERR! code ELIFECYCLE npm ERR! npm ERR! Additional logging details can be found in: npm ERR! c:\mycode\npm-debug.log npm ERR! not ok code 0

— Reply to this email directly or view it on GitHubhttps://github.com/jfromaniello/winser/issues/14#issuecomment-22164359 .

jfromaniello commented 11 years ago

hi @neoqing this is fixed in version 0.1.4. You can uninstall and reinstall winser

jfromaniello commented 11 years ago

@xionglun @neoqing could you provide more information? maybe console output

xionglun commented 11 years ago

@jfromaniello I am so sorry, it's my last item. I had finished it two months ago with nssm directly. But i'd like to rebuild that environment and test it again.

xionglun commented 11 years ago

@jfromaniello I use winser 0.1.3, and cd to my project root. then type winser -i, it just stuck there without any log.
And my package.json like below:

    ....
    "script": {
       "start": "node app.js",
       "install-window-service": "winser -i",
       "uninstall-windows-service": "winser -r"
   }
   ....

My os is windows server 2003 EE sp2
Do you need more infos?

jfromaniello commented 11 years ago

@xionglun do you run on an elevated prompt?

xionglun commented 11 years ago

@jfromaniello yeah, I have tried using administrator privileges, but still stuck on there.

jfromaniello commented 11 years ago

@xionglun does this works on your system (in an elevated prompt)?

wmic OS get OSArchitecture

and whats the response

xionglun commented 11 years ago

@jfromaniello no, it can't

    Node - MICROSOF-9E5FDA
    ERROR:
    Code  = 0x80041017
    Description  = ????
    Facility = WMI
jfromaniello commented 11 years ago

@xionglun i did a fix for the case where wmi is not supported, can you try version winser 0.1.5?

xionglun commented 11 years ago

@jfromaniello I update my winser to 0.1.5 , but still stuck on there without any log.

neoqing commented 11 years ago

@jfromaniello ,thanks for reply. Update as below if run with ... "scripts": { "postinstall": "winser -i -s -c", "preuninstall": "winser -r -x -s" } ...

get

winser -i -s -c

c:\mycode\node_modules\winser\bin\winser:62 program.confirm(message, function(ok){ ^ TypeError: Object # has no method 'confirm' at sequence.then.then.then.npmPath (c:\mycode\node_modules\winser\bin\winser:62:21) at next (c:\mycode\node_modules\winser\node_modules\sequence\sequence.js:33:20) at Sequence.then (c:\mycode\node_modules\winser\node_modules\sequence\sequence.js:49:14) at Object. (c:\mycode\node_modules\winser\bin\winser:56:6) at Module._compile (module.js:456:26) at Object.Module._extensions..js (module.js:474:10) at Module.load (module.js:356:32) at Function.Module._load (module.js:312:12) at Function.Module.runMain (module.js:497:10) at startup (node.js:119:16) npm ERR! websocketclient@1.0.0 postinstall: winser -i -s -c npm ERR! cmd "/c" "winser -i -s -c" failed with 8 npm ERR! npm ERR! Failed at the websocketclient@1.0.0 postinstall script. npm ERR! This is most likely a problem with the websocketclient package, npm ERR! not with npm itself. npm ERR! Tell the author that this fails on your system: npm ERR! winser -i -s -c npm ERR! You can get their info via: npm ERR! npm owner ls websocketclient npm ERR! There is likely additional logging output above.

npm ERR! System Windows_NT 6.1.7600 npm ERR! command "C:\Program Files\nodejs\node.exe" "C:\Program Files\nodejs\node_modules\npm\bin\npm-cli.js" "install" npm ERR! cwd c:\mycode npm ERR! node -v v0.10.4 npm ERR! npm -v 1.2.18 npm ERR! code ELIFECYCLE npm ERR! npm ERR! Additional logging details can be found in: npm ERR! c:\mycode\npm-debug.log npm ERR! not ok code 0

if run npm install winser directly

get below error

npm http GET https://registry.npmjs.org/winser npm http 200 https://registry.npmjs.org/winser npm http GET https://registry.npmjs.org/winser/-/winser-0.1.6.tgz npm http 200 https://registry.npmjs.org/winser/-/winser-0.1.6.tgz npm ERR! error rolling back Error: ENOTEMPTY, rmdir 'c:\mycode\node_modules\winser\bin' npm ERR! error rolling back winser@0.1.6 { [Error: ENOTEMPTY, rmdir 'c:\mycode\node_modules\winser\bin'] npm ERR! error rolling back errno: 53, npm ERR! error rolling back code: 'ENOTEMPTY', npm ERR! error rolling back path: 'c:\mycode\node_modules\winser\bin' } npm ERR! Error: ENOTEMPTY, rmdir 'c:\mycode\node_modules\winser\bin' npm ERR! If you need help, you may report this log at: npm ERR! http://github.com/isaacs/npm/issues npm ERR! or email it to: npm ERR! npm-@googlegroups.com

npm ERR! System Windows_NT 6.1.7600 npm ERR! command "C:\Program Files\nodejs\node.exe" "C:\Program Files\nodejs\node_modules\npm\bin\npm-cli.js" "install" "winser" npm ERR! cwd c:\mycode npm ERR! node -v v0.10.4 npm ERR! npm -v 1.2.18 npm ERR! path c:\mycode\node_modules\winser\bin npm ERR! code ENOTEMPTY npm ERR! errno 53 npm ERR! npm ERR! Additional logging details can be found in: npm ERR! c:\mycode\npm-debug.log npm ERR! not ok code 0

jfromaniello commented 11 years ago

@neoqing I fixed the program.confirm issue a month ago the first time you told me.

You should update to 0.1.6.

regards

Aparvi commented 10 years ago

I'm also facing the same issue with 0.1.6 (winser version) on Windows 2003 as the command "wmic OS get OSArchitecture" does not return the control back to nodejs. So I made workaround fix to include the timeout (2 sec) as below and it looks ok as of now:

exec('wmic OS get OSArchitecture', {'timeout' : 2000}, function(err, stdout, stderr) { if (err || !stdout) { console.log('couldn\'t determine the OSArchitecture with "wmic OS get OSArchitecture". Using 32 bit version.'); return next(err, npmLocation, '32'); } var architecture = stdout.match(/(32|64)/)[1]; next(err, npmLocation, architecture); });

Please let me know if this is already solved...

jfromaniello commented 10 years ago

no, this is the first time I heard that wmic OS get OSArchitecture doesn't return. What happens if you run on a cmd?

Aparvi commented 10 years ago

On the cmd, I get the below:

Node - W2K3VM32 ERROR: Code = 0x80041017 Description = Invalid query Facility = WMI

Aparvi commented 10 years ago

Hi, Meanwhile I have tried using %PROCESSOR_ARCHITECTURE% and it is working on all the windows platforms. I have also verified on a machine which is having a 64 bit processor and a 32 bit Windows 2008 OS and the results are as below. So I think we can use "echo %PROCESSOR_ARCHITECTURE%" in place of "wmic OS get OSArchitecture". Please suggest.

echo %PROCESSOR_ARCHITECTURE% x86

wmic cpu get caption Caption x64 Family 16 Model 9 Stepping 1 x64 Family 16 Model 9 Stepping 1