@nuxt/docs-nightly 5.0.0-29623388.fa68efdd → 5.0.0-29624499.ea205512
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -23,11 +23,15 @@ Discover the Node.js server preset with Nitro to deploy on any Node hosting.
|
|
|
23
23
|
When running `nuxt build` with the Node server preset, the result will be an entry point that launches a ready-to-run Node server.
|
|
24
24
|
|
|
25
25
|
```bash [Terminal]
|
|
26
|
-
node .output/server/index.mjs
|
|
26
|
+
NODE_ENV=production node .output/server/index.mjs
|
|
27
27
|
```
|
|
28
28
|
|
|
29
29
|
This will launch your production Nuxt server that listens on port 3000 by default.
|
|
30
30
|
|
|
31
|
+
::important
|
|
32
|
+
Set `NODE_ENV=production` when running the server. Some dependencies (notably Vue Router) only strip development-only warnings when this is set, so leaving it unset can flood your logs with messages like `[Vue Router warn]: No match found for location with path …` on unmatched routes.
|
|
33
|
+
::
|
|
34
|
+
|
|
31
35
|
It respects the following runtime environment variables:
|
|
32
36
|
|
|
33
37
|
- `NITRO_PORT` or `PORT` (defaults to `3000`)
|
|
@@ -49,6 +53,9 @@ module.exports = {
|
|
|
49
53
|
exec_mode: 'cluster',
|
|
50
54
|
instances: 'max',
|
|
51
55
|
script: './.output/server/index.mjs',
|
|
56
|
+
env: {
|
|
57
|
+
NODE_ENV: 'production',
|
|
58
|
+
},
|
|
52
59
|
},
|
|
53
60
|
],
|
|
54
61
|
}
|
|
@@ -49,7 +49,7 @@ Since `.env` files are not used in production, you must explicitly set environme
|
|
|
49
49
|
|
|
50
50
|
* You can pass the environment variables as arguments using the terminal:
|
|
51
51
|
|
|
52
|
-
`$ DATABASE_HOST=mydatabaseconnectionstring node .output/server/index.mjs`
|
|
52
|
+
`$ NODE_ENV=production DATABASE_HOST=mydatabaseconnectionstring node .output/server/index.mjs`
|
|
53
53
|
|
|
54
54
|
* You can set environment variables in shell configuration files like `.bashrc` or `.profile`.
|
|
55
55
|
|
|
@@ -66,7 +66,7 @@ For local production preview purpose, we recommend using [`nuxt preview`](/docs/
|
|
|
66
66
|
Or you could pass the environment variables as arguments using the terminal. For example, on Linux or macOS:
|
|
67
67
|
|
|
68
68
|
```bash [Terminal]
|
|
69
|
-
DATABASE_HOST=mydatabaseconnectionstring node .output/server/index.mjs
|
|
69
|
+
NODE_ENV=production DATABASE_HOST=mydatabaseconnectionstring node .output/server/index.mjs
|
|
70
70
|
```
|
|
71
71
|
|
|
72
72
|
Note that for a purely static site, it is not possible to set runtime configuration config after your project is prerendered.
|
|
@@ -40,5 +40,5 @@ The `preview` command starts a server to preview your Nuxt application after run
|
|
|
40
40
|
This command sets `process.env.NODE_ENV` to `production`. To override, define `NODE_ENV` in a `.env` file or as command-line argument.
|
|
41
41
|
|
|
42
42
|
::note
|
|
43
|
-
For convenience, in preview mode, your [`.env`](/docs/4.x/directory-structure/env) file will be loaded into `process.env`. (However, in production you will need to ensure your environment variables are set yourself. For example, with Node.js 20+ you could do this by running `node --env-file .env .output/server/index.mjs` to start your server.)
|
|
43
|
+
For convenience, in preview mode, your [`.env`](/docs/4.x/directory-structure/env) file will be loaded into `process.env`. (However, in production you will need to ensure your environment variables are set yourself. For example, with Node.js 20+ you could do this by running `NODE_ENV=production node --env-file .env .output/server/index.mjs` to start your server.)
|
|
44
44
|
::
|