Blocked by constant issues with node-gyp-build
See original GitHub issueBefore opening, please confirm:
- I have installed the latest version of the Amplify CLI (see above), and confirmed that the issue still persists.
- I have searched for duplicate or closed issues.
- I have read the guide for submitting bug reports.
- I have done my best to include a minimal, self-contained set of instructions for consistently reproducing the issue.
- I have removed any sensitive information from my code snippets and submission.
How did you install the Amplify CLI?
npm
If applicable, what version of Node.js are you using?
v16.17.0
Amplify CLI Version
10.3.2
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
Amplify Categories
Not applicable
Amplify Commands
push
Describe the bug
Ever since I updated to the latest version of amplify I have been getting into issues with either symlinks or node-gyp-build.
Lately, I have been using a lambda function that uses web3, however, I have come to so many issues, that I decided to move away from it. Even locally, where this suggestion should’ve worked, it’s not working anymore.
I thought moving away from web3 would have worked. However, I still keep getting into issues when deploying my lambda layer. Here it’s the latest message:
2022-10-30T12:49:40.241Z [INFO]: 🛑 Packaging lambda function failed with the error
Command failed with exit code 127: yarn --no-bin-links --production
warning package.json: No license field
warning No license field
error /codebuild/output/src759146275/src/myapp/amplify/backend/function/cryptoappCommonLayer/lib/nodejs/node_modules/bufferutil: Command failed.
Exit code: 127
Command: node-gyp-build
Arguments:
Directory: /codebuild/output/src759146275/src/myapp/amplify/backend/function/cryptoappCommonLayer/lib/nodejs/node_modules/bufferutil
Output:
/bin/sh: node-gyp-build: command not found
yarn install v1.22.0
[1/4] Resolving packages...
[2/4] Fetching packages...
[3/4] Linking dependencies...
[4/4] Building fresh packages...
info Visit https://yarnpkg.com/en/docs/cli/install for documentation about this command.
2022-10-30T12:49:40.241Z [INFO]: Learn more at: https://docs.amplify.aws/cli/project/troubleshooting/
I don’t have bufferutils on my package so it might be some sort of dependency from one of the packages.
The issue is SO bizarre, that the SAME code, everything EXACTLY the same, merged into 2 branches, but running into 2 different environments (one for prod and another one for dev). Gives a completely different issue
2022-10-31T12:00:37.138Z [INFO]: [0mSuggested configuration for new layer versions:[0m
2022-10-31T12:00:37.138Z [INFO]:
2022-10-31T12:00:37.140Z [INFO]: [0mcryptoappCommonLayer[0m
[0m - Access permissions: Maintain existing permissions[0m
[0m - Description: Updated layer version 2022-10-31T12:00:37.138Z[0m
2022-10-31T12:00:37.140Z [INFO]:
2022-10-31T12:00:56.049Z [WARNING]: ✖ There was an error initializing your environment.
2022-10-31T12:00:56.173Z [INFO]: 🛑 Packaging lambda function failed with the error
Command failed with exit code 127: yarn --no-bin-links --production
warning package.json: No license field
warning No license field
error /codebuild/output/src773265498/src/myapp/amplify/backend/function/cryptoappCommonLayer/lib/nodejs/node_modules/utf-8-validate: Command failed.
Exit code: 127
Command: node-gyp-build
Arguments:
Directory: /codebuild/output/src773265498/src/myapp/amplify/backend/function/cryptoappCommonLayer/lib/nodejs/node_modules/utf-8-validate
Output:
/bin/sh: node-gyp-build: command not found
yarn install v1.22.0
[1/4] Resolving packages...
[2/4] Fetching packages...
[3/4] Linking dependencies...
[4/4] Building fresh packages...
info Visit https://yarnpkg.com/en/docs/cli/install for documentation about this command.
2022-10-31T12:00:56.173Z [INFO]: Learn more at: https://docs.amplify.aws/cli/project/troubleshooting/
Expected behavior
I would expect to be deployed without me worrying if there is a symlink or not. Or the requirement of.a node-gyp-build.
Reproduction steps
I actually not sure how to reproduce this because I am not sure how to narrow down the packaged which needs to be installed in order to get this error.
GraphQL schema(s)
# Put schemas below this line
Project Identifier
No response
Log output
# Put your logs below this line
Additional information
No response
Issue Analytics
- State:
- Created a year ago
- Reactions:1
- Comments:23 (8 by maintainers)
@linglongguzi the suggestion @josefaidt mentioned above works for me. You need to yarn in the src folder (I’m using node 16).
However, still doesn’t work in the console. I’m waiting @josefaidt to give me some guidance here.
Hi @josefaidt
Locally this indeed solved the problem, however, Amplify hosting still breaking.
I tried modifying the
amplify.yml
, and i didn’t see any changes, then I tried to edit it through the build settings, and the problem still persists.Here is my
amplify.yml
. However, i don’t think its triggering the prebuildWhen the build happens I still get this in the “Cloning repository” phase:
Then I still get the ERROR.
Did you manage to get it working? I’m a bit clueless on what to do next.