Max Liu
06/07/2022, 1:48 AMbuild
command of this example: https://github.com/serverless-stack/serverless-stack/tree/master/examples/nextjs-app I just simply pull the folder and did npm install
, then npm buld
. It gives me this error:
> nextjs-app@0.0.0 build
> sst build
Using stage: service-deployer
Preparing your SST app
Synthesizing CDK
Building Next.js site frontend
Error: Command failed with ENOENT: ./node_modules/.bin/next build
spawn ./node_modules/.bin/next ENOENT
at Process.ChildProcess._handle.onexit (node:internal/child_process:283:19)
at onErrorNT (node:internal/child_process:478:16)
at processTicksAndRejections (node:internal/process/task_queues:83:21) {
errno: -2,
code: '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',
escapedCommand: '"./node_modules/.bin/next" build',
exitCode: undefined,
signal: undefined,
signalDescription: undefined,
stdout: '',
stderr: '',
failed: true,
timedOut: false,
isCanceled: false,
killed: false
}
There was a problem building the "Site" NextjsSite.
There was an error synthesizing your app.
I’m using node@v16.15.1Max Liu
06/07/2022, 1:49 AMFrank
Max Liu
06/07/2022, 1:50 AMMax Liu
06/07/2022, 1:50 AMMax Liu
06/07/2022, 1:56 AMnpm run build
command inside the frontend folder, and it’s working, so I guess the issue is with sst’s build command?Scott
06/07/2022, 5:09 AMbefore_build:
- cd frontend && npm install
Max Liu
06/07/2022, 5:29 AMMax Liu
06/07/2022, 5:29 AMScott
06/07/2022, 5:30 AMMax Liu
06/07/2022, 5:31 AMMax Liu
06/07/2022, 5:31 AMMax Liu
06/07/2022, 5:57 AMMax Liu
06/07/2022, 12:43 PMyarn
from npm
and it’s all good now! Thx again guys! 🙏