-
Notifications
You must be signed in to change notification settings - Fork 825
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
unable to amplify build function
when using yarn 3
#13001
Comments
Hey @ginobean 👋 thanks for raising this! Out of curiosity what version of yarn are you using? Is there a workspaces setting that is picking up this directory? |
yarn 3.5.0 |
Hey @ginobean thanks for clarifying! I'm not able to reproduce with the latest yarn berry release and |
Hey @ginobean I was able to reproduce this by running
However the error is also printing suggestions that seem like a reasonable solution:
Although after creating empty
This appears to be failing to resolve the correct yarn version to change the install command https://github.com/aws-amplify/amplify-cli/blob/dev/packages/amplify-cli-core/src/utils/packageManager.ts#L148-L152 Marking as a bug |
amplify build function
when using yarn 3
+1 See also #13377 |
The error happens because Modern Yarn (2,3) doesn't create yarn.lock when running yarn install if it can find a yarn.lock in it's parent directory. Before the PR #13197 gets merged, we can manually do a workaround to create a |
This issue is now closed. Comments on closed issues are hard for our team to see. |
How did you install the Amplify CLI?
npm
If applicable, what version of Node.js are you using?
16.19.1
Amplify CLI Version
12.2.0
What operating system are you using?
Ubuntu
Did you make any manual changes to the cloud resources managed by Amplify? Please describe the changes made.
No
Describe the bug
I used 'amplify add function' to add a lambda, with the default 'Hello World' js option.
Then, I tried to run 'amplify function build', and got this error:
BTW, as a side note, in trying to resolve this issue, I noticed that the package.json, for the lambda function, was in the src subdirectory for the function. Out of curiosity, I tried moving package.json to the parent of src directory, e.g. 'mv package.json ..' . And 'amplify add function' no longer errored out. Not sure if this is the correct resolution..
I believe 'amplify push' also yields the exact same error message as 'amplify add function'. And moving the package.json, for the lambda function, from the src subdir to the parent of the src directory, 'mv package.json ..' also seemed to enable 'amplify push' to work correctly.
Expected behavior
Expection is that the function would be built correctly.
Reproduction steps
See the bug description for the reproducible steps.
Project Identifier
No response
Log output
Additional information
No response
Before submitting, please confirm:
The text was updated successfully, but these errors were encountered: