You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
If your project contains a `package.json` file with a `build`[script](https://docs.npmjs.com/misc/scripts), and no `now.json` configuration, it is expected to output its static files into a directory named `public`, at the root of the project, when the `build`[script](https://docs.npmjs.com/misc/scripts) is executed.
, you must use the default output directory provided by the framework.
24
+
</Note>
25
+
14
26
You are seeing this error because your setup did not satisfy the above constraint.
15
27
16
28
To resolve this error, configure your project to place its static output files into a `public` directory, at the root of your project, when the `build`[script](https://docs.npmjs.com/misc/scripts) from your `package.json` file is invoked.
@@ -20,23 +32,39 @@ For example, this is how your `package.json` file might look:
20
32
```json
21
33
{
22
34
"scripts": {
23
-
"build": "my-framework build"
35
+
"build": "[my-framework] build"
24
36
}
25
37
}
26
38
```
27
39
40
+
<Caption>
41
+
An example <InlineCode>build</InlineCode> script in a{''}
42
+
<InlineCode>package.json</InlineCode> file.
43
+
</Caption>
44
+
28
45
If you are seeing this error with a similar `build` script already, you may need to adjust the command to direct its static output files into the `public` directory instead.
29
46
47
+
<Note>
48
+
Consult your framework's documentation to understand how to specify the build
49
+
output directory.
50
+
</Note>
51
+
30
52
Depending on your framework, the option for this might be called `--output`, `--out`, `--output-dir` or similar:
31
53
32
54
```json
33
55
{
34
56
"scripts": {
35
-
"build": "my-framework build --output public"
57
+
"build": "[my-framework] build --output public"
36
58
}
37
59
}
38
60
```
39
61
62
+
<Caption>
63
+
An example <InlineCode>build</InlineCode> script in a{''}
64
+
<InlineCode>package.json</InlineCode> file that specifies the output
65
+
directory.
66
+
</Caption>
67
+
40
68
Once you have done this, the error will disappear since the output will be the expected directory, `public`.
41
69
42
70
## Missing Build Script
@@ -48,11 +76,17 @@ When properly configured, your `package.json` file would look similar to this:
48
76
```json
49
77
{
50
78
"scripts": {
51
-
"build": "my-framework build --output public"
79
+
"build": "[my-framework] build --output public"
52
80
}
53
81
}
54
82
```
55
83
84
+
<Caption>
85
+
An example <InlineCode>build</InlineCode> script in a{''}
86
+
<InlineCode>package.json</InlineCode> file that specifies the output
87
+
directory.
88
+
</Caption>
89
+
56
90
Once you have defined the `build`[script](https://docs.npmjs.com/misc/scripts), this error will disappear. Furthermore, it will not be displayed if you are using `package.json` purely to provide dependencies for your Serverless Functions located inside the `api` directory.
Copy file name to clipboardExpand all lines: pages/docs/v2/build-step.mdx
+7-1Lines changed: 7 additions & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -18,13 +18,19 @@ export const meta = {
18
18
title: 'Build Step',
19
19
description: 'Providing ZEIT Now with a build step.',
20
20
editUrl: 'pages/docs/v2/build-step.mdx',
21
-
lastEdited: '2019-10-22T15:47:35.000Z'
21
+
lastEdited: '2019-10-30T10:56:45.000Z'
22
22
}
23
23
24
24
When you make a deployment with ZEIT Now, the first step is the build step. Now recognizes a custom `build` script, with that build script outputting your app into the `public` directory.
25
25
26
26
Now also supports optimized frameworks that only need to be created and then they are ready to deploy with [Now CLI](/download) from the terminal.
you must use the default output directory provided by the framework.
32
+
</Note>
33
+
28
34
You are also able to use [environment variables](#using-environment-variables-and-secrets) (including secrets) in your builds if you do not want to hardcode values for the build.
0 commit comments