node-windows icon indicating copy to clipboard operation
node-windows copied to clipboard

Unlinking exe file fails on installation

Open pschuegr opened this issue 10 years ago • 9 comments

I just noticed that the service uninstallation has trouble unlinking the exe file on my machine. This may be user error, in which case I apologize.

fs.js:760
  return binding.unlink(pathModule._makeLong(path));
                 ^
Error: EPERM, operation not permitted 'C:\Users\pschuegr\Documents\GitHub\wt\package\daemon\wt.exe'
    at Object.fs.unlinkSync (fs.js:760:18)
    at rm (C:\Users\pschuegr\AppData\Roaming\npm\node_modules\node-windows\lib\daemon.js:458:22)
    at C:\Users\pschuegr\AppData\Roaming\npm\node_modules\node-windows\lib\daemon.js:471:15
    at ChildProcess.exithandler (child_process.js:635:7)
    at ChildProcess.EventEmitter.emit (events.js:98:17)
    at maybeClose (child_process.js:735:16)
    at Socket.<anonymous> (child_process.js:948:11)
    at Socket.EventEmitter.emit (events.js:95:17)
    at Pipe.close (net.js:466:12)
npm ERR! weird error 8
npm ERR! not ok code 0

pschuegr avatar Feb 20 '14 04:02 pschuegr

Which version of node are you running? I don't remember how long ago it was, but there was a bug in the core node unlink command which was resolved in newer versions. Alternatively, this could be an issue of not running with admin/elevated privileges.

coreybutler avatar Feb 24 '14 23:02 coreybutler

I'm on 0.10.24. Is it necessary to run the uninstallation with admin privileges? It still seems to uninstall, just doesn't delete the exe file.

pschuegr avatar Feb 25 '14 20:02 pschuegr

You should be fine on the version.

Depending on where you installed the script, it may require admin privileges. Anything in the C:\Program Files directory requires admin privileges to add or remove... that's just Windows.

coreybutler avatar Feb 25 '14 21:02 coreybutler

Hmm, that's not it then. I'll see if I can figure anything else out.

pschuegr avatar Feb 25 '14 21:02 pschuegr

Ah, I just looked at your output again and noticed you're in the Users directory... assuming that's your user directory. If you're running the uninstall under your own account, then it should remove the file.

The only other thing I can think of is something is still hanging onto that file. It's possible the uninstall itself is hanging on. Sometimes running the uninstall twice fixes the issue. Not ideal... but if it works I know what the problem is.

coreybutler avatar Feb 25 '14 21:02 coreybutler

hi i have the same problem? can anyone please give detail resolution to this issue.

ravik000 avatar Mar 06 '14 07:03 ravik000

sorry, I haven't had time to dig into this further yet. On Mar 5, 2014 11:00 PM, "ravik000" [email protected] wrote:

hi i have the same problem? can anyone please give detail resolution to this issue.

Reply to this email directly or view it on GitHubhttps://github.com/coreybutler/node-windows/issues/48#issuecomment-36829998 .

pschuegr avatar Mar 06 '14 08:03 pschuegr

i think this may be the same as https://github.com/coreybutler/node-windows/issues/38

jackniu81 avatar Jun 18 '14 07:06 jackniu81

Did you stop the service before uninstalling? I had a similor problem, it was resolved by adding .stop(); and after an .on("stop", fun... event fired no error showed.

Brutusn avatar Jun 19 '14 10:06 Brutusn