rsnext/errors/build-dir-not-writeable.md
stefanprobst 279ae19c7e
docs: update links to docs site (#14305)
this updates some links to the docs site to their new location
2020-06-18 09:54:07 +00:00

1.1 KiB

Build directory not writeable

Why This Error Occurred

The filesystem does not allow writing to the specified directory. A common cause for this error is starting a custom server in development mode on a production server, for example, Vercel which doesn't allow you to write to the filesystem after your app is built.

Possible Ways to Fix It

When using a custom server with a server file, for example called server.js, make sure you update the scripts key in package.json to:

{
  "scripts": {
    "dev": "node server.js",
    "build": "next build",
    "start": "NODE_ENV=production node server.js"
  }
}

and the custom server starts Next in production mode when NODE_ENV is production

const dev = process.env.NODE_ENV !== 'production'
const app = next({ dev })