-
Notifications
You must be signed in to change notification settings - Fork 352
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
Regression in v1.11.0: detected package manager defaults to yarn #780
Comments
Hey, This issue might occur because the installation command is not run from the same directory where the |
Thanks for responding! The project in question relies on Java dependencies, and therefore it uses Maven to orchestrate the build, including the step of running the I'm not sure if this is relevant to why Here's the relevant section of the CI job log:
Does this help in any way? |
@waldyrious I can see here that some of the codegens are getting installed successfully, the error is happening in codegens that contain a package-lock.json of their own. This issue can be fixed by removing the package-lock.json files, for which I have made a PR. To get |
Thanks, @aman-v-singh!
To be honest, I think that even though this is an issue with Until the ordering of the results of |
@waldyrious As my priority I have released a new patch version
So we can also take up writing our utilities to detect package managers where we can change the priority. It can be a task for the next minor release. I can see the upside of prioritizing Thoughts? @VShingala |
@aman-v-singh interestingly, the changes from 1.14.1 do fix the issue! Thanks a lot for the quick reaction! 😀 So just to be sure I understand correctly, what is happening now is that I still think it might be worth investigating why the presence of the While usage of |
Correct!
@waldyrious The
The
I will close this issue for now but will discuss it with my team and look for a more reliable solution for this problem. |
The changes introduced in #744 and #765 result in the use of the incorrect package manager in some cases, where
yarn
is used wherenpm
should be used instead.For context, I am working in a repository that has a
package-lock.json
rather than ayarn.lock
file; and indeed, my team usesnpm
instead ofyarn
. However, when we addedpostman-code-generators
as a dependency, we started getting errors in CI, because we use an internal npm registry, andyarn
is not able to access it using the same configurations and authentication data asnpm
.For some reason, neither our top-level
package-lock.json
, nor this package's ownpackage-lock.json
are triggering the first condition that detect-package-manager was supposed to check (the presence of a given package manager's lockfile), so it goes to step 2, which is to check what package managers are available in the machine. And indeed the CI runner we use has bothnpm
andyarn
available.Unfortunately, in the presence of both
npm
andyarn
,detect-package-manager
gives precedence toyarn
, for some reason. (This has been reported in egoist/detect-package-manager#11, but after a year, there's no resolution yet — or even acknowledgement of the issue by the developer, for that matter).@aman-v-singh, do you think it would be possible to reorder the array returned by
detect-package-manager
'sdetect()
, before it is used in npm/deepinstall.js, so thatnpm
comes first in the list?The text was updated successfully, but these errors were encountered: