c3-web icon indicating copy to clipboard operation
c3-web copied to clipboard

Cannot get NPM and Astro working (as far as I can discern) for this repo.

Open WraithGlade opened this issue 5 months ago • 9 comments

I'm not a web person so I haven't actually used NPM or Astro before now.

However, I wanted to fix a few small typos and grammar issues I found in the C3 docs and wanted to test that the changes would work correctly rather than just sending in a blind pull request (though a blind edit would probably work since such changes are just inert prose text and not real code).

I installed NPM from NodeSource's page on my system (Linux Mint Xfce edition, hence ~Ubuntu) since that seems to be the recommended way to set up NPM and such. However I get the following message whenever I try to run the npm run dev command as specified on the main page for this repo (README.md):

[my shell prompt]> npm run dev

> [email protected] dev
> astro dev

14:41:03 [types] Generated 0ms
14:41:04 [ERROR] [content] Cannot read properties of undefined (reading 'get')
14:41:04 [WARN] [content] Content config not loaded

 astro  v5.12.3 ready in 1251 ms

┃ Local    http://localhost:4321/
┃ Network  use --host to expose

14:41:04 watching for file changes...

I looked in the directory afterwards but cannot find any generated HTML code, which is what I would presume this NPM and Astro system is supposed to create so that the user can verify that changes are being built into the correct final pages. Correct me if I'm wrong.

Perhaps I am just too out of touch with NPM since I'm not a web dev, but this seems to imply that the "just use npm run dev" is actually not sufficient unfortunately, at least for some systems like mine evidently. Perhaps more familiarity with NPM is being assumed there.

On the other hand, there was a potential confounding factor that could have messed up my system:

The first time I tried to get NPM on my system I just did sudo apt install npm and that actually installed a very old version of the NPM and Node ecosystem on my computer. I subsequently had to follow the purge instructions on NodeSource's page and then also do an sudo apt purge npm in the hopes that that would clear out any problems. I'm not certain whether it did though nor what I'd have to do to get a clean install if my install isn't clean, though I don't know whether it is or not at this point.

The commands I used to do that were:

# To uninstall and purge, in case the outdated `sudo apt install npm` I previously did messed things up:

[my shell prompt]> sudo apt-get purge nodejs
rm -r /etc/apt/sources.list.d/nodesource.list
rm -r /etc/apt/keyrings/nodesource.gpg

[my shell prompt]> sudo apt purge npm



# To reinstall, hoping it would fix the problem though it didn't:

[my shell prompt]> sudo apt-get install -y curl
curl -fsSL https://deb.nodesource.com/setup_22.x | sudo -E bash -
sudo apt-get install -y nodejs
node -v

The problem persists though.

Granted, I could just submit my found typos and edits as issue tickets and let someone else do it, but I plan to contribute to C3 some and so I should probably figure out how to get this working right.

I'm not even sure what the NPM and Astro system are supposed to do and how we are supposed to use them. Does it generate plain HTML if it works right? So, correct me if my conception of what I'm supposed to be doing and looking for and working with isn't even correct.

Anyway, thanks for reading and for your time, as always. 🙂

WraithGlade avatar Jul 23 '25 19:07 WraithGlade

I've made some more attempts to get NPM and Astro working but still continue to have no luck with it.

I've also tried out what @waveproc mentioned (running pnpm i astro and such) but it has seemingly had zero effect on the problem. I've also been searching for a variety of similar issues (both for NPM and Astro) elsewhere on the web and none of that information has helped yet either.

Using regular npm did basically the same thing as pnpm as far as I can tell.

I'm hoping I don't have to learn NPM and/or Astro in depth just to get the build running so I can fix a large number (250+) of typos and other issues (clarity issues, misleading text, outdated stuff, actual errors, a few extended explanations, etc) I've found over the past two weeks of carefully reading almost all the documentation. I've got a reputation for being good at proofreading technical things, heh. I've been tracking all those edits in a plain text (though that has made it significantly more laborious) just because I cannot seem to discern how to get the NPM and Astro build of this c3-web working besides the index page but ~all other pages go to 404 pages on localhost.

