Hi, I”m having some trouble with the `build` comma...
# help
m
Hi, I”m having some trouble with the
build
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:
Copy code
> 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.1
This is a screen shot of my commands:
f
Hey @Max Liu did u npm install ur Next.js app?
m
no… let me quickly try that
Just did, but the same error…
I did another test: Run
npm run build
command inside the frontend folder, and it’s working, so I guess the issue is with sst’s build command?
s
@Max Liu, with the npm install, I'm unsure whether seed will run that, try adding a seed.yml file with the following:
Copy code
before_build:
    - cd frontend && npm install
m
Thank you @Scott for the response! This is not seed, just my local env.
I think if you run this example locally with node16.15.1, you will get the same error
s
Ahh I see, my mistake, good to know
m
no worries at all
thank you for looking into this issue!
Has anyone run stt with next.js successfully? Do you mind sharing your node version? and sst, next.js version?
I changed to
yarn
from
npm
and it’s all good now! Thx again guys! 🙏