Skip to content

ampx sandbox fails with [email protected] (ENOENT: no such file or directory) #2849

@zacnel909

Description

@zacnel909

Environment information

System:
  OS: macOS 14.6.1
  CPU: (8) arm64 Apple M2
  Memory: 173.02 MB / 8.00 GB
  Shell: /bin/zsh
Binaries:
  Node: 22.13.1 - ~/.nvm/versions/node/v22.13.1/bin/node
  Yarn: 1.22.22 - ~/.nvm/versions/node/v22.13.1/bin/yarn
  npm: 10.9.2 - ~/.nvm/versions/node/v22.13.1/bin/npm
  pnpm: undefined - undefined
NPM Packages:
  @aws-amplify/auth-construct: 1.8.1
  @aws-amplify/backend: 1.16.1
  @aws-amplify/backend-ai: Not Found
  @aws-amplify/backend-auth: 1.7.1
  @aws-amplify/backend-cli: 1.7.2
  @aws-amplify/backend-data: 1.6.1
  @aws-amplify/backend-deployer: 2.1.1
  @aws-amplify/backend-function: 1.14.1
  @aws-amplify/backend-output-schemas: 1.6.0
  @aws-amplify/backend-output-storage: 1.3.1
  @aws-amplify/backend-secret: 1.4.0
  @aws-amplify/backend-storage: 1.4.1
  @aws-amplify/cli-core: 2.1.1
  @aws-amplify/client-config: 1.7.0
  @aws-amplify/data-construct: 1.16.1
  @aws-amplify/data-schema: 1.21.0
  @aws-amplify/deployed-backend-client: 1.7.0
  @aws-amplify/form-generator: 1.2.1
  @aws-amplify/model-generator: 1.2.0
  @aws-amplify/platform-core: 1.9.0
  @aws-amplify/plugin-types: 1.10.1
  @aws-amplify/sandbox: 2.1.2
  @aws-amplify/schema-generator: 1.4.0
  @aws-cdk/toolkit-lib: 0.3.2
  aws-amplify: 6.15.0
  aws-cdk-lib: 2.189.1
  typescript: 5.8.3
npm warn exec The following package was not found and will be installed: [email protected]
No AWS environment variables
No CDK environment variables

Describe the bug

I run

npm create amplify@latest
npx ampx sandbox

and receive the following error:

[ERROR] [BackendBuildError] Unable to deploy due to CDK Assembly Error
  ∟ Caused by: [_AssemblyError] Assembly builder failed
    ∟ Caused by: [Error] ENOENT: no such file or directory, open '[project_root]/node_modules/@aws-amplify/backend-output-schemas/lib/index.js?tsx-namespace=1749693106808'

After troubleshooting, I found that this only happens when using [email protected] or newer.
Pinning tsx to 4.19.4 in package.json resolves the issue.

This breaks both new and existing projects if tsx is upgraded.

Reproduction steps

  1. Open a terminal and create a new directory:
mkdir amplify-tsx-test
cd amplify-tsx-test
  1. Initialize a new Amplify Gen 2 project:
npm create amplify@latest
  1. Start the Amplify local sandbox:
npx ampx sandbox

4.Observe the error:

[ERROR] [BackendBuildError] Unable to deploy due to CDK Assembly Error
  ∟ Caused by: [_AssemblyError] Assembly builder failed
    ∟ Caused by: [Error] ENOENT: no such file or directory, open '[project_root]/node_modules/@aws-amplify/backend-output-schemas/lib/index.js?tsx-namespace=...'

Workaround:
Pin tsx to 4.19.4 in your package.json, run npm install, and the error is resolved.

Metadata

Metadata

Assignees

No one assigned

    Labels

    dependencyIssue related to upstream dependency

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions