404-error for .json type assets

Issue Summary

  • Explain roughly what’s wrong
    I have two local installations of my Ghost site, one on a Macbook and another on my Windows PC. On the Mac everything seems to work fine with loading .json file as an asset within the theme folder (assets/json/file.json). The JSON file is correctly loaded and used in the live production version of my site as well.

It seems that on a local install on Windows, the theme doesn’t seem to be able to access .json files which i have stored in the assets/json/ folder. Other filetypes such as .txt, .js etc are loading correctly and can be accessed within the browser as http://localhost:2368/assets/test.txt

The same bug seems to have been resolved in this forum post below but now it seems to be back:

I’ve tried putting the .json file in themename/files/file.json, but it doesn’t seem to resolve this issue this time.

  • What did you expect to happen?
    I expect the same behaviour as on Mac, so that I can keep developing my theme no matter which device I use.

Setup information

Ghost Version
Share which version of Ghost you’re using.
On Mac i had initially Ghost-CLI 1.26.0 and Ghost 5.87.1, I have updated it to the latest versions (CLI 1.27.0 and Ghost 5.110.1) and verified that it still works correctly there.
On Windows i have both tried the CLI version 1.26 and 1.27 and Ghost Versions 5.87.1 and 5.110.1 but none of these seem to work for this bug.

Node.js Version
If self-hosting - share which version of Node.js you’re using.
Tried Node v20 and v18.

How did you install Ghost?
Provide some details about your install of Ghost if you are self-hosting.
Installed through npm

Provide details of your host & operating system
Include further details about your hosting and OS.
Mac M1 Max on Sequoia 15.1.1
Windows 11 Version 10.0.26100 Build 26100

Browser & OS version
Include if reporting frontend bugs.
Tested in Brave and Edge with same error on Windows.
Tested in Brave and Safari with success on Mac

Relevant log / error output
Copy and paste any relevant log output. Use backticks to format this into code.
GET http://localhost:2368/assets/json/nr_array.json/?v=bb207aabe8 404 (Not Found)

Hey Julian, and welcome to Ghost!

That post is pretty old, but I don’t think you’ve understood the workaround - the recommendation is to put it in yourghostfolder/content/files. It sounds like you’re using yourghostfolder/content/themes/yourtheme/files . But I’m not sure that’ll work – that post is pretty ancient. :)

Now, on to the bug:
As I understand it, the core team doesn’t work on Windows. They’re on Macs. And of course, Ghost in production is running on Linux. That means that sometimes bugs that are affecting only Windows users developing locally take a while to find and squash. [It’s hard to squash a bug if your dev setup doesn’t show the bug.]

My 100% best advice for developing on Windows is to use WSL2/Ubuntu. If you’re not familiar with WSL, that gets you a virtual machine running Ubuntu, while your computer is still booted in Windows. (It’s not a dual-boot setup. It’s containerization.) It’s absolutely awesome, MUCH easier to work with, and it means you’re running Linux, just like the dev team, and googling “how do I do…” almost anything code-related is much more likely to just work. Far fewer bugs, subtle incompatibilities, problems with path, etc etc. I do all my work on a Windows laptop with Ghost (and everything else dev-related) running in an Ubuntu container, and it works great. I just checked and that bug is not present for me with WSL.

1 Like

Hey Cathy!
Thanks for the quick reply. I did fail with the placement of the file, I tried moving it to content/files but the problem persists.
Thanks for the suggestion to use WSL, I’ll consider it! But for now I guess I’ll just keep developing the .json affected functionality on my Mac :slight_smile:

1 Like