aws-amplify / amplify-backend

Home to all tools related to Amplify's code-first DX (Gen 2) for building fullstack apps on AWS
Apache License 2.0
185 stars 62 forks source link

NPX AMPX error: could not determine executable to run #2239

Open tostavio opened 4 days ago

tostavio commented 4 days ago

Describe the bug The account configuration steps in the documentation don't work. There is no problem setting the IAM user, the local aws configure sso and other steps. But when I run: npx ampx sandbox or npx ampx sandbox --profile <profile-name>, I get this error:

npx ampx sandbox --profile <profile-name>

I followed the documentation exactly. I reinstalled node 22, cleared my .aws configuration files and started from 0.

I tried adding @aws-amplify/cli globally, but it's still not working.

It would be nice if at least the example worked, it's not enough that it's confusing. Apparently there's some secret step that's not in the documentation? :(

To Reproduce Steps to reproduce the behavior:

  1. Open the terminal and follow these docs steps: https://docs.amplify.aws/react/start/account-setup/.

Expected behavior Something like the docs tell me that will go?

Screenshots N/A

Desktop (please complete the following information):

Additional context Full log here:

0 verbose cli /Users/XXXXXXXX/.nvm/versions/node/v22.11.0/bin/node /Users/XXXXXXXX/.nvm/versions/node/v22.11.0/lib/node_modules/npm/bin/npm-cli.js
1 info using npm@10.9.0
2 info using node@v22.11.0
3 silly config load:file:/Users/XXXXXXXX/.nvm/versions/node/v22.11.0/lib/node_modules/npm/npmrc
4 silly config load:file:/Users/XXXXXXXX/Documents/Repos/amplify-vite/.npmrc
5 silly config load:file:/Users/XXXXXXXX/.npmrc
6 silly config load:file:/Users/XXXXXXXX/.nvm/versions/node/v22.11.0/etc/npmrc
7 verbose title npm exec ampx sandbox
8 verbose argv "exec" "--" "ampx" "sandbox"
9 verbose logfile logs-max:10 dir:/Users/XXXXXXXX/.npm/_logs/2024-11-17T22_58_44_395Z-
10 verbose logfile /Users/XXXXXXXX/.npm/_logs/2024-11-17T22_58_44_395Z-debug-0.log
11 silly logfile start cleaning logs, removing 1 files
12 silly logfile done cleaning log files
13 silly packumentCache heap:4345298944 maxSize:1086324736 maxEntrySize:543162368
14 http fetch GET 200 https://registry.npmjs.org/ampx 139ms (cache revalidated)
15 verbose stack Error: could not determine executable to run
15 verbose stack     at getBinFromManifest (/Users/XXXXXXXX/.nvm/versions/node/v22.11.0/lib/node_modules/npm/node_modules/libnpmexec/lib/get-bin-from-manifest.js:17:23)
15 verbose stack     at exec (/Users/XXXXXXXX/.nvm/versions/node/v22.11.0/lib/node_modules/npm/node_modules/libnpmexec/lib/index.js:202:15)
15 verbose stack     at async Npm.exec (/Users/XXXXXXXX/.nvm/versions/node/v22.11.0/lib/node_modules/npm/lib/npm.js:207:9)
15 verbose stack     at async module.exports (/Users/XXXXXXXX/.nvm/versions/node/v22.11.0/lib/node_modules/npm/lib/cli/entry.js:74:5)
16 verbose pkgid ampx@0.2.2
17 error could not determine executable to run
18 verbose cwd /Users/XXXXXXXX/Documents/Repos/amplify-vite
19 verbose os Darwin 23.6.0
20 verbose node v22.11.0
21 verbose npm  v10.9.0
22 verbose exit 1
23 verbose code 1
24 error A complete log of this run can be found in: /Users/XXXXXXXX/.npm/_logs/2024-11-17T22_58_44_395Z-debug-0.log
tostavio commented 4 days ago

There seems to be a problem with the recent change from amplify to ampx.

Not even a simple npx amplify init works anymore:

➜ npx amplify init

InvalidCommandError: Amplify Gen 2 CLI has been renamed to ampx
Resolution: Run again using the ampx command name:

npx ampx init

Then, running with ampx...

➜ npx ampx init

ampx <command>

Commands:
ampx generate Generates post-deployment artifacts
ampx sandbox Starts the sandbox, observation mode for the deployment of the Amplify backend
yments
ampx pipeline-deploy Command to deploy backends in a customized CI/CD pipeline
e. This command is not intended to be used locally.
ampx configure <command> Configures AWS Amplify
ampx info Generates Amplify troubleshooting information

Options:
--debug Print debug logs to the console [boolean] [default: false]
-h, --help Show help [boolean]
-v, --version Show version number [boolean]

Error: You meant info?

If you've changed the commands, did you updated the documentation and instructions in somewhere?

ykethan commented 3 days ago

Hey @tostavio, thank you for reaching out. The ampx command is utilized in Amplify Gen 2 and amplify in Amplify Gen 1. Refer to documents providing information on Amplify Gen 2 commands and Amplify Gen 1 commands

The error could not determine executable to run typically occurs if the npx ampx command was run outside the root of the project containing the amplify backend packages. Could you verify if the command is being run at the root of your project?

transferring the issue to backend repository