- Newest
- Most votes
- Most comments
i've found the solution, i've set NODE_ENV environment variable to "production", which broke the build. as soon as i removed the environment variable, it worked right away!
Based on your issue with deploying a NextJS TypeScript application on AWS Amplify, I can see a few potential problems with your configuration.
First, there appears to be a discrepancy in your build process. While you're installing TypeScript and @types/node in the preBuild phase, the error suggests these packages aren't being properly recognized during the deployment process. This could be because:
-
The packages are being installed in the preBuild phase, but the build system might be checking for TypeScript before these commands complete.
-
You're running both
npm ciandnpm installin your build process, which might be causing conflicts. Thenpm cicommand is designed to install dependencies exactly as specified in your package-lock.json, whilenpm installmight modify them.
Here are some suggestions to fix this issue:
- Modify your amplify.yml to ensure TypeScript dependencies are properly installed:
version: 1
applications:
- appRoot: client
frontend:
phases:
preBuild:
commands:
- npm ci
build:
commands:
- npm run build
artifacts:
baseDirectory: .next
files:
- '**/*'
cache:
paths:
- node_modules/**/*
-
Make sure TypeScript and @types/node are included in your package.json as devDependencies rather than trying to install them during the build process.
-
Verify that your tsconfig.json is properly configured and located in the correct directory (in the client folder).
-
If you're using a monorepo setup, ensure that your TypeScript configuration is properly set up for the client application specifically.
The error message suggests that Amplify is looking for TypeScript dependencies but can't find them, despite your attempt to install them during the build process. By including these dependencies directly in your package.json, you can ensure they're properly installed and recognized during the build.
Sources
my amplify deploy app problem | AWS re:Post
Maximum schema version supported is 43.x.x, but found 45.0.0 - Amplify Sandbox Deployment Error | AWS re:Post
Relevant content
- asked 2 years ago
- AWS OFFICIALUpdated 4 years ago
