question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Exec command not found

See original GitHub issue
  • Version: 17.21.0
  • Target: dmg

I have some exec() command in my app for example:

exec('npm -v', (err, stdout, stderr) => {

      $log.info(stdout, stderr, err);
    });

It works if i start the app from the shell but it won’t if i build the dmg and install the app.

I get error in console: npm command not found

So i tried this:

require('child_process').execSync('which npm').toString();

And i get this error:

child_process.js:538 Uncaught Error: Command failed: which npm


    at checkExecSyncError (child_process.js:495:13)
    at Object.execSync (child_process.js:535:13)
    at Object.childProcess.(anonymous function) [as execSync] (ELECTRON_ASAR.js:690:22)
    at <anonymous>:1:26

Any advice?

Thank you

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:11 (6 by maintainers)

github_iconTop GitHub Comments

9reactions
yopbeastcommented, Nov 5, 2016

Actually i found that using this:

process.env.PATH = process.env.PATH + ':/usr/local/bin';

exec works, could be a fix or it’s going to take me to the hell too? 🗡

Read more comments on GitHub >

github_iconTop Results From Across the Web

exec command not found error in Linux - Unix Stack Exchange
@VeeraV The issue is that on your system, cd is not available as an external utility, while pwd is. The exec utility is...
Read more >
Bash exec command not found - Stack Overflow
Bash exec command not found · Because exec expects the first argument to be the name of a command, not the whole command...
Read more >
How to fix a "Command not found" error in Linux - Red Hat
5 ways to fix "Command not found" errors · 1. Include the path · 2. Add a new path · 3. Copy a...
Read more >
Linux / UNIX: Command Not Found Error and Solution - nixCraft
It means either program is not installed or PATH variable in your environment is not pointing to it. Learn how to fix command...
Read more >
Command not found error while running exec command on ...
I am trying this- kubectl exec -it examplepod -n namespacename-ci -- /bin/bash. I get bash-4.4 I enter sudo su after it which I...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found