node-auto-launch icon indicating copy to clipboard operation
node-auto-launch copied to clipboard

TypeError: Path must be a string. Received undefined

Open apphelpyulongs opened this issue 7 years ago • 4 comments

  • The target platform(s) the problem occurs on (Linux, Mac, Mac App Store, and or Windows): Windows 8.1
  • Node version (run node -v): 7.7.4
  • auto-launch version: 5.0.3
  • The options you're passing to auto-launch:
  • Are you using NW.js or Electron? Electron
    • If so, which version? 1.7.9
    • If you're using Electron, are you using auto-launch from the main process or a renderer process? main
  • Can you reproduce this with a simple Hello World example app?
  • If needs be, would you be able to provide us with a simple app (as simple as possible) which reproduces the problem?

const launcher = new AutoLaunch({
        name: result.productName,
        path: 'C:\\Program Files\\test\\service\\6.0.177\\test.exe', 
        isHidden: true
    });
    try {
        await launcher.enable();
        log.info(MODULE_NAME, `auto-launch ${result.productName} successfully!`);
    } catch (error) {
        log.error(MODULE_NAME, `auto-launch ${result.productName} failed! ${error}`);
    }```

I also tried to remove `path` but it's the same result 

apphelpyulongs avatar Dec 04 '17 19:12 apphelpyulongs

to whoever uses Electron and wants to do auto-launch, Electron has native support for this functionality. Here is the doc for that https://electronjs.org/docs/api/app#appgetloginitemsettingsoptions-macos-windows

apphelpyulongs avatar Dec 07 '17 18:12 apphelpyulongs

@4ver can you get someone to test on Windows?

adam-lynch avatar Dec 15 '17 21:12 adam-lynch

have a look! dependencies: auto-launch -> AutoLaunchWindows -> winreg -> getRegExePath . path.join(process.env.windir, 'system32', 'reg.exe'); process.env.windir is undefined.

Imfdj avatar Oct 24 '19 03:10 Imfdj

you should use auto-launch module in main process, I solved this problem

newPromise avatar Sep 15 '20 10:09 newPromise