tutorialkit icon indicating copy to clipboard operation
tutorialkit copied to clipboard

Getting the message "Error the build was canceled" immediately after setup

Open noam-honig opened this issue 1 year ago • 6 comments

Describe the bug

I get multiple errors on build - right after running npm create tutorial@latest both on windows and wsl

noam@Win11:~/try/t01/online-remult-tutorial$ npm run build

> [email protected] build
> astro check && astro build

✘ [ERROR] The build was canceled

08:03:39 [types] Generated 1.41s
08:03:39 [check] Getting diagnostics for Astro files in /home/noam/try/t01/online-remult-tutorial...
Result (8 files):
- 0 errors
- 0 warnings
- 0 hints

✘ [ERROR] The build was canceled

08:03:45 [types] Generated 397ms
08:03:45 [build] output: "static"
08:03:45 [build] directory: /home/noam/try/t01/online-remult-tutorial/dist/
08:03:45 [build] Collecting build info...
08:03:45 [build] ✓ Completed in 1.45s.
08:03:45 [build] Building static entrypoints...
"Line" is imported from external module "@codemirror/state" but never used in "node_modules/@tutorialkit/react/dist/core/CodeMirrorEditor/indent.js", "node_modules/@tutorialkit/react/dist/core/CodeMirrorEditor/cm-theme.js" and "node_modules/@tutorialkit/react/dist/core/CodeMirrorEditor/index.js".
08:03:54 [vite] ✓ built in 9.67s
08:03:54 [build] ✓ Completed in 9.70s.

 building client (vite)
08:03:59 [vite] ✓ 660 modules transformed.
08:03:59 [vite] dist/_astro/ec.8zarh.js                          2.42 kB
08:03:59 [vite] dist/_astro/_slug_.p80qyc3e.css                 13.36 kB │ gzip:   2.95 kB
08:03:59 [vite] dist/_astro/ec.lo7kk.css                        20.38 kB │ gzip:   4.45 kB
08:03:59 [vite] dist/_astro/index.BDWyZ8Gq.js                    0.29 kB │ gzip:   0.23 kB
08:03:59 [vite] dist/_astro/theme-store.BkTMmRgV.js              0.33 kB │ gzip:   0.22 kB
08:03:59 [vite] dist/_astro/is-preview-message.ZaUdCj-5.js       0.34 kB │ gzip:   0.25 kB
08:03:59 [vite] dist/_astro/_slug_.89f348d8.BKx4Q3iB.js          0.54 kB │ gzip:   0.26 kB
08:03:59 [vite] dist/_astro/index.DgoachrA.js                    0.61 kB │ gzip:   0.35 kB
08:03:59 [vite] dist/_astro/ThemeSwitch.Cm_pIVTw.js              0.75 kB │ gzip:   0.43 kB
08:03:59 [vite] dist/_astro/LoginButton.Du2YHlwY.js              0.86 kB │ gzip:   0.52 kB
08:03:59 [vite] dist/_astro/jsx-runtime.B6N9iRLn.js              0.92 kB │ gzip:   0.58 kB
08:03:59 [vite] dist/_astro/client.DtQD7m52.js                   1.75 kB │ gzip:   0.89 kB
08:03:59 [vite] dist/_astro/index.CU4-LTQY.js                    2.28 kB │ gzip:   1.04 kB
08:03:59 [vite] dist/_astro/index.CT5_QPd6.js                    2.62 kB │ gzip:   1.61 kB
08:03:59 [vite] dist/_astro/index.BpP6Y8ev.js                    2.84 kB │ gzip:   1.61 kB
08:03:59 [vite] dist/_astro/index.C_x5C3a-.js                    3.59 kB │ gzip:   1.82 kB
08:03:59 [vite] dist/_astro/index.DNi1g-pO.js                    7.23 kB │ gzip:   2.91 kB
08:03:59 [vite] dist/_astro/OpenInStackblitzLink.D0lHZZvx.js     8.66 kB │ gzip:   3.70 kB
08:03:59 [vite] dist/_astro/hoisted.Df0Q_Fi1.js                 19.12 kB │ gzip:   6.45 kB
08:03:59 [vite] dist/_astro/index.BK4Dft89.js                   21.82 kB │ gzip:   9.85 kB
08:03:59 [vite] dist/_astro/index.BrCa7_dZ.js                   23.13 kB │ gzip:  10.25 kB
08:03:59 [vite] dist/_astro/index.79P4xX5r.js                   26.28 kB │ gzip:   8.77 kB
08:03:59 [vite] dist/_astro/index.CSw4d_b_.js                   28.83 kB │ gzip:  11.76 kB
08:03:59 [vite] dist/_astro/index.Ck9yz3Ls.js                   43.17 kB │ gzip:  14.92 kB
08:03:59 [vite] dist/_astro/webcontainer.BDuVMs12.js            43.90 kB │ gzip:  14.57 kB
08:03:59 [vite] dist/_astro/index.DCEevIE7.js                   44.39 kB │ gzip:  14.85 kB
08:03:59 [vite] dist/_astro/index.Bg4pJIWr.js                   85.66 kB │ gzip:  33.96 kB
08:03:59 [vite] dist/_astro/WorkspacePanelWrapper.ChrkZsQB.js   90.73 kB │ gzip:  31.27 kB
08:03:59 [vite] dist/_astro/NavWrapper.DJolMl14.js             123.56 kB │ gzip:  40.69 kB
08:03:59 [vite] dist/_astro/index.DDEQXXIH.js                  133.95 kB │ gzip:  43.14 kB
08:03:59 [vite] dist/_astro/index.BW0d_TQw.js                  294.97 kB │ gzip:  73.88 kB
08:03:59 [vite] dist/_astro/TerminalPanel.B8BSOEHI.js          501.20 kB │ gzip: 158.28 kB
08:03:59 [WARN] [vite]
(!) 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: https://rollupjs.org/configuration-options/#output-manualchunks
- Adjust chunk size limit for this warning via build.chunkSizeWarningLimit.
08:03:59 [vite] ✓ built in 4.99s

 generating static routes
08:03:59 ▶ @tutorialkit/astro/dist/default/pages/index.astro
08:03:59   └─ /index.html (+14ms)
08:04:00 ▶ @tutorialkit/astro/dist/default/pages/[...slug].astro
08:04:00   └─ /1-basics/1-introduction/1-welcome/index.htmlTrying to compute an absolute file URL but Astro.site is not set.
 (+27ms)
08:04:00 ✓ Completed in 314ms.

08:04:00 [@tutorialkit/astro] 1-basics-1-introduction-1-welcome-solution.json
08:04:00 [@tutorialkit/astro] 1-basics-1-introduction-1-welcome-files.json
08:04:00 [@tutorialkit/astro] template-default.json
08:04:00 [build] 2 page(s) built in 16.48s
08:04:00 [build] Complete!
noam@Win11:~/try/t01/online-remult-tutorial$

Link to a StackBlitz project which shows the error

No response

Steps to reproduce

  1. Run 'npm create tutorialkit@latest`
  2. Run npm run build Get these errors

Expected behavior

Expected to look like there are no errors out of the box :)

Screenshots

No response

Platform

  • TutorialKit version: [e.g. 1.0.1]
  • OS: [e.g. macOS, Windows, Linux]
  • Browser: [e.g. Chrome, Safari, Firefox]
  • Version: [e.g. 91.1]

Additional context

The backstory is that I'm trying to upgrade a project created with 0.0.2 to latest and greatest and it doesn't build - and I'm trying to figure out what needs to be done, by comparing it to a project just after install.

noam-honig avatar Oct 23 '24 05:10 noam-honig

I think errors have always been there. @Nemikolh any ideas where they come from?

and it doesn't build

It does build successfully. In the end of your log output there is:

08:04:00 [build] 2 page(s) built in 16.48s 08:04:00 [build] Complete!

AriPerkkio avatar Oct 23 '24 05:10 AriPerkkio

@AriPerkkio I see that it eventually produces a result - just thinking of it as a newbie - red error notices are scary :)

noam-honig avatar Oct 23 '24 06:10 noam-honig

just thinking of it as a newbie - red error notices are scary

I agree! We should get rid of these errors. The build command seems to run astro check && astro build. If you remove astro check, do the errors still appear?

AriPerkkio avatar Oct 23 '24 06:10 AriPerkkio

@AriPerkkio not completely

C:\try\t12\online-remult-tutorial>npm run build

> [email protected] build
> astro build

09:33:27 [vite] Re-optimizing dependencies because vite config has changed
X [ERROR] The build was canceled

09:33:28 [types] Generated 1.36s
09:33:28 [build] output: "static"
09:33:28 [build] directory: C:\try\t12\online-remult-tutorial\dist\
09:33:28 [build] Collecting build info...
09:33:28 [build] ✓ Completed in 2.80s.
09:33:28 [build] Building static entrypoints...
"Line" is imported from external module "@codemirror/state" but never used in "node_modules/@tutorialkit/react/dist/core/CodeMirrorEditor/indent.js", "node_modules/@tutorialkit/react/dist/cor
e/CodeMirrorEditor/cm-theme.js" and "node_modules/@tutorialkit/react/dist/core/CodeMirrorEditor/index.js".
09:33:39 [vite] ✓ built in 11.02s
09:33:39 [build] ✓ Completed in 11.09s.

 building client (vite) 
09:33:44 [vite] ✓ 660 modules transformed.
09:33:44 [vite] dist/_astro/ec.8zarh.js                          2.42 kB
09:33:44 [vite] dist/_astro/_slug_.p80qyc3e.css                 13.36 kB │ gzip:   2.95 kB
09:33:44 [vite] dist/_astro/ec.lo7kk.css                        20.38 kB │ gzip:   4.45 kB
09:33:44 [vite] dist/_astro/index.BDWyZ8Gq.js                    0.29 kB │ gzip:   0.23 kB
09:33:44 [vite] dist/_astro/theme-store.BkTMmRgV.js              0.33 kB │ gzip:   0.22 kB
09:33:44 [vite] dist/_astro/is-preview-message.ZaUdCj-5.js       0.34 kB │ gzip:   0.25 kB
09:33:44 [vite] dist/_astro/_slug_.89f348d8.BKx4Q3iB.js          0.54 kB │ gzip:   0.26 kB
09:33:44 [vite] dist/_astro/index.DgoachrA.js                    0.61 kB │ gzip:   0.35 kB
09:33:44 [vite] dist/_astro/ThemeSwitch.Cm_pIVTw.js              0.75 kB │ gzip:   0.43 kB
09:33:44 [vite] dist/_astro/LoginButton.Du2YHlwY.js              0.86 kB │ gzip:   0.52 kB
09:33:44 [vite] dist/_astro/jsx-runtime.B6N9iRLn.js              0.92 kB │ gzip:   0.58 kB
09:33:44 [vite] dist/_astro/client.DtQD7m52.js                   1.75 kB │ gzip:   0.89 kB
09:33:44 [vite] dist/_astro/index.CU4-LTQY.js                    2.28 kB │ gzip:   1.04 kB
09:33:44 [vite] dist/_astro/index.CT5_QPd6.js                    2.62 kB │ gzip:   1.61 kB
09:33:44 [vite] dist/_astro/index.BpP6Y8ev.js                    2.84 kB │ gzip:   1.61 kB
09:33:44 [vite] dist/_astro/index.C_x5C3a-.js                    3.59 kB │ gzip:   1.82 kB
09:33:44 [vite] dist/_astro/index.DNi1g-pO.js                    7.23 kB │ gzip:   2.91 kB
09:33:44 [vite] dist/_astro/OpenInStackblitzLink.D0lHZZvx.js     8.66 kB │ gzip:   3.70 kB
09:33:44 [vite] dist/_astro/hoisted.Df0Q_Fi1.js                 19.12 kB │ gzip:   6.45 kB
09:33:44 [vite] dist/_astro/index.BK4Dft89.js                   21.82 kB │ gzip:   9.85 kB
09:33:44 [vite] dist/_astro/index.BrCa7_dZ.js                   23.13 kB │ gzip:  10.25 kB
09:33:44 [vite] dist/_astro/index.79P4xX5r.js                   26.28 kB │ gzip:   8.77 kB
09:33:44 [vite] dist/_astro/index.CSw4d_b_.js                   28.83 kB │ gzip:  11.76 kB
09:33:44 [vite] dist/_astro/index.Ck9yz3Ls.js                   43.17 kB │ gzip:  14.92 kB
09:33:44 [vite] dist/_astro/webcontainer.BDuVMs12.js            43.90 kB │ gzip:  14.57 kB
09:33:44 [vite] dist/_astro/index.DCEevIE7.js                   44.39 kB │ gzip:  14.85 kB
09:33:44 [vite] dist/_astro/index.Bg4pJIWr.js                   85.66 kB │ gzip:  33.96 kB
09:33:44 [vite] dist/_astro/WorkspacePanelWrapper.CBYC2-E4.js   90.71 kB │ gzip:  31.26 kB
09:33:44 [vite] dist/_astro/NavWrapper.DJolMl14.js             123.56 kB │ gzip:  40.69 kB
09:33:44 [vite] dist/_astro/index.DDEQXXIH.js                  133.95 kB │ gzip:  43.14 kB
09:33:44 [vite] dist/_astro/index.BW0d_TQw.js                  294.97 kB │ gzip:  73.88 kB
09:33:44 [vite] dist/_astro/TerminalPanel.B8BSOEHI.js          501.20 kB │ gzip: 158.28 kB
09:33:44 [WARN] [vite]
(!) 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: https://rollupjs.org/configuration-options/#output-manualchunks
- Adjust chunk size limit for this warning via build.chunkSizeWarningLimit.
09:33:44 [vite] ✓ built in 5.12s

 generating static routes 
