npx tailwindcss init not working

See original GitHub issue

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.

λ npx tailwindcss init
npx: installed 86 in 8.321s
Cannot find module 'autoprefixer'

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.

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Reactions:20
  • Comments:48 (5 by maintainers)

github_iconTop GitHub Comments

345reactions
JackWatlingcommented, Nov 20, 2020

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.

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
28reactions
CreateSeancommented, Nov 20, 2020

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.

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

This worked for me. Hacky but it worked

Read more comments on GitHub >

github_iconTop Results From Across the Web

Issues installing Tailwindcss, specifically with "npx tailwindcss ...
Step : 2 Not working above step : 1 then try this command : npx tailwindcss-cli@latest init -p . Share.
Read more >
Installation - Tailwind CSS
The simplest and fastest way to get up and running with Tailwind CSS from scratch is with the Tailwind CLI tool.
Read more >
How to set up Tailwind CSS 2.0?
Run the following command to create the tailwind config file. npx tailwindcss init. This command creates a file in the root directory named...
Read more >
Install and configure Tailwind CSS | oneweekgraphql.com
config.js where we can customize the config for the newly installed dependencies. Inside the terminal, run the following: npx tailwindcss init - ...
Read more >
tailwindcss | Yarn - Package Manager
Important: This documentation covers modern versions of Yarn. For 1.x docs, see classic.yarnpkg.com. Yarn.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found