Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PATH environment variable being removed during spawn #5

Open
stuffaboutpete opened this issue Sep 27, 2020 · 0 comments
Open

PATH environment variable being removed during spawn #5

stuffaboutpete opened this issue Sep 27, 2020 · 0 comments

Comments

@stuffaboutpete
Copy link

Out of the box, I was getting the following error:

Current git branch is master
Retrieving template currently deployed on stack example
Packaging template template.yml
ERROR: Error with command: Error: spawn aws ENOENT
    at Process.ChildProcess._handle.onexit (internal/child_process.js:264:19)
    at onErrorNT (internal/child_process.js:456:16)
    at processTicksAndRejections (internal/process/task_queues.js:77:11)

This is because the call to spawn the aws process specifies an options argument - if this is provided, the default value which contains a PATH key is not used. The following is a brute force fix, but you may prefer to extend the existing environment on each individual call to run:

// core/utils.js

run: (cmd, args=[], opts={}, onData=null) => {

  return new Promise((resolve, reject) => {
    if (!opts.env) opts.env = {};                         // New
    if (!opts.env.PATH) opts.env.PATH = process.env.PATH; // New

    let proc = spawn(cmd, args, opts)

I'm using Ubuntu on WSL 2 (Windows) so my setup may have something to do with it but I get the impression this will show up on other systems too. A couple of links I found:

https://stackoverflow.com/questions/27688804/how-do-i-debug-error-spawn-enoent-on-node-js

nodejs/node#12986

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant