Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

npm run build error #30

Open
limbo200 opened this issue Feb 12, 2023 · 10 comments
Open

npm run build error #30

limbo200 opened this issue Feb 12, 2023 · 10 comments

Comments

@limbo200
Copy link

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
Copy link
Author

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
Copy link

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
Copy link
Owner

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
Copy link
Owner

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
Copy link

ChristerNilsson commented Feb 16, 2023 via email

@josh-collinsworth
Copy link
Owner

@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
Copy link

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
Copy link

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
Copy link

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
Copy link

Guandor commented Aug 31, 2024

I'm still getting this error. Any updates?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants