fresc81 / node-winreg

node module that provides access to the Windows Registry through the REG commandline tool
212 stars 58 forks source link

Error when packaged in electron app #49

Open Ajeey opened 6 years ago

Ajeey commented 6 years ago

Hi,

I get the following error when I run this library in electron(after I pack it into a .exe via electron-builder)

{ Error\n at mkErrorMsg (C:\\Users\\denimuser\\AppData\\Local\\Programs\\my-events\\resources\\app\\webpack:\\src\\uninstaller\\registry.js:111:12)\n at ChildProcess.<anonymous> (C:\\Users\\denimuser\\AppData\\Local\\Programs\\my-events\\resources\\app\\webpack:\\src\\uninstaller\\registry.js:541:10)\n at emitTwo (events.js:106:13)\n at ChildProcess.emit (events.js:194:7)\n at maybeClose (internal/child_process.js:899:16)\n at Socket.<anonymous> (internal/child_process.js:342:11)\n at emitOne (events.js:96:13)\n at Socket.emit (events.js:191:7)\n at Pipe._handle.close [as _onclose] (net.js:510:12) name: [Getter], message: [Getter], code: [Getter] }","timestamp":"2018-03-05 04:03:38"}

afroewis commented 6 years ago

I am facing the same issue. Did you find a workaround for this problem?

Galkon commented 5 years ago

I also was getting the same error after building my electron app. However, I was able to get the same error by directly pasting registry.js from this repository into my app and using it that way.

I managed to track down the error specifically to my use-case (though, I still don't know how it managed to work fine when I used it from npm install winreg --production and in development environment).

I resolved my issue entirely for both development environment and production builds by amending this line to:

this.__defineGetter__('path', function () { return '"' + (_host.length == 0 ? '' : '\\\\' + _host + '\\') + _hive + _key + '"'; });

The difference is that the entire registry path is wrapped in quotes for when it is passed down in the child_process.spawn() args. My use case specifically had spaces in the path, and it would break with this error.

EDIT: Pull request created @ https://github.com/fresc81/node-winreg/pull/55

gandarez commented 5 years ago

Any update here?

alanhamlett commented 4 years ago

@gandarez @fresc81 so #55 fixes it but need to bump the version and release the fix?

gandarez commented 4 years ago

@gandarez @fresc81 so #55 fixes it but need to bump the version and release the fix?

Exactly we need a new version of this ASAP.