-
-
Notifications
You must be signed in to change notification settings - Fork 222
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
Concurrently 3.0.0 runs the wrong version of node #61
Comments
Sounds like a problem with PATH. Could you run npm i spawn-default-shell && node -e "console.log(require('spawn-default-shell/src/get-shell')())" and paste the last line of the output here? That will tell which shell concurrently is spawning to get forward with this. It may be that the spawned shell doesn't read configuration from .bash_profile or similar env files. |
|
Ok I have the same shell, and I can correctly use the node version but I'm using nvm. Could you run |
For me theses commands return:
|
My setup for |
Ok thanks for reporting this bug. It seems that when we are running commands with |
Ok found it from |
@aaronjensen Ok this is now fixed in spawn-default-shell, it will by default use To my mind this is the expected behaviour of concurrently, but could there be some unwanted side-effects? Should I make the |
@kimmobrunfeldt now that I've thought about this some more, I think that this method won't actually work, even with What Here's why: Let's say you are using concurrently in continuous integration. You also have some secrets that you keep in environment variables associated with your build. Your CI server injects those environment variables via a script it runs to execute your build. This enables anything run within that script to have access to them. It does not update your profile or anything along those lines. This would mean that any shell started to run things that require those environment variables must share that environment. Starting a totally fresh shell would be bad, and making it a login shell would not bring those environment variables in. As a matter of fact, even if you inherited the environment and made it a login shell your login shell scripts may be overriding things that were exported in the parent environment. In short, concurrently should behave as running |
@aaronjensen I'm not sure if I understand what you mean. Concurrently does already share the environment as well as possible. Running I don't know any better way to "use a shell that shares the same exact environment as the shell running it." than the current solution. If you have an idea please share.
There is no special "reset" done by concurrently or spawn-default-shell. So it is as close to running these commands from an existing shell as possible. It's just the way bash -c ... and others work. E.g. see this output: ➜ ~ bash -c "nvm"
bash: nvm: command not found
➜ ~ nvm
Node Version Manager
... nvm is available in my "normal" shell, but not when using bash -c "nvm". The only way I know to fix this is to use bash -l -c "nvm", which correctly reads my .bashrc and makes nvm available. |
You're right, bash/zsh will exec the rc files regardless, which will usually override PATH. If you want to maintain all env vars, I think I guess one thing I don't understand is why does concurrently need to run each thing in its own shell? I don't understand it well enough to know that. The other option would be to do something like |
Previously, the `integration/` tests were failing, because `concurrently "foo"` does not inherit the `PATH` env var ([more info][1]). This commit fixes it, by setting the `PATH` env var explicitly: `concurrently "PATH=$PATH foo"`. This commit also includes some minor refactoring of the `integration/` tests scripts: - Move build-related operations to `ci-lite/build.sh` (for consistency). - Use `yarn run ...` instead of `npm run ...` inside package.json scripts. - Use global `yarn` (since we are already using it for `aio/`). - Fix some `travis_fold` statements. [1]: https://github.com/kimmobrunfeldt/concurrently/issues/61#issuecomment-252081610
Previously, the `integration/` tests were failing, because `concurrently "foo"` does not inherit the `PATH` env var ([more info][1]). This commit fixes it, by setting the `PATH` env var explicitly: `concurrently "PATH=$PATH foo"`. This commit also includes some minor refactoring of the `integration/` tests scripts: - Move build-related operations to `ci-lite/build.sh` (for consistency). - Use `yarn run ...` instead of `npm run ...` inside package.json scripts. - Use global `yarn` (since we are already using it for `aio/`). - Fix some `travis_fold` statements. [1]: https://github.com/kimmobrunfeldt/concurrently/issues/61#issuecomment-252081610
Anyone here want to try out my fork and comment back if it worked? I think that'll fix the issue. npm install https://github.com/kentcdodds/concurrently.git#pr/use-spawn-command |
Published v3.3.0. |
This works. Thank you @kentcdodds and @gustavohenke! |
Previously, the `integration/` tests were failing, because `concurrently "foo"` does not inherit the `PATH` env var ([more info][1]). This commit fixes it, by setting the `PATH` env var explicitly: `concurrently "PATH=$PATH foo"`. This commit also includes some minor refactoring of the `integration/` tests scripts: - Move build-related operations to `ci-lite/build.sh` (for consistency). - Use `yarn run ...` instead of `npm run ...` inside package.json scripts. - Use global `yarn` (since we are already using it for `aio/`). - Fix some `travis_fold` statements. [1]: https://github.com/kimmobrunfeldt/concurrently/issues/61#issuecomment-252081610
Previously, the `integration/` tests were failing, because `concurrently "foo"` does not inherit the `PATH` env var ([more info][1]). This commit fixes it, by setting the `PATH` env var explicitly: `concurrently "PATH=$PATH foo"`. This commit also includes some minor refactoring of the `integration/` tests scripts: - Move build-related operations to `ci-lite/build.sh` (for consistency). - Use `yarn run ...` instead of `npm run ...` inside package.json scripts. - Use global `yarn` (since we are already using it for `aio/`). - Fix some `travis_fold` statements. [1]: https://github.com/kimmobrunfeldt/concurrently/issues/61#issuecomment-252081610
I use asdf to manage my node versions. The new shell execution method in concurrently 3 appears to ignore my asdf setup and my previous environment so it runs w/ an older, system node. This makes everything fail.
The text was updated successfully, but these errors were encountered: