sst / ion

SST v3
https://sst.dev
MIT License
1.88k stars 221 forks source link

Cannot run `sst dev` in NextJS app #1133

Closed radokristof closed 3 days ago

radokristof commented 3 days ago

I am unable to use sst dev, because I always get this error:

 ✕  The dev command for this process does not look right. Check your dev script in package.json to make sure it is simply starting your process and not running `sst dev`. More info here: https://ion.sst.dev/docs/reference/cli/#dev

The package.json relevant parts:

"scripts": {
    "build": "next build",
    "dev": "sst dev",
    "lint": "next lint",
    "start": "next start",
    "test": "vitest --passWithNoTests",
  },

This is a nextjs app, sst config was created by sst init.

SST version: 3.1.36 SST is installed via npm

I am running it with WSL but it fails similarly on macOS too.

What am I doing wrong?

paperstick commented 3 days ago

The command specified in package.json for running NextJS in dev mode should look like this:

"scripts": {
    "dev": "next dev",
},

And then you will be able to run it through sst with npx sst dev command.

radokristof commented 3 days ago

Thank you, this fixed it! Interestingly, sst init did this change a few versions back...