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
Incorrect PATH used in lerna exec
#2850
Comments
I have observed the same problem in Ubuntu, so it's not Mac or Homebrew-specific. We worked around the problem by using Node v15 when calling |
Any further developments on this? This has been a pain point for me as well and I haven't yet determined a means of sourcing the necessary shell profile as a workaround (in my case my .zshrc) from within the child process that Lerna spawns. |
Experiencing this here too. We are still on Node v14 which, as stated, comes with NPM v6. We globally install NPM v7 like the other reporters. Doing a little digging I found a workaround that doesn't seem horrible -- but first, let's examine the details... Here's
Here's what
Of course, if we check with
And we can verify the version of that:
My workaround is simple:
With that complete,
Works as a local fix and it'll help the CI scenario too. With the fix in place, our root
It no longer matters whether |
The
PATH
used inlerna exec
is not the same as the parent shell, which can result in a differentnpm
version used.I use
npm@7.6.3
withnode@14.16.0
. I installed thenode@14
package with Homebrew which initially comes withnpm@6.14.11
and updated it withnpm i -g npm --force
.lerna
doesn't usenpm@7.6.3
butnpm@6.14.11
which results in inconsistencies in lockfileVersions of the packages which should be in version 2, but are rolled back to version 1 since npm@6 is used instead of npm@7.Expected Behavior
I'd expect the
npm binary
used inlerna exec
to be the same as in the parent shell. This can be tested withwhich npm
which should give the same result in the parent shell and inlerna exec -- which npm
.Current Behavior
In my environment, it does the following:
and
Possible Solution
Lerna should use the same $PATH as the parent shell when creating the child processes.
Steps to Reproduce (for bugs)
I'm not entirely sure because I don't understand how the lerna PATH is set, but it happens in environments where multiple versions of
npm
are installed and the parent shell should have thisnpm
binary in the path.Context
I'm just trying to use lerna on my mac.
Your Environment
The text was updated successfully, but these errors were encountered: