Cannot (re)deploy my site today. build failed could not copy file

  • Project name: kinopio-client
  • build log/screenshot included below

I can’t build my project today, the same project was building without issue. Even when I try and redeploy the currently running deployment (with and without cache), I hit the same build error that sounds like it’s related to an SPA plugin, or a file system error. My project does use netlify functions and I noticed that there was a deployment issue related to that (https://x.com/netlifystatus/status/1998085304994124061) but it was marked as resolved earlier today before I had this issue.

`Netlify

4:23:38 PM: Netlify Build                                                 
4:23:38 PM: ────────────────────────────────────────────────────────────────
4:23:38 PM: ​
4:23:38 PM: ❯ Version
4:23:38 PM:   @netlify/build 35.5.5
4:23:38 PM: ​
4:23:38 PM: ❯ Flags
4:23:38 PM:   accountId: 5cdd7d03c5f6f70b8fda2b20
4:23:38 PM:   baseRelDir: true
4:23:38 PM:   buildId: 693741c6b78a5d4d79b3e170
4:23:38 PM:   deployId: 693741c6b78a5d4d79b3e172
4:23:38 PM: ​
4:23:38 PM: ❯ Current directory
4:23:38 PM:   /opt/build/repo
4:23:38 PM: ​
4:23:38 PM: ❯ Config file
4:23:38 PM:   /opt/build/repo/netlify.toml
4:23:38 PM: ​
4:23:38 PM: ❯ Context
4:23:38 PM:   production
4:23:38 PM: ​
4:23:38 PM: Build command from Netlify app                                
4:23:38 PM: ────────────────────────────────────────────────────────────────
4:23:38 PM: ​
4:23:38 PM: $ npm run build
4:23:39 PM: > kinopio-client@1.0.0 build
4:23:39 PM: > vite-ssg build
4:23:40 PM: [vite-ssg] Build for client...
4:23:40 PM: [baseline-browser-mapping] The data in this module is over two months old.  To ensure accurate Baseline data, please update: `npm i baseline-browser-mapping@latest -D`
4:23:40 PM: vite v6.4.1 building for production...
4:23:40 PM: transforming...
4:23:43 PM: ✓ 606 modules transformed.
4:23:43 PM: ✗ Build failed in 3.56s
4:23:43 PM: node:internal/process/promises:394
4:23:43 PM:     triggerUncaughtException(err, true /* fromPromise */);
4:23:43 PM:     ^
4:23:43 PM: [create-spa-app] ENOENT: no such file or directory, copyfile '/opt/build/repo/dist/index.html' -> '/opt/build/repo/dist/app.html'
4:23:43 PM:     at Object.copyFileSync (node:fs:3086:11)
4:23:43 PM:     at Object.closeBundle (file:///opt/build/repo/node_modules/.vite-temp/vite.config.js.timestamp-1765229020156-d16940f675d2b.mjs:51:10)
4:23:43 PM:     at Object.handler (file:///opt/build/repo/node_modules/vite/dist/node/chunks/dep-D4NMHUTW.js:46558:15)
4:23:43 PM:     at file:///opt/build/repo/node_modules/rollup/dist/es/shared/node-entry.js:22428:40
4:23:43 PM:     at async Promise.all (index 0)
4:23:43 PM:     at async PluginDriver.hookParallel (file:///opt/build/repo/node_modules/rollup/dist/es/shared/node-entry.js:22330:17)
4:23:43 PM:     at async file:///opt/build/repo/node_modules/rollup/dist/es/shared/node-entry.js:23327:17
4:23:43 PM:     at async catchUnfinishedHookActions (file:///opt/build/repo/node_modules/rollup/dist/es/shared/node-entry.js:22782:16)
4:23:43 PM:     at async rollupInternal (file:///opt/build/repo/node_modules/rollup/dist/es/shared/node-entry.js:23306:5)
4:23:43 PM:     at async buildEnvironment (file:///opt/build/repo/node_modules/vite/dist/node/chunks/dep-D4NMHUTW.js:46235:14) {
4:23:43 PM:   errno: -2,
4:23:43 PM:   code: 'PLUGIN_ERROR',
4:23:43 PM:   syscall: 'copyfile',
4:23:43 PM:   path: '/opt/build/repo/dist/index.html',
4:23:43 PM:   dest: '/opt/build/repo/dist/app.html',
4:23:43 PM:   pluginCode: 'ENOENT',
4:23:43 PM:   plugin: 'create-spa-app',
4:23:43 PM:   hook: 'closeBundle'
4:23:43 PM: }
4:23:43 PM: Node.js v22.14.0
4:23:43 PM: ​
4:23:43 PM: "build.command" failed                                        
4:23:43 PM: ────────────────────────────────────────────────────────────────
4:23:43 PM: ​
4:23:43 PM:   Error message
4:23:43 PM:   Command failed with exit code 1: npm run build (https://ntl.fyi/exit-code-1)
4:23:43 PM: ​
4:23:43 PM:   Error location
4:23:43 PM:   In Build command from Netlify app:
4:23:43 PM:   npm run build
4:23:43 PM: ​
4:23:43 PM:   Resolved config
4:23:43 PM:   build:
4:23:43 PM:     command: npm run build
4:23:43 PM:     commandOrigin: ui
4:23:43 PM:     edge_functions: /opt/build/repo/netlify/edge-functions
4:23:43 PM:     publish: /opt/build/repo/dist
4:23:43 PM:     publishOrigin: ui
4:23:44 PM: Failed during stage 'building site': Build script returned non-zero exit code: 2 (https://ntl.fyi/exit-code-2)
4:23:44 PM: Build failed due to a user error: Build script returned non-zero exit code: 2
4:23:44 PM: Failing build: Failed to build site
4:23:44 PM: Finished processing build request in 24.642s

img showing that redeploying the currently running build also fails

@pketh

So that top failed deploy, is the same as the prior failed deploy.

The build is failing when it tries to copy a /dist/index.html file and doesn’t find it.

Run the build locally, with the same version of the repository, (with the build command, not develop command), and ensure the /dist/index.html file exists.

when I run npm run build locally it builds correctly as it used to

```
~/D/kinopio-client (drawing-erase-strokes|✔) $ npm run build 16:51:15

kinopio-client@1.0.0 build
vite-ssg build

[vite-ssg] Build for client…
[baseline-browser-mapping] The data in this module is over two months old. To ensure accurate Baseline data, please update: npm i baseline-browser-mapping@latest -D
vite v6.4.1 building for production…
✓ 1005 modules transformed.
dist/registerSW.js 0.13 kB
dist/manifest.webmanifest 0.18 kB
dist/index.html 3.66 kB │ gzip: 1.28 kB
dist/assets/dog-2-DcCPqzCm.webp 4.74 kB
dist/assets/pot-sitting-B6zZFV6o.webp 4.90 kB
dist/assets/pot-standing-side-X_lqRvCm.webp 4.99 kB
dist/assets/dog-1-Db7QVFvP.webp 5.28 kB
dist/assets/ivy-DcNwM6nq.webp 5.35 kB
dist/assets/icon-CBP04nIB.webp 5.53 kB
dist/assets/pot-hanging-BUcvTrNz.webp 5.79 kB
dist/assets/leaves-BcUmC-Tm.webp 6.22 kB
dist/assets/spooky-eyes-BqayL5Bf.webp 6.67 kB
dist/assets/flowers-01-BuuKjkhH.webp 7.99 kB
dist/assets/flowers-02-CrIXWCKH.webp 8.27 kB
dist/assets/tombstone-CwKfJFyc.webp 8.51 kB
dist/assets/spooky-witch-BVbWabZa.webp 9.18 kB
dist/assets/logo-base-4kLB_yyl.png 11.40 kB
dist/assets/worm-left-DKovfjZu.webp 11.83 kB
dist/assets/worm-top-m1PB2v3b.webp 12.36 kB
dist/assets/logo-hover-Dsj_Fqho.png 13.15 kB
dist/assets/logo-active-BnLFL1RH.png 13.59 kB
dist/assets/transparent-Q-e92sX_.svg 16.31 kB │ gzip: 1.79 kB
dist/assets/piggy-bank-DS1A8lQ7.webp 17.53 kB
dist/assets/worm-right-D72mrFc4.webp 23.47 kB
dist/assets/collaborators-Dtl7hMZX.jpg 27.20 kB
dist/assets/cat-book-jzhkPeU0.jpg 30.61 kB
dist/assets/ImageFutureWeb-Bold-DLI90zKd.woff2 68.35 kB
dist/assets/whiteboard-CreQi0Od.webp 113.88 kB
dist/assets/websites-BRpoBPcq.webp 126.95 kB
dist/assets/placeholder-Im3Boryz.webp 141.57 kB
dist/assets/research-BlSerbgb.webp 213.93 kB
dist/.vite/ssr-manifest.json 494.22 kB │ gzip: 10.60 kB
dist/assets/plan-CnfFz8J1.mp4 523.56 kB
dist/assets/notes-BArh2x-h.mp4 743.58 kB
dist/assets/mindmap-B5xfhekO.mp4 1,678.70 kB
dist/assets/present-BwsTFYEm.mp4 4,180.37 kB
dist/assets/moodboard-f-kU5Hvp.mp4 6,983.51 kB
dist/assets/vid-CWy9D-1-.mp4 14,266.83 kB
dist/assets/Add-DVmaEahj.css 1.72 kB │ gzip: 0.55 kB
dist/assets/DiscoveryButtons-C_C0B8iS.css 7.63 kB │ gzip: 1.66 kB
dist/assets/About-4Xl8cnpg.css 8.52 kB │ gzip: 2.03 kB
dist/assets/User-DZ0WEIZQ.css 15.34 kB │ gzip: 3.07 kB
dist/assets/app-yKDtdRWW.css 38.31 kB │ gzip: 7.64 kB
dist/assets/Space-BFj9Uftd.css 118.33 kB │ gzip: 18.03 kB
dist/assets/Add-V8PzoTBS.js 7.33 kB │ gzip: 2.91 kB
dist/assets/About-ClxMC0Bf.js 21.19 kB │ gzip: 7.91 kB
dist/assets/User-DzeR0cja.js 73.09 kB │ gzip: 25.17 kB
dist/assets/DiscoveryButtons-DgmARCHD.js 73.91 kB │ gzip: 20.44 kB
dist/assets/app-Dr8WpGUo.js 469.51 kB │ gzip: 144.29 kB
dist/assets/Space-DCtoCC5y.js 747.93 kB │ gzip: 238.58 kB

(!) Some chunks are larger than 500 kB after minification. Consider:

  • Using dynamic import() to code-split the application
  • Use build.rollupOptions.output.manualChunks to improve chunking: Configuration Options | Rollup
  • Adjust chunk size limit for this warning via build.chunkSizeWarningLimit.
    ✓ built in 4.61s
    ✓ Created SPA version at dist/app.html

PWA v1.0.3
mode generateSW
precache 79 entries (4009.23 KiB)
files generated
dist/sw.js
dist/workbox-b833909e.js

[vite-ssg] Build for server…
vite v6.4.1 building SSR bundle for production…
“correction” is imported from external module “lean-qr/nano” but never used in “src/components/dialogs/QRCode.vue”.
✓ 630 modules transformed.
.vite-ssg-temp/i3le1h18g3/registerSW.js 0.13 kB
.vite-ssg-temp/i3le1h18g3/manifest.webmanifest 0.18 kB
.vite-ssg-temp/i3le1h18g3/assets/style-BpoICW19.css 186.24 kB
.vite-ssg-temp/i3le1h18g3/assets/Add-cHkiNsMH.js 9.98 kB
.vite-ssg-temp/i3le1h18g3/assets/About-CUVH2uoW.js 31.34 kB
.vite-ssg-temp/i3le1h18g3/assets/DiscoveryButtons-DHVT_v42.js 104.41 kB
.vite-ssg-temp/i3le1h18g3/assets/User-BwyA6ghn.js 106.00 kB
.vite-ssg-temp/i3le1h18g3/main.mjs 507.51 kB
.vite-ssg-temp/i3le1h18g3/assets/Space-sYvyUk66.js 1,256.35 kB
✓ built in 2.28s
✓ Created SPA version at dist/app.html
:deciduous_tree: websocket client initialized VH07Q7hkk8US1bUvJXLna

[vite-ssg] Rendering Pages… (2)
:deciduous_tree: websocket client initialized 4ZFN_uJHimcbvsVxd3Az5
:deciduous_tree: websocket client initialized OWPqGe0mG8AANUyQbgfog
dist/index.html 20.08 KiB
dist/about.html 20.08 KiB

[vite-ssg] Regenerate PWA…

PWA v1.0.3
mode generateSW
precache 80 entries (4046.00 KiB)
files generated
dist/sw.js
dist/workbox-b833909e.js

[vite-ssg] Build finished.
```

I tried to redeploy the current prod build by clicking the successful build in the list

and then options → retry

doing this again to double check , results in the same build failure. Also @1b2cc961b2cc96. Not sure how to test redeploying from that same commit

still not sure how to redeploy the prod release, but I see now that the failures started dec 5. so this is probably an error on my side. Will look into it more. thanks

I agree that it probably is, and I’d look at what you changed in commit 156f72d.

Just make sure you’re comparing the same commit locally and on Netlify.

You’ll see in that options -> retry screenshot that it says “Retry with latest branch commit
That UI feature isn’t a way to rebuild a precise commit.

1 Like