sveltekit-blog-starter icon indicating copy to clipboard operation
sveltekit-blog-starter copied to clipboard

npm run build error

Open rgr-prog opened this issue 2 years ago • 10 comments

When I do a git clone; cd repo; npm i; npm run build... it show the following error on missing file/folder...

.svelte-kit/output/server/index.js 80.14 kB 301 /blog/page -> /blog 301 /blog/category/page/* -> /blog 301 /blog/page/* -> /blog node:fs:600 handleErrorFromBinding(ctx); ^

Error: ENOENT: no such file or directory, open 'C:\Users\xquis\Documents\develop\sveltekit-blog-starter.svelte-kit/output/prerendered/pages/api/posts/page/' at Object.openSync (node:fs:600:3) at writeFileSync (node:fs:2221:35) at save (file:///C:/Users/xquis/Documents/develop/sveltekit-blog-starter/node_modules/@sveltejs/kit/src/core/prerender/prerender.js:348:4) at visit (file:///C:/Users/xquis/Documents/develop/sveltekit-blog-starter/node_modules/@sveltejs/kit/src/core/prerender/prerender.js:212:3) { errno: -4058, syscall: 'open', code: 'ENOENT', path: 'C:\Users\xquis\Documents\develop\sveltekit-blog-starter\.svelte-kit/output/prerendered/pages/api/posts/page/' }

Node.js v18.13.0 [vite-plugin-sveltekit-compile] Prerendering failed with code 1 error during build: Error: Prerendering failed with code 1 at ChildProcess. (file:///C:/Users/xquis/Documents/develop/sveltekit-blog-starter/node_modules/@sveltejs/kit/src/exports/vite/index.js:551:15) at ChildProcess.emit (node:events:513:28) at ChildProcess._handle.onexit (node:internal/child_process:291:12) PS C:\Users\xquis\Documents\develop\sveltekit-blog-starter>

rgr-prog avatar Feb 12 '23 02:02 rgr-prog

After I opened this issue I saw someone else had the same issue. You are right it is a Windows problem. I did run this on Linux ok! But is there any suggestion to solve this in windows? Thks

rgr-prog avatar Feb 12 '23 02:02 rgr-prog

Same issue here. Using W10. npm run dev works as intended. Question: Is it possible to deploy this static site to Github Pages?

ChristerNilsson avatar Feb 16 '23 12:02 ChristerNilsson

Question: Is it possible to deploy this static site to Github Pages?

I haven't used GitHub Pages, but to my understanding, yes, you should be able to use npm run build and then deploy the result of that (the build folder) to GH Pages.

josh-collinsworth avatar Feb 16 '23 17:02 josh-collinsworth

I'll have to take a look at that error on my end. Unfortunately I don't have a Windows machine to test on, but maybe I can figure something out.

Since the build seems to be failing to find the root /api/posts/page/ route, maybe there's something that can be done with adding a server route there to handle that, just so a file is generated?

josh-collinsworth avatar Feb 16 '23 17:02 josh-collinsworth

Original svelte produced a public folder that could be copied to github pages and Google Cloud Storage. I have had no success in repeating that with svelte kit.

On Thu, 16 Feb 2023 at 18:47, Josh Collinsworth @.***> wrote:

I'll have to take a look at that error on my end. Unfortunately I don't have a Windows machine to test on, but maybe I can figure something out.

Since the build seems to be failing to find the root /api/posts/page/ route, maybe there's something that can be done with adding a server route there to handle that, just so a file is generated?

— Reply to this email directly, view it on GitHub https://github.com/josh-collinsworth/sveltekit-blog-starter/issues/30#issuecomment-1433476456, or unsubscribe https://github.com/notifications/unsubscribe-auth/AA2HFC2RPBZJEXZWXCBNHW3WXZRZZANCNFSM6AAAAAAUZBC6CM . You are receiving this because you commented.Message ID: @.***>

-- /Christer Nilsson 070-749 6800

ChristerNilsson avatar Feb 16 '23 20:02 ChristerNilsson

@ChristerNilsson If the build succeeds, it will result in a build folder of static assets that can be deployed anywhere a static website can be hosted. Alternatively, you could use a host like Netlify or Vercel; connect them to your site's GitHub repo, and they'll automatically run the build and host the output any time you push to the repo. (So if, for example, you added a new markdown file, the build would be run automatically and the new version of the site would be up in just a moment.)

@rgrcnh I'm sorry, I don't have any way of reproducing the error on my end. Could you ask in the Svelte Discord, perhaps? I'll be happy to make any updates necessary; I just don't have the ability to test and find out what those might be on my end without Windows.

josh-collinsworth avatar Feb 17 '23 16:02 josh-collinsworth

it seems that the error lies with the wildcard * in the config. but im not sure. has anyone find a fix for this problem yet?

thedutchgunslinger avatar Jun 01 '23 12:06 thedutchgunslinger

This error is occuring on Linux as well, it just fails in a different place.

Error: The following routes were marked as prerenderable, but were not prerendered because they were not found while crawling your app:
  - /api/posts/page/[page]

Kai-Richardson avatar Jun 17 '23 03:06 Kai-Richardson

I have also encountered the same error. I have encountered another issue as well. When adding a new blog post, the title, images, and other content are not displaying correctly. I used win10 微信截图_20230822220501

anders86755 avatar Aug 22 '23 14:08 anders86755

I'm still getting this error. Any updates?

Guandor avatar Aug 31 '24 13:08 Guandor