nusserstudios / tailbliss

TailBliss is a Hugo Starter theme built on TailwindCSS 3, and Alpine.JS.
https://tailbliss.netlify.app/
Apache License 2.0
289 stars 134 forks source link

Could not resolve "alpinejs" #94

Closed pehrlich2 closed 1 year ago

pehrlich2 commented 1 year ago

Hello!

Trying to get started with a new Hugo site here + tailbliss. When I run hugo server after setting up the submodule for the first time, I get the error:

 % hugo server
WARN 2023/01/20 10:22:14 Module "tailbliss" is not compatible with this Hugo version; run "hugo mod graph" for more information.
Start building sites …
hugo v0.110.0+extended darwin/arm64 BuildDate=unknown
Error: Error building site: JSBUILD: failed to transform "js/alpine.js" (text/javascript): "/Users/peterehrlich/projects/zpc-site/themes/tailbliss/assets/js/alpine.js:1:19": Could not resolve "alpinejs"
Built in 629 ms

I also hopped in the themes/tailbliss and ran the npm install / npm run build, but got the same errors.

I'm probably missing something a bit obvious here?

Thanks!

edit: npm install alpinejs seemed to fix this. Maybe it should be an explicit dependency somehow?

nusserstudios commented 1 year ago

I did a merge recently. Let me take a look. I'll move scripts to Hugo modules, and start working on some issues.

nusserstudios commented 1 year ago

OK, try that. It was definitely the max version in the config.toml. I bumped the min down to 104.0, because that is the lowest it will go, from research. Try again. I use yarn for my package manager vs. npm (hence no package-lock.json file). Please pull the latest and let me know. If you're good, we can close this. Thank you, I've been meaning to get to this for at least a few weeks.

pehrlich2 commented 1 year ago

Hmm. I uninstalled alpinejs, and re-cloned the repo as indicated in the readme, but got the same Issue. However re-running npm install alpinejs did get it working for me again

nusserstudios commented 1 year ago

Yeah, I not getting the same thing. I even ran it with node 16.18. What version of node are you running?

pehrlich2 commented 1 year ago
% node -v
v19.4.0
nusserstudios commented 1 year ago

Thanks, but I still can't authenticate the issue. I get a Status 304 on localhost. with node v19.4.0. Does your config.toml file still have a max = 105.0?

pehrlich2 commented 1 year ago

Ah I see. There's two errors in the above message - one on alpinejs which was blocking me, and one warning on versions which was not.

My toml shows

[module]
  [module.hugoVersion]
    extended = true
    min = "0.104.0"

and I'm able to run hugo server with no warning, so I think that's fixed. Still the server fails if alpinejs is not manually install though, probably not a big deal though!

nusserstudios commented 1 year ago

No worries, thank you for your help. I will setup some Go modules and import Alpine that way, since it's moving to a theme. Thanks for the help though, I really do appreciate you taking the time.

nusserstudios commented 1 year ago

I'll leave this open until we resolve it for certain.

aleksasiriski commented 1 year ago

I'm running into this same error on Cloudflare Pages:

GO_VERSION | 1.20.3
HUGO_VERSION | 0.110.0
NODE_VERSION | 19.4.0
PYTHON_VERSION | 3.7
Error: Error building site: JSBUILD: failed to transform "js/alpine.js" (text/javascript): "/opt/buildhome/repo/themes/tailbliss/assets/js/alpine.js:1:19": Could not resolve "alpinejs"
nusserstudios commented 1 year ago

Can you check and see if it loads from the CDN?

nusserstudios commented 1 year ago

If so, I'll remove it and use it that way moving forward.

aleksasiriski commented 1 year ago

I've changed the command from hugo to npm install alpinejs && hugo in Cloudflare Pages run command and it works now. Why is it needed to manually install alpinejs?

aleksasiriski commented 1 year ago

I can see this: image

nusserstudios commented 1 year ago

Not sure, I've just used Vercel and Netlify.

aleksasiriski commented 1 year ago

I can see this: image

It's not using <script src="//unpkg.com/alpinejs" defer></script>

nusserstudios commented 1 year ago

I'm thinking it probably needs to be moved to some Go modules, but I'm not putting a time frame when I get to it. If you'd like to go ahead and set it up and run a pull request.

aleksasiriski commented 1 year ago

Properly fixed in #118