forked from vercel/next.js
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add check for writeable directory (vercel#3370)
* Add check for writeable directory Followup of vercel/vercel#175 * Add link to docs
- Loading branch information
1 parent
57c6f80
commit 8cd6bd3
Showing
3 changed files
with
51 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
# 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](https://github.com/zeit/next.js#custom-server-and-routing) in development mode on a production server, for example, [now.sh](https://zeit.co) which [doesn't allow you to write to the filesystem after your app is built](https://zeit.co/docs/deployment-types/node#file-system-specifications). | ||
|
||
#### 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: | ||
|
||
```json | ||
{ | ||
"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` | ||
|
||
```js | ||
const dev = process.env.NODE_ENV !== 'production' | ||
const app = next({ dev }) | ||
``` | ||
|
||
### Useful Links | ||
|
||
- [Custom Server documentation + examples](https://github.com/zeit/next.js#custom-server-and-routing) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters