josh-collinsworth / sveltekit-blog-starter

A preconfigured SvelteKit static blog starter, with Sass, Markdown, MDSvex, Rehype, background preloading, and more. See the README for full details.
https://sveltekit-static-starter.netlify.app/
MIT License
419 stars 81 forks source link

npm run build error #30

Open limbo200 opened 1 year ago

limbo200 commented 1 year ago

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>

limbo200 commented 1 year ago

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

ChristerNilsson commented 1 year ago

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

josh-collinsworth commented 1 year ago

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 commented 1 year ago

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?

ChristerNilsson commented 1 year ago

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

josh-collinsworth commented 1 year ago

@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.

thedutchgunslinger commented 1 year ago

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?

Kai-Richardson commented 1 year ago

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]
anders86755 commented 1 year ago

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

Guandor commented 3 months ago

I'm still getting this error. Any updates?