It (NPM and web frameworks like Astro, etc) seems like quite a gigantic mess of dependencies, hence inherently very brittle and very fast to bit rot (definitely the kind of thing that I don't trust to ever reliably run again even a few years from now), which fits what I've heard about NPM in the past since that is kind of what it (and web dev more broadly) is most famous for regarding dependencies. Something more self-contained would seem better to me, such as even just plain file I/O based generation of plain HTML and CSS or using something like LaTeX and pandoc. That's just my personal tangential thoughts anyway.

In the meantime though, I will continue trying to get the website to even build at all so that I can even see any previews of what my hundreds of tiny edits I've been building up over the past two weeks would actually do if I were to submit them. Even just locating where some of the documentation is also seems needlessly laborious and some documentation does not exist under file names that one would expect.

This is the most difficulty I've ever had trying to contribute small documentation fixes to any programming project. It has always previously just taken a matter of minutes or hours, not intermittent days/weeks like NPM and Astro here has.

C3 itself in contrast though has been very easy to work with and I love the location independent folder it comes in (a smart design, like what Zig and other languages do too).

WraithGlade avatar Aug 08 '25 18:08 WraithGlade

Great news @waveproc and @lerno!

I figured out a workaround that lets me test the website changes now.

Instead of using npm run dev or pnpm run dev like the official docs suggest, I run the following two commands directly from within the repo folder whenever I want to test the output:

astro build
astro preview

It is probably a bit slower than the file watcher, but it works and that is good enough for me.

I got the idea from reading the project.json in the hopes that I could work around whatever automated system was getting in the way and luckily it worked! Thus, expect a whole bunch of doc fixes (hundreds) coming soon (probably not today since there are so many I've accumulated to apply).

WraithGlade avatar Aug 08 '25 19:08 WraithGlade

Yesterday I ended up being busy all day with meeting up with a friend and then today I have a family member's birthday to attend, so the patches will be a slightly delayed, but I plan on using my free time today to do as many as I can.

So, hopefully I'll be sending a pull request for the changes on my branch probably sometime tomorrow (Monday) but I'll see if I can somehow push through to doing it by the end of tonight (though less likely).

Anyway, that's my status update on the edits. Talk to you all later and have a great weekend, etc!

WraithGlade avatar Aug 10 '25 13:08 WraithGlade

I think I will open up a repository for the new docs that I've been working on in my free time. Starlight was a PITA (pain in the ass) to work with (I had difficulty adding a code editor component with c3 syntax highlighting), so I tried out vuepress-theme-plume instead and really enjoyed it. Just translate the simplified Chinese docs to English with Firefox/Google Translate, and take a look at all the features it offers. I really like the Vue dev tools, too. Anyways, take a look at the dependency tree for vuepress-theme-plume: https://npmgraph.js.org/?q=vuepress-theme-plume. I will try to minimize the number of dependencies manually.

This is the most difficulty I've ever had trying to contribute small documentation fixes to any programming project.

That is because the docs were working in CI but were broken for anybody cloning the repo from scratch. I'm not sure where/when the break happened.

Also @WraithGlade, npm is a really slow package manager, and I don't really see much of a reason to use it other than for compatibility. pnpm is much faster from my experience and compatible with npm/nodejs. If you want even more speed out of your JS package manager, try Bun or Deno. I have tried neither of those. So when we (hopefully) switch over from Starlight to Vuepress, you won't have to use the more opaque Astro web framework.

waveproc avatar Aug 10 '25 14:08 waveproc

Thanks for the info waveproc. 😎

Whatever the C3 team/contributors think is best for the project is fine with me, so no worries. I will work with whatever you all decide to use for docs (whether it is NPM and Astro or anything else). I am just a C3 newbie making suggestions after all.

As long as the repo is in a state where I can get my edit suggestions in (in the next few days) before any major changes so that the two weeks of tracking the typos and other edits isn't wasted then I'm fine with whatever else happens.

WraithGlade avatar Aug 10 '25 14:08 WraithGlade

Status Update: I'm about 70% of the way through applying my manually tracked places that merit edits and turning them into commits. I meant to have this done tonight (2025-08-12) but I ended up expanding several of my edits quite a lot to make them better and it used up a lot of time. So, I'll have to finish the commits on my branch tomorrow (2025-08-13) instead. Sorry about that.

I've been pushing most of my available free time into it but still need more time. It's coming very soon though.

WraithGlade avatar Aug 13 '25 04:08 WraithGlade

I wonder if I should close this, but I suppose not since the issue of build problems for new users will still be true and the main intended workflow of using npm run dev and such still probably isn't working (for at least some other people, like me) unless something has changed.

Leaving this issue up until a real resolution is implemented will make more people aware of the astro build and astro preview workaround too, which seems wise until the problem is fully fixed. People can still work on it if they know that.

Oh, and this is old news but I finished my documentation edits and submitted a pull request ~4 days ago (or whenever it was), so that part of this thread is finished with though.

Anyway, thanks for reading and good luck to any new users working with the documentation, etc. 😎

WraithGlade avatar Aug 17 '25 21:08 WraithGlade

@WraithGlade you can make a pr to update the readme if you'd like

waveproc avatar Aug 28 '25 04:08 waveproc

I might do it later, depending on what the rest of you decide to do for the broader issue (e.g. if the issue still stands), but currently still feeling very deflated/demotivated (as discussed elsewhere like in the big 250+ commit comment chain) despite my efforts to feel better over the past couple days. I'm really burnt out on "tech" right now (given the recent deeply dystopian trends in the industry as a whole) and still have trouble letting go of my hypervigilant sensitivity to even the slightest sign of things being off. I got burned so hard in the past with my AAA game dev job's toxic office politics that I've struggled to even function as a programmer for the past several years and still feel borderline hopeless on ever fixing my life. I don't feel comfortable with the industry, yet I also keep not being able to settle on anything for personal projects and contributions, which puts me in quite a bad pattern of ineffective outcomes. That's just my best guess as to why the slightest sign of thing being off (e.g. any "AI" use, risky time investment, etc) is so crippling to my motivation whenever I encounter it.

It doesn't seem like anything ever gets through, nor like visibility or viability of anything is ever fair in recent years (e.g. getting independent website traffic). Yet, the only hope for the future seems to be finding a way to carve out a space free of the reach of the current trends. That is difficult considering I have to find a way to survive soon and I can't afford to spend much more time guessing then backing off. Things really need to change, both in my own personal life and in society.

I also have a bunch of ideas related to C3 I wrote while doing the big commit list, but haven't felt motivated to even bother submitting those anymore (though previously very motivated) for the past several days either, despite trying to force myself to feel more motivated. I wouldn't wish the past hellish decade of my life on anyone. I don't know what I'm going to even do. I realize that from a certain perspective I am being absurd (etc), but I cannot seem to force my emotions to change.

In any case though, I am wishing you all all the best as always and happy coding, etc.

WraithGlade avatar Aug 29 '25 18:08 WraithGlade