-
Notifications
You must be signed in to change notification settings - Fork 4.3k
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 tailwindcss init not working #2831
Comments
I had trouble generating the configuration file while using the compatibility package. I updated my tailwindcss, postcss, and autoprefixer packages to the latest versions and this allowed me to generate a configuration successfully. I then downgraded my packages back to the compatibility versions.
|
Thanks, @JackWatling ... That was enough to get me up and running on v2. |
can confirm. |
This worked for me. Hacky but it worked |
If I follow the exact steps you posted above then I get the "Cannot find module 'autoprefixer'" error shown in the original post. What debug can I provide you to help further? |
I got some warnings when I installed the packages, so maybe I need to update node actually npm notice created a lockfile as package-lock.json. You should commit this file. |
Yep, I updated to the latest version of node using nvm install node --reinstall-packages-from=node and then when I reran the steps @adamwathan posted, everything worked fine |
updating to node v15 and |
I've stepped through the same commands Adam used above in a fresh directory and can confirm I had no issues this time. Prior, I was running an outdated node version when I was generating the configuration, so the upgrade to node v14 seems to have sorted it. |
Alright so one thing we know for sure is you need to be on Node >= 12, since that's the minimum version requirement for Tailwind CSS v2.0. I'm going to close this as resolved since it seems like the steps I outlined above are working for everyone who has the correct Node version installed. If someone sees this and is still having this issues despite updating Node and following the exact instructions outlined above, please open a new issue 👍🏻 |
Just to note that I had node 12.8 with Ubuntu 20.10 and it didn't work as described above. I junked it, installed nvm and the latest node (15.3.0) and then it worked fine. So possibly 12 isn't new enough. Certainly the stock versions that come with the latest Ubuntu (20.10) won't cut it. |
Upgrading to node 15 fixed it for me, 14.xx wasn't working. |
I have been run Node version: 14.15.1 LTS UPDATE I run instruction what @JackWatling said below and it works well.
|
@satyakresna - it would appear that upgrading to the latest (v15) node may be your answer. |
It worked! Thanks a lot |
Yes, I think so. Thank you. |
Thanks a lot, @JackWatling you've really saved me from time wastage. Very handy. |
It works, thanks. |
Just noting, I had the same issues as others are reporting here. I was on Node v10.x and hadn't realized I needed to upgrade until seeing Adam's comment. I jumped to Node v14.x and while the output was slightly different it still had pretty much the same error. So confirming what others have stated and seems like the TailwindCSS compat version needs Node 15.x to work right. I ended up going with @JackWatling's recommendation since I want to stick to an LTS release of Node and 14.x is the latest LTS available. |
How would one do this with yarn v2? |
Please tell, problems |
I ran into it some minutes ago and I just had to go through tailwind's documentation here and realised I skipped some installations @postcss and @autoprefixer. |
Just an additional follow-up! Laravel Mix v6 with support for PostCSS v8 is out so you shouldn't need to bother installing Tailwind using the PostCSS v7 compatibility mode 🙌 Just use the latest versions:
Worked great! For reference, I'm on Node 14.x LTS. |
Thanx a lot buddy it worked |
If i am going to install tailwindcss in React. On npx tailwindcss init comand i have many problems. Autoprefixer isn't find |
Tailwind CSS requires Node.js 12.13.0 or higher. for me it worker this way
|
though is not showing me any error but the class is not working and i follow the normal procedure ... i did exactly what you did |
thanks to you is now working |
Updating to node 15 fixed my issue while running this
|
Just to comment on this unfortunately closed issue - Node 15 is NOT a LTS version. Node 14, as far as i know, is the most popular LTS version at this time. Tailwind UI not working straight out of the box with Node 14 is pretty insane. |
@eyooooo Hey! Not sure what problem you are having but the CLI works as expected on node 14: I'm confused though because you are talking about "Tailwind UI not working" which feels like a very different problem then "the CLI tool fails and doesn't generate a tailwind.config.js file". If you are having some sort of issue with Tailwind UI + Node 14 please open an issue and explain the problem, happy to help. |
Thanks so much for your reply @adamwathan. Following the instructions from tailwind, using node 14, i am unable to generate the tailwind.config.js file without doing the hacky version swapping and npm uninstall/install the diff versions. I am on Ubuntu 18.04 if that makes any difference. My comments are just that of slight annoyance regarding this working properly with Node 15, and not 14 :) I have not tested that myself though. Thanks. |
How did you install node? If you use nvm, you can easily switch between node versions. |
One thing that should work for sure is if you use the dedicated separate CLI package:
If you are using the compat build, everything is unfortunately a huge pain in the ass. The root cause of all these problems is the CLI depends on peer-dependencies being installed, and npx doesn't automatically install peer dependencies, and different versions of node seem to treat npx + peer-dependencies + package aliases differently. I suspect we will drop support for the PostCSS 7 compat build completely very soon — PostCSS 8 is almost a year old and very few tools are left that are still stuck on PostCSS 7. What tool are you using that doesn't support PostCSS 8 currently? |
using the standard install methods: https://github.com/nodesource/distributions/blob/master/README.md I just dont think the issue should be closed because if users are following the exact instructions from TailWind and finding issues, thats bad. At the very least the tailwind docs should account for or document this stuff. I dont want to use tailwind at this point if I cant just install it and have it work right out the gate. Finding the solution to my problems in a closed github issue doesnt make me feel good. Just a user perception comment. |
@Marvelxy @adamwathan I am just following this guide https://tailwindcss.com/docs/guides/create-react-app where i just want to setup tailwind with a base react project. |
I agree! |
Got it I see where people would run into this now! Updated the CRA instructions to use |
you're a friggin rockstar @adamwathan i will test and if you dont hear back from me assume all is good!!! thanks so much and have a wonderful weekend. |
Just want to confirm that all is good now. Thanks so much. |
Glad to see that the solution has been found! Thank you Adam! |
I have followed the steps but still having the following error when I go to run npx tailwindcss-cli@latest init These are the errors: $ npx tailwindcss-cli@latest init -p npm ERR! A complete log of this run can be found in: Can anybody please help me to solve this problem? Thanks in advanced. |
add commend ### $ npx tailwindcss init |
i ran into a similar issue. i fixed it by installing a more recent version of nodejs. the environment i was using is ubuntu but installed the nodejs using the default repo which has v10.x. i installed LTS v16.x and it works. |
Still running the same issue with vue2 Syntax Error: Error: PostCSS plugin autoprefixer requires PostCSS 8.
Migration guide for end-users:
https://github.com/postcss/postcss/wiki/PostCSS-8-for-end-users Node: v14.18.3 {
"vue": "^2.5.17",
"autoprefixer": "^10.4.8",
"postcss": "^8.4.16",
"postcss-loader": "^4.3.0",
"tailwindcss": "^3.1.8",
} |
I LOVE YOU, thanks a lot!! |
it worked. thank you very much |
ANSWER - by tailwindlabs/tailwindcss#2831 npm uninstall tailwindcss postcss autoprefixer npm install tailwindcss@latest postcss@latest autoprefixer@latest npx tailwindcss init -p npm uninstall tailwindcss postcss autoprefixer npm install tailwindcss@npm:@tailwindcss/postcss7-compat postcss@^7 autoprefixer@^9
*Fix TailwindCSS not recognized problem ANSWER - by tailwindlabs/tailwindcss#2831 npm uninstall tailwindcss postcss autoprefixer npm install tailwindcss@latest postcss@latest autoprefixer@latest npx tailwindcss init -p npm uninstall tailwindcss postcss autoprefixer npm install tailwindcss@npm:@tailwindcss/postcss7-compat postcss@^7 autoprefixer@^9
Describe the problem:
Using tailwind in post-css compatibility mode
I've got tailwind 2.0 installed and the build process runs, however now I want to set up a config file so I can add custom colors etcetera. I run the
npx tailwindcss init
command and it fails with this output.I can see autoprefix in both package.json
"autoprefixer": "^9.8.6",
and the autoprefixer folder in the node_modules folder.Not sure how to resolve this, please advise.
The text was updated successfully, but these errors were encountered: