Getting 404 error during "npm run build", but not "npm run dev" (simple static adapter website)

See original GitHub issue

Describe the bug

After a recent npm update (which I’m assuming updated Svelte, but correct me if I’m wrong), I’ve started getting a 404 error when attempting to do a release build. It doesn’t happen when I do a preview build (see attached image).

My site is a very simple static webpage (using adapter-static). No stub routing, no spaces in image filenames, etc.

Screenshot 2021-12-01 154845

Reproduction

See files I’ve attached here. Since this error occurs at build time (and not during website usage), I’m not sure how to respond to this.

My website is proprietary and thus not on Github. I can send the full repository to a Svelte maintainer via ProtonMail if necessary. Please advise.

tsconfig json svelte config js package json jsconfig json

Logs

I'm not sure what logs to include. If you need any, please advise. Thank you in advance for your help...

System Info

System:
    OS: Linux 5.10 Ubuntu 18.04.6 LTS (Bionic Beaver)
    CPU: (4) x64 Intel(R) Core(TM) i7-6500U CPU @ 2.50GHz
    Memory: 3.90 GB / 6.08 GB
    Container: Yes
    Shell: 4.4.20 - /bin/bash
  Binaries:
    Node: 16.4.1 - ~/.nvs/node/16.4.1/x64/bin/node
    npm: 7.18.1 - ~/.nvs/node/16.4.1/x64/bin/npm
  npmPackages:
    @sveltejs/adapter-static: ^1.0.0-next.13 => 1.0.0-next.21
    @sveltejs/kit: next => 1.0.0-next.201
    svelte: ^3.34.0 => 3.44.2

Severity

blocking an upgrade

Additional Information

No response

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Reactions:4
  • Comments:21 (4 by maintainers)

github_iconTop GitHub Comments

3reactions
bluwycommented, Dec 8, 2021

Sorry, got a lot busy recently, but thanks for tracking this down! That means something in v200 failed, which is likely #2832. If someone wants to help out, feel free to debug that PR.

2reactions
daevid66commented, Dec 14, 2021

I also got problems after #2832, in my case it is a combination of the following:

  • my static site is not hosted the root of my domain, let’s say it in www.domain.com/test. I have added /test as base path and page/asset paths in svelte-config.
  • I have a 302 redirect that need to point to /test/page1
  • After updating svelte-kit (including #2832) the build process tries to crawl the redirected url (/test/page1), but it cannot find it, since it’s actually positioned at /page1 during the build process.

I added a work-around, by adding an extra empty route at /test/page1, which ‘works’ but it would be preferable if either:

  1. Svelte-kit accounts for base path when crawling redirects.
  2. You can somehow flag that you don’t want to crawl your redirects.
Read more comments on GitHub >

github_iconTop Results From Across the Web

I get 404 error in the localhost even though I already did "npm ...
When I run the command "SET NODE_ENV = production node server.js" (I'm in Windows, that's why SET) and I go to the localhost...
Read more >
npm-publish - npm Docs
Description. Publishes a package to the registry so that it can be installed by name. By default npm will publish to the public...
Read more >
How to Build a Fullstack App with Next.js, Prisma, and ... - Vercel
Find a specific post based on the ID. That's it! If your app is not running any more, you can restart it with...
Read more >
404: React Page Not Found - Karen Ying
When you run npm run build , Webpack bundles and minifies all your organized code into the build folder in your root directory....
Read more >
base-front-ts - npm Package Health Analysis - Snyk
This way, when you fetch('/api/todos') in development, the development server will recognize that it's not a static asset, and will proxy your ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found