amplify-cli
amplify-cli copied to clipboard
At the end of the push process: ENOENT no such file or directory, stat
How did you install the Amplify CLI?
pnpm -g
If applicable, what version of Node.js are you using?
v18.19.0
Amplify CLI Version
12.10.1
What operating system are you using?
mac
Did you make any manual changes to the cloud resources managed by Amplify? Please describe the changes made.
No manual changes made
Describe the bug
I use PNPM. Just switched from cli v10.7.3 to v12.10.1.
I push my change, everything is push and updated then at the end, just before the post-push hooks, I always got this error: 🛑 ENOENT: no such file or directory, stat '/Users/myUser/Documents/Dev/myProject/packages/frontend/amplify/backend/function/myFonction/src/node_modules/@types/aws-lambda'
The function got the @types/aws-lambda installed as devDependencies.
The problem is that the cli wants to update everything again on the next push as I suppose it didn't save it was done.
I already tried to change the amplify.state of the function with:
"scripts": {
"build": "pnpm i"
}
Expected behavior
No error message and no redeploy everything each time.
Reproduction steps
- amplify push --y
Project Identifier
3d4f4c99-5447-4f34-9050-9d0fe8e50c74
Log output
# Put your logs below this line
Additional information
No response
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.
Hey @SebSchwartz, thank you for reaching. Could you try changing directory into amplify/backend/function/<function-name>/
, remove the node_modules and running pnpm i
, then at the root of the project run amplify push
does this throw a similar error message?
Hi @ykethan , Already tried to remove all node_modules with 'npx npkill' package then pnpm i at the root folder. Maybe what's missing in my explanation is that i'm in a pnpm workspace. Here is the workspace configuration:
packages:
# include packages in subfolders (e.g. apps/ and packages/)
- 'apps/*'
- 'packages/*'
- 'tools/*'
- 'packages/webapp/amplify/backend/*'
- 'packages/webapp/amplify/backend/custom/*'
- 'packages/webapp/amplify/backend/function/*/src'
- 'packages/webapp/amplify/backend/function/layer1/lib/nodejs'
- 'packages/webapp/amplify/backend/function/layer2/lib/nodejs'
So the steps described (removing all modules then retry) doesn't work :(
Hey @SebSchwartz, thank you for the information. Amplify CLI unfortunately does not handle symlinks well when it downloads and unzips your backend state (e.g. on amplify pull
), which is a popular approach for linking dependencies between workspaces. In the case of pnpm it will load dependencies into its store at the workspace root, and symlink to each workspace package in their relative node_modules
directory. While this error seems odd because this is a types package in question, can you try removing the workspace paths from your pnpm-workspace.yaml
file?
Closing the issue due to inactivity. Do reach out to us if you require any assistance.
This issue is now closed. Comments on closed issues are hard for our team to see. If you need more assistance, please open a new issue that references this one.