I´m trying to deploy my next.js app into aws Amplify but i keep getting the same error every time I try to deploy it. I was able to deploy the app twice already but when i tried to updated it the third time the console threw me this message:
2021-08-24T21:03:47.297Z [INFO]: Starting SSR Build...
2021-08-24T21:04:41.460Z [ERROR]: Error: Command failed with exit code 1: node_modules/.bin/next build
warn - No ESLint configuration detected. Run next lint to begin setup
Failed to compile.
ModuleNotFoundError: Module not found: Error: Can't resolve 'mock-aws-s3' in '/codebuild/output/src724308348/src/proyect-live/node_modules/@mapbox/node-pre-gyp/lib/util'
> Build error occurred
Error: > Build failed because of webpack errors
at /codebuild/output/src724308348/src/proyect-live/node_modules/next/dist/build/index.js:15:924
at async Span.traceAsyncFn (/codebuild/output/src724308348/src/proyect-live/node_modules/next/dist/telemetry/trace/trace.js:6:584)
info - Using webpack 5. Reason: Enabled by default https://nextjs.org/docs/messages/webpack5
info - Checking validity of types...
info - Creating an optimized production build...
at makeError (/root/.//node_modules/execa/lib/error.js:59:11)
at handlePromise (/root/.//node_modules/execa/index.js:114:26)
at processTicksAndRejections (internal/process/task_queues.js:97:5) {
shortMessage: 'Command failed with exit code 1: node_modules/.bin/next build',
command: 'node_modules/.bin/next build',
exitCode: 1,
signal: undefined,
signalDescription: undefined,
stdout: 'info - Using webpack 5. Reason: Enabled by default https://nextjs.org/docs/messages/webpack5\n' +
'info - Checking validity of types...\n' +
'info - Creating an optimized production build...',
stderr: 'warn - No ESLint configuration detected. Run next lint to begin setup\n' +
'Failed to compile.\n' +
'\n' +
"ModuleNotFoundError: Module not found: Error: Can't resolve 'mock-aws-s3' in '/codebuild/output/src724308348/src/proyect-live/node_modules/@mapbox/node-pre-gyp/lib/util'\n" +
'\n' +
'\n' +
'> Build error occurred\n' +
'Error: > Build failed because of webpack errors\n' +
My package.json looks like this:
{
"name": "proyect-nextjs",
"version": "0.1.0",
"private": true,
"scripts": {
"dev": "next dev",
"build": "next build",
"start": "next start"
},
"dependencies": {
"@material-ui/core": "^4.12.3",
"@material-ui/icons": "^4.11.2",
"@material-ui/lab": "^4.0.0-alpha.60",
"bcrypt": "^5.0.1",
"mongoose": "^5.13.7",
"next": "^11.0.0",
"next-auth": "^3.29.0",
"react": "^17.0.2",
"react-dom": "^17.0.2"
},
"devDependencies": {}
}
I saw in the message that the module mock-aws-s3 "was not found" but i never used this module anywhere and I have no idea where it is comming from.
Has anybody else had this issue or knows what might be causing the problem?