09:33:44 ▶ @tutorialkit/astro/dist/default/pages/index.astro
09:33:44   └─ /index.html (+20ms)
09:33:45 ▶ @tutorialkit/astro/dist/default/pages/[...slug].astro
09:33:45   └─ /1-basics/1-introduction/1-welcome/index.htmlTrying to compute an absolute file URL but Astro.site is not set.
 (+31ms)
09:33:45 ✓ Completed in 510ms.

09:33:45 [@tutorialkit/astro] 1-basics-1-introduction-1-welcome-files.json
09:33:45 [@tutorialkit/astro] 1-basics-1-introduction-1-welcome-solution.json
09:33:45 [@tutorialkit/astro] template-default.json
09:33:45 [build] 2 page(s) built in 19.57s
09:33:45 [build] Complete!

C:\try\t12\online-remult-tutorial>


noam-honig avatar Oct 23 '24 06:10 noam-honig

and it looks like this: image

Draws attention

noam-honig avatar Oct 23 '24 06:10 noam-honig

There's a lot of similar reports on Astro about this too. We should go through their reports and look for solutions there 🤔

  • https://github.com/withastro/astro/issues/11390
  • https://github.com/withastro/astro/issues/6631

AriPerkkio avatar Oct 23 '24 06:10 AriPerkkio

Has anyone found the solution for this?

rmeena840 avatar Oct 08 '25 10:10 rmeena840

I ran into this issue when running a Node script that needed to transform .vue files and have access to @ aliases in the Vite config.

I'm using vite-node --config vite.config.lib.js ./scripts/doThing.js.

To stop the X ERROR The build was canceled text from appearing, I changed my code to the following:

 try {
   doThing();
+  process.exit(0);
 } catch (error) {
   console.log(error);
+  process.exit(1);
 }

Now when doThing throws, it is caught, the error is logged, and the CI stops. But if it does not have any issues, it just runs and exits. In both cases the X ERROR The build was canceled is no longer shown.

I think I'm just killing the process early before the Vite life-cycle can complain that no build happened, but I don't care, scary red X is gone. If you are running many async tasks, you may need to await all of them finishing and move this process.exit code up higher so it is the very last thing to run, to avoid it ending early. See:

  • https://stackoverflow.com/questions/5266152/how-to-exit-in-node-js

TheJaredWilcurt avatar Nov 03 '25 16:11 TheJaredWilcurt

This is emitted by esbuild and should likely be fixed in Astro. I don't think TutorialKit itself cancels the builds at any moment as it's just running Astro.

https://github.com/evanw/esbuild/blob/fdece9513e3dda132a8bfefbd861624a70b89b0b/pkg/api/api_impl.go#L1510

AriPerkkio avatar Nov 04 '25 07:11 AriPerkkio