cloudflare / cloudflare/templates

Deployment fails during application creation when using template because assets have not been built

Open
#699 2 comments 0 reactions 0 assignees View on GitHub
bug
Dominant language
TypeScript
Stars
2.1k
Forks
1k
Avg merge
17h 44m
Merged PRs (30d)
10

Description

### What versions & operating system are you using?

Node v22.12.0, Ubuntu 24.04.2, Wrangler 4.19.2

### Please provide a link to a minimal reproduction

_No response_

### Describe the Bug

When running `npm create cloudflare` using one of the templates which require a build step, in this case `vite-react-template`, it asks you if you want to deploy your application and if you select `yes` it runs `npm run deploy` but this fails because we have not run `npm run build` so the assets aren't actually there.

I would expect it to automatically run the build script before the deploy script.

### Please provide any relevant error logs

```
ewan@ewan:/media/ewan/ssd/projects$ npm create cloudflare@latest -- --template=cloudflare/templates/vite-react-template

> npx
> create-cloudflare --template=cloudflare/templates/vite-react-template

────────────────────────────────────────────────────────────────────────────────
👋 Welcome to create-cloudflare v2.49.1!
🧡 Let's get started.
📊 Cloudflare collects telemetry about your usage of Create-Cloudflare.

Learn more at: https://github.com/cloudflare/workers-sdk/blob/main/packages/create-cloudflare/telemetry.md
────────────────────────────────────────────────────────────────────────────────

╭ Create an application with Cloudflare Step 1 of 3

├ In which directory do you want to create your application?
│ dir ./jolly-math-2210

├ What would you like to start with?
│ category Template from a GitHub repo

├ What's the url of git repo containing the template you'd like to use?
│ repository cloudflare/templates/vite-react-template

├ Cloning template from: cloudflare/templates/vite-react-template

├ template cloned and validated

├ Copying template files
│ files copied to project directory

├ Installing dependencies
│ installed via `npm install`

╰ Application created

╭ Configuring your application for Cloudflare Step 2 of 3

├ Installing wrangler A command line tool for building Cloudflare Workers
│ installed via `npm install wrangler --save-dev`

├ Adding Wrangler files to the .gitignore file
│ updated .gitignore file

├ Generating types for your application
│ generated to `./worker-configuration.d.ts` via `npm run cf-typegen`

├ Installing @types/node
│ installed via npm

├ Do you want to use git for version control?
│ yes git

├ Initializing git repo
│ initialized git

├ Committing new files
│ git commit

╰ Application configured

╭ Deploy with Cloudflare Step 3 of 3

├ Do you want to deploy your application?
│ yes deploy via `npm run deploy`

├ Logging into Cloudflare checking authentication status
│ logged in

├ Selecting Cloudflare account retrieving accounts
│ account emailremoved@gmail.com's Account

> vite-react-template@0.0.0 deploy
> wrangler deploy

⛅️ wrangler 4.19.2
───────────────────

✘ [ERROR] The directory specified by the "assets.directory" field in your configuration file does not exist:

/media/ewan/ssd/projects/jolly-math-2210/dist/client

🪵 Logs were written to "/home/ewan/.config/.wrangler/logs/wrangler-2025-06-12_10-09-11_374.log"
╰ ERROR Error

```

Contributor guide

Open the contributing guide

Research direction

Start with the vite-react-template application-creation flow and its npm run deploy and npm run build scripts, then inspect how the create-cloudflare deploy prompt invokes them. Reproduce the issue with the template and verify that choosing deployment after creation builds the assets so the assets.directory path exists and deployment succeeds.

Written by the indexing model from the issue text.

Assessment

Tech stack
nodejs, react, typescript, vite
Domain
build-system, cloud, devops
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.