eas-cli icon indicating copy to clipboard operation
eas-cli copied to clipboard

[EAS Build] EAS Build should adhere to the package manager version set in package.json

Open pmk1c opened this issue 1 year ago • 4 comments

I was confused at first, when I noticed that EAS ignores the packageManager field in package.json. I think this should be the first place to look for, when EAS decides, which package manager and which version to use.

pmk1c avatar May 28 '24 06:05 pmk1c

Hi @pmk1c,

It makes sense. I will try to add support for it and make it the first place to look for package manager + its version 👍

szdziedzic avatar Jun 13 '24 12:06 szdziedzic

Thank you for filing this issue! This comment acknowledges we believe this may be a bug and there’s enough information to investigate it. However, we can’t promise any sort of timeline for resolution. We prioritize issues based on severity, breadth of impact, and alignment with our roadmap. If you’d like to help move it more quickly, you can continue to investigate it more deeply and/or you can open a pull request that fixes the cause.

expo-bot avatar Jun 13 '24 12:06 expo-bot

Thank you for filing this issue! This comment acknowledges we believe this may be a bug and there’s enough information to investigate it. However, we can’t promise any sort of timeline for resolution. We prioritize issues based on severity, breadth of impact, and alignment with our roadmap. If you’d like to help move it more quickly, you can continue to investigate it more deeply and/or you can open a pull request that fixes the cause.

expo-bot avatar Jun 13 '24 12:06 expo-bot

Hello, i'm using turborepo monorepo and trying to build some apps.

If in my root there is a packageManager prop like this: image

that is automatically added by turborepo, i'd get this error in eas log:

We detected that 'APP_NAME' is a yarn workspace Running "yarn install" in /Users/expo/workingdir/build directory error This project's package.json defines "packageManager": "yarn@[email protected]". However the current global version of Yarn is 1.22.21. Presence of the "packageManager" field indicates that the project is meant to be used with Corepack, a tool included by default with all official Node.js distributions starting from 16.9 and 14.19. Corepack must currently be enabled by running corepack enable in your terminal. For more information, check out https://yarnpkg.com/corepack. yarn install exited with non-zero code: 1

Do you have any suggestion of why is happening?

Also i'm using npm as package manager.

Thank you

FedeRBeije avatar Jul 02 '24 14:07 FedeRBeije

@szdziedzic sorry to ping you but it would be helpful to know something about it.

Thanks

FedeRBeije avatar Jul 17 '24 08:07 FedeRBeije

I think I have the same issue: In my monorepo's root package.json, I've set "packageManager": "[email protected]" When creating a custom build config and building it on EAS build, I receive an error in the Install node_modules step. It's weird that it says yarn@[email protected] while there's obviously just [email protected] in my package.json.

Any ideas? image

SanderPeeters avatar Jul 19 '24 12:07 SanderPeeters

Hi @SanderPeeters,

I assume you want to use NPM as your project manager, right? Do you have a lock file generated by yarn in your repo by any chance?

szdziedzic avatar Jul 19 '24 14:07 szdziedzic

Hi @SanderPeeters,

I assume you want to use NPM as your project manager, right? Do you have a lock file generated by yarn in your repo by any chance?

Hi, thx for answering me! It's correct that I want NPM to use as a package manager. I have a package-lock.json file in my root folder, but no yarn.lock. When I'm creating a 'regular' build (not using he custom build scheme), it correctly detects that there's a package-lock.json file. But the custom build scheme doesn't recognize this for some reason. image

SanderPeeters avatar Jul 22 '24 07:07 SanderPeeters

Hi, thx for answering me! It's correct that I want NPM to use as a package manager. I have a package-lock.json file in my root folder, but no yarn.lock. When I'm creating a 'regular' build (not using he custom build scheme), it correctly detects that there's a package-lock.json file. But the custom build scheme doesn't recognize this for some reason.

I will check if I can replicate it, thanks!

szdziedzic avatar Jul 22 '24 09:07 szdziedzic

@SanderPeeters @FedeRBeije

I deployed a PR to fix the package manager resolution logic for custom builds. Can you check if it fixed your issue?

szdziedzic avatar Jul 22 '24 13:07 szdziedzic

Please note: It still doesn't mean we added support for the packageManager field in package.json all across EAS Build. This PR should just fix package manager resolution logic based on the presence of lock files.

szdziedzic avatar Jul 22 '24 13:07 szdziedzic

Hi @szdziedzic. With eas-cli/10.2.1 darwin-x64 node-v18.19.0 it worked fine.

To be honest the first build failed because during the post-install(need to do this right know has i mention #2463) it couldn't find a packageManager prop inside package.json.

Thank you so much!

FedeRBeije avatar Jul 22 '24 16:07 FedeRBeije

This issue is stale because it has been open for 30 days with no activity. If there is no activity in the next 7 days, the issue will be closed.

github-actions[bot] avatar Aug 22 '24 00:08 github-actions[bot]

This issue was closed because it has been inactive for 7 days since being marked as stale. Please open a new issue if you believe you are encountering a related problem.

github-actions[bot] avatar Aug 29 '24 00:08 github-actions[bot]

still doesnt work with yarn:

image

Vadko avatar Dec 27 '24 20:12 Vadko

I'm getting the same error as well: image

pranjalnadhani avatar Dec 27 '24 23:12 pranjalnadhani

What's the current suggestion to use for ensuring corepack gets enabled in the expo install dependencies workflow?

paul-rinaldi avatar Jan 08 '25 23:01 paul-rinaldi

What's the current suggestion to use for ensuring corepack gets enabled in the expo install dependencies workflow?

Looks like "workaround" or fix is to do the following simply add: "eas-build-pre-install": "corepack enable" to your package.json scripts

paulrinaldi avatar Jan 08 '25 23:01 paulrinaldi

@paulrinaldi not sure if that's even a workaround, or just the recommended solution.

Yarn 2+ Modern Expo Installation docs

6TELOIV avatar Jan 09 '25 21:01 6TELOIV

For anyone else running into this in a monorepo situation, "eas-build-pre-install": "corepack enable" needs to be added to the expo app package.json, not your monorepo one. In my case, that means /apps/expo/package.json and not /package.json

6TELOIV avatar Jan 09 '25 21:01 6TELOIV

This issue is stale because it has been open for 30 days with no activity. If there is no activity in the next 7 days, the issue will be closed.

github-actions[bot] avatar Feb 09 '25 00:02 github-actions[bot]

This issue is stale because it has been open for 30 days with no activity. If there is no activity in the next 7 days, the issue will be closed.

github-actions[bot] avatar Mar 13 '25 00:03 github-actions[bot]

Adding a pre install script in my case does not help...still gettig the:
error This project's package.json defines "packageManager": "yarn@[email protected]". However the current global version of Yarn is 1.22.21.

JovanJevtic avatar Mar 13 '25 03:03 JovanJevtic

🚨 Make sure pnpm-lock.yaml is committed to your repo. EAS Build uses it to correctly choose the package manager. Hope this saves someone else hours of debugging!

M-Farih avatar May 08 '25 11:05 M-Farih

Now we can enable corepack from eas.json directly 😎

lucassaid avatar May 13 '25 02:05 lucassaid

Now we can enable corepack from eas.json directly 😎

Not working for me. When I enable "corepack": true I tried to install pnpm instead of yarn "packageManager": "[email protected]

Looks like "workaround" or fix is to do the following simply add: "eas-build-pre-install": "corepack enable" to your package.json scripts

work find for me

drminh2807 avatar May 15 '25 11:05 drminh2807

🚨 Make sure pnpm-lock.yaml is committed to your repo. EAS Build uses it to correctly choose the package manager. Hope this saves someone else hours of debugging!

pnpm install --frozen-lockfile exited with non-zero code: 1

This is completely useless to me.

TLovers avatar Jul 06 '25 08:07 TLovers

Removing pnpm-lock.yaml from my .gitignore and then uploading it to my repo solved this problem for me.

Huge props to @M-Farih - you're an absolute lifesaver, thank you.

lk11601 avatar Aug 13 '25 03:08 lk11601

Removing pnpm-lock.yaml from my .gitignore and then uploading it to my repo solved this problem for me.

Huge props to @M-Farih - you're an absolute lifesaver, thank you.

This worked for me. Thank you

Gideon1107 avatar Aug 21 '25 22:08 Gideon1107