Missing Public Directory

If your project contains a package.json file with a build script, 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 is executed.

Warning: If you are using an optimized framework, you must use the default output directory provided by the framework.

You are seeing this error because your setup did not satisfy the above constraint.

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 from your package.json file is invoked.

For example, this is how your package.json file might look:

{
  "scripts": {
    "build": "[my-framework] build"
  }
}

An example build script in a package.json file.

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.

Note: Consult your framework's documentation to understand how to specify the build output directory.

Depending on your framework, the option for this might be called --output, --out, --output-dir or similar:

{
  "scripts": {
    "build": "[my-framework] build --output public"
  }
}

An example build script in a package.json file that specifies the output directory.

Once you have done this, the error will disappear since the output will be the expected directory, public.

Missing Build Script

If your project contains a package.json file, no api directory, and no now.json configuration, it is expected to provide a build script that performs a static build of your frontend and outputs it to a public directory at the root of your project.

When properly configured, your package.json file would look similar to this:

{
  "scripts": {
    "build": "[my-framework] build --output public"
  }
}

An example build script in a package.json file that specifies the output directory.

Once you have defined the build script, 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.

Platform Version Detection

Now CLI will automatically upgrade your deployment to the latest platform version if you create a new project or if your project meets certain criteria. In order for this to work, you must:

  • Remove any Dockerfile.
  • Remove the type property from your now.json file.
  • Remove the start script from your package.json file.
  • Remove the server.js file from the root of your project.

It is possible to opt out of this behavior by creating a now.json file with a version property.

If you are yet to upgrade to the latest platform version, please read our upgrade guide.

Green Energy Policy

ZEIT works with multiple cloud partners in order to provide services to end users.

The Serverless approach is an energy-efficient alternative to traditional servers because your code runs only on-demand.

For more information on our cloud partners' Green energy policies, we recommend viewing their documentation: