-
Notifications
You must be signed in to change notification settings - Fork 820
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
amplify always chooses the wrong package manager #13931
Comments
Hey @thegrandpooba, thank you for reaching out. It appears the behavior is occurring due to following amplify-cli/packages/amplify-cli-core/src/utils/packageManager.ts Lines 109 to 118 in a644a1f
To mitigate the issue you could try removing the |
Thanks for your note, but I do not have yarn.lock file anywhere in my repository (i have now quadruple checked). There is only |
apologies on the delay in a response. amplify-cli/packages/amplify-cli-core/src/utils/packageManager.ts Lines 130 to 156 in a644a1f
it appears the code checks for any lock file first present in the directory: The order of check: pnpm -> yarn -> npm if it does not find any lock files it proceeds to check for a locally installed package manager executable: The order of the check: yarn -> pnpm -> npm Marking this as bug for further investigation and improvements. |
How did you install the Amplify CLI?
npm
If applicable, what version of Node.js are you using?
16.20.2
Amplify CLI Version
12.12.6
What operating system are you using?
Linux (and Windows WSL)
Did you make any manual changes to the cloud resources managed by Amplify? Please describe the changes made.
No
Describe the bug
amplify push (or pull) always chooses yarn for me (and pnpm for a developer on my team) even though the package manager we've been using is npm and there is a package-lock.json file in the repo.
We've been away from this project for a couple months and we haven't made ANY changes to the repo/project/amplify and this behaviour just started when we upgraded our amplify. Not sure which version we were running prior.
Expected behavior
Use npm as was being done before.
Reproduction steps
just type
amplify pull
oramplify push
on our project that has a package-lock.json in the rootPlease note: there is not a yarn.lock file anywhere to be seen in this amplify project folder structure. I have made tripley sure of this.
Project Identifier
f692ebb27a73e75af29c87f79f8db1e0
Log output
Fetching updates to backend environment: dev from the cloud.⠋ Building resource api/AdminQuerie⠼ Building resource api/lambdaserverlessadmi⚠️ WARNING: owners may reassign ownership for the following model(s) and role(s): Profile: [owners], Customer: [owners]. If this is not intentional, you may want to apply field-level authorization rules to these fields. To read more: https://docs.amplify.aws/cli/graphql/authorization-rules/#per-user--owner-based-data-access.
⠦ Building resource api/lambdaserverlessadmi✅ GraphQL schema compiled successfully.
Edit your schema at /amplify/backend/api/lambdaserverlessadmi/schema.graphql or place .graphql files in a directory at /amplify/backend/api/lambdaserverlessadmi/schema
✖ Fetching updates to backend environment: dev from the cloud.
✖ There was an error initializing your environment.
🛑 Packaging overrides failed.
Command failed with exit code 1: yarn install
warning package.json: No license field
warning package-lock.json found. Your project contains lock files generated by tools other than Yarn. It is advised not to mix package managers in order to avoid resolution inconsistencies caused by unsynchronized lock files. To clear this warning, remove package-lock.json.
... and lots more yarn failures
Additional information
I fixed this by deleting yarn from my computer. My colleague fixed it by renaming her pnpm binary.
Before submitting, please confirm:
The text was updated successfully, but these errors were encountered: