Encountered an issue while deploying my NextJS app to AWS using the serverless framework.
After running npx serverless
in my Next JS app directory, I received the following error:
$ npx serverless
error:
Error: Command failed with ENOENT: node_modules/.bin/next build
spawn node_modules/.bin/next ENOENT
'node_modules\.bin\next' is not recognized as an internal or external command,
operable program or batch file.
at notFoundError (C:\Users\patel\.serverless\components\registry\npm\@sls-next\ [email protected] \node_modules\@sls-next\serverless-component\node_modules\cross-spawn\lib\enoent.js:6:26)
at verifyENOENT (C:\Users\patel\.serverless\components\registry\npm\@sls-next\ [email protected] \node_modules\@sls-next\serverless-component\node_modules\cross-spawn\lib\enoent.js:40:16)
at ChildProcess.cp.emit (C:\Users\patel\.serverless\components\registry\npm\@sls-next\ [email protected] \node_modules\@sls-next\serverless-component\node_modules\cross-spawn\lib\enoent.js:27:25)
at Process.ChildProcess._handle.onexit (internal/child_process.js:277:12) {
code: 'ENOENT',
errno: 'ENOENT',
syscall: 'spawn node_modules/.bin/next',
path: 'node_modules/.bin/next',
spawnargs: [ 'build' ],
originalMessage: 'spawn node_modules/.bin/next ENOENT',
shortMessage: 'Command failed with ENOENT: node_modules/.bin/next build\n' +
'spawn node_modules/.bin/next ENOENT',
command: 'node_modules/.bin/next build',
exitCode: undefined,
signal: undefined,
signalDescription: undefined,
stdout: '',
stderr: "'node_modules\\.bin\\next' is not recognized as an internal or external command,\r\n" +
'operable program or batch file.',
failed: true,
timedOut: false,
isCanceled: false,
killed: false
}
3s » myNextApplication » Error: Command failed with ENOENT: node_modules/.bin/next build
spawn node_modules/.bin/next ENOENT
'node_modules\.bin\next' is not recognized as an internal or external command,
operable program or batch file.
Utilizing aws configure
for setting up my AWS credentials.
The content of my serverless.yml
file is as follows:
myNextApplication:
component: "@sls-next/<a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="423127303427302e2731316f212d2f322d2c272c3602736c737a6c72">[email protected]</a>"
Seeking assistance on deploying my app to AWS cloud using a serverless framework.
Thank you.