aws-amplify / aws-amplify/amplify-cli

amplify always chooses the wrong package manager

Open
#13,931 5 comments 0 reactions 0 assignees View on GitHub
bug override
Dominant language
TypeScript
Stars
2.9k
Forks
825
Avg merge
11d 23h
Merged PRs (30d)
2

Description

### 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` or `amplify push` on our project that has a package-lock.json in the root
Please 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:

- [X] I have done my best to include a minimal, self-contained set of instructions for consistently reproducing the issue.
- [X] I have removed any sensitive information from my code snippets and submission.

Contributor guide

Open the contributing guide

Research direction

Start by reproducing the problem with `amplify pull` or `amplify push` in a project containing `package-lock.json`, then trace the packaging overrides step that invokes `yarn install`. Done means package-manager detection selects npm for this project and the operation completes without requiring yarn or pnpm.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
cli, tooling
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.