-
-
Notifications
You must be signed in to change notification settings - Fork 7.6k
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
npx cannot be disabled from exec #13221
Comments
Looking at the code we do have a third fallback (PATH) if NPX fails, which I suspect it doesn't do in your case.
NPX is, as I understand it, bundled into NPM.
ChatGPT is doing a lot of guessing. |
My first thought is to test this setup with something other than the snap package. The Hugo snap package is strictly confined. Our snap package includes Node, Dart Sass, and other apps to which we shell out. Our snap package does not include the TailwindCSS standalone CLI. And I don't see that changing unless they provide executables for all the platforms that our Snap can run on. |
I imagined that about ChatGPT, it looked a lot of a made-up response. But I'm learning Hugo, so could be something that exists, and I didn't know about. I will try the @jmooring recommendation. I will try Hugo binary directly. But for what it look like, it's like the PATH is only fallback if |
Thanks for your orientation @jmooring, but it didn't work. Here are the logs: Watching for changes in /home/diego/Projects/penielveiculos/penielveiculos-website/{archetypes,assets,content,data,i18n,layouts,static,themes}
Watching for config changes in /home/diego/Projects/penielveiculos/penielveiculos-website/hugo.yaml, /home/diego/Projects/penielveiculos/penielveiculos-website/themes/penielveiculos/hugo.yaml
Start building sites …
hugo v0.140.2-aae02ca612a02e085c08366a9c9279f4abb39d94+extended linux/amd64 BuildDate=2024-12-30T15:01:53Z VendorInfo=gohugoio
Built in 1394 ms
Error: error building site: TAILWINDCSS: failed to transform "/css/main.css" (text/css): npm error npx canceled due to missing packages and no YES option: ["[email protected]"]
npm notice
npm notice New major version of npm available! 10.9.0 -> 11.0.0
npm notice Changelog: https://github.com/npm/cli/releases/tag/v11.0.0
npm notice To update run: npm install -g [email protected]
npm notice
npm error A complete log of this run can be found in: /home/diego/.npm/_logs/2025-01-06T21_02_40_226Z-debug-0.log |
Yea, right ... We check that If you want a global
That should work with |
Yeah, this is a solution that I thought of since the beginning. But the problem is that, with TailwindCSS v4 (which is a total rewrite using Rust), we now have the option to ditch the node ecosystem completely. And this is my goal. I have the tailwindcss binary globally on my system already, it is in my PATH. The binary replaces all the postcss external need and the other plugins, it is self contained like Hugo, this is a huge benefit. Do you understand my point? And I think a lot of folks now and in the future will go in that direction. |
On Linux, not using a snap, with the standalone Tailwind CLI installed (named tailwindcss and in my PATH)...
|
Now you nailed the problem. |
Note that even if we fix this, you cannot use the Hugo snap if you use the Tailwind standalone CLI. |
I've already ditch the snap. I'm using the binary from the release page, see: hugo v0.140.2-aae02ca612a02e085c08366a9c9279f4abb39d94+extended linux/amd64 BuildDate=2024-12-30T15:01:53Z VendorInfo=gohugoio |
I haven't read the latest comments, but I do agree that this behaviour is ... annoying, so I'm fixing it. |
I will push a fix for this, but I suspect there must be a odd issue with
I will fix this by changing the "try order" for |
This allows the `tailwindcss` CLI binary to live in the `PATH` for NPM-less projects. Fixes gohugoio#13221
This allows the `tailwindcss` CLI binary to live in the `PATH` for NPM-less projects. Fixes gohugoio#13221
This allows the `tailwindcss` CLI binary to live in the `PATH` for NPM-less projects. Fixes gohugoio#13221
This allows the `tailwindcss` CLI binary to live in the `PATH` for NPM-less projects. Fixes gohugoio#13221
This allows the `tailwindcss` CLI binary to live in the `PATH` for NPM-less projects. Fixes gohugoio#13221
This allows the `tailwindcss` CLI binary to live in the `PATH` for NPM-less projects. Fixes #13221
Thank you @bep for understanding. It means a lot! This will help a lot my workflow! It's fantastic how you guys fix things quickly! Thanks for all the hard work!! |
What version of Hugo are you using (
hugo version
)?hugo v0.140.2-aae02ca612a02e085c08366a9c9279f4abb39d94+extended linux/amd64 BuildDate=2024-12-30T15:01:53Z VendorInfo=snap:0.140.2
Does this issue reproduce with the latest release?
Yes.
Problem:
I'm integrating my newly created project with TailwindCSS v4. The Hugo site documentation for TailwindCSS Found here, says that I could use the npm OR the as a standalone executable of the CLI. It is currently not working as I imagined. Looking at the Hugo source code and trying to figure it out, understanding the inner workings, I found something interesting:
On the repository file
hugo/resources/resource_transformers/cssjs/tailwindcss.go
, line 109 executes a command with the Npx function. The function can be found here:hugo/common/hexec/exec.go
. In the header of the function we have:This is a good sequence, but has a problem. I'm using the standalone CLI (or at least I want that),
npx
is installed in my system, because of other projects, but following this approach, it seems that the PATH fallback is never called. When I try to runhugo server --logLevel debug
I get this snippet of error:Looking further on the logs on
/home/diego/snap/hugo/22151/.npm/_logs/2025-01-06T18_36_16_231Z-debug-0.log
I have this:It is clear that it is trying to use npm under the hood. But it is not what it should do, at least for my needs.
I've found in ChatGPT (I don't know where it pick this from, or if it made it up, but it told me to add this to the
partials/head/css.html
of my theme skeleton:I will be honest that I didn't find in the source code of Hugo where this could be getting into, but I've tried for peace of mind. Same thing, It didn't work (as I suspected).
With all this information I think that could be a "bug", or at least a lack of configuration, for enabling the use of TailwindCSS without the Npx exec function.
Am I crazy, of this make sense?
The text was updated successfully, but these errors were encountered: