question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Tailwind CLI fails with "Cannot find module postcss" since v3.0.11

See original GitHub issue

What version of Tailwind CSS are you using?

v3.0.11/12

What build tool (or framework if it abstracts the build tool) are you using?

Only using the CLI

What version of Node.js are you using?

v14.18.1 (we’re matching what Vercel runs in production)

What browser are you using?

Chrome

What operating system are you using?

macOS (Monterey)

Describe your issue

Run the CLI command:

npx tailwindcss@3.0.12

This is the result:

npx: installed 85 in 5.148s
Cannot find module 'postcss'
Require stack:
- /Users/USERNAME/.npm/_npx/35470/lib/node_modules/tailwindcss/lib/lib/generateRules.js
- /Users/USERNAME/.npm/_npx/35470/lib/node_modules/tailwindcss/lib/lib/expandTailwindAtRules.js
- /Users/USERNAME/.npm/_npx/35470/lib/node_modules/tailwindcss/lib/processTailwindFeatures.js
- /Users/USERNAME/.npm/_npx/35470/lib/node_modules/tailwindcss/lib/cli.js

Installing postcss globally or locally does not help.

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Reactions:4
  • Comments:14

github_iconTop GitHub Comments

3reactions
thecrypticacecommented, Feb 10, 2022

I think npm v7 is also supposed to install peer deps unless you have it configured to be turned off. I’m running npm v8 but only recently upgraded. Yarn would indeed have this issue.

The culprit here is the postcss-js upgrade because it previously had postcss listed in its own dependencies. It moved these to peerDependencies per the postcss plugin guidelines (https://github.com/postcss/postcss/blob/main/docs/guidelines/plugin.md#14-keep-postcss-to-peerdependencies). It wasn’t supposed to have been included. My recommendation is that we upgrade the CLI guide but I’ll start the discussion internally to see what steps we need to take. Thanks!

2reactions
thecrypticacecommented, Feb 11, 2022

Alright, we pushed out v3.0.22 with a temporary fix for this while we come up with a better solution. All the guides and stuff should be working again. Thanks for the report and sorry for all the trouble!

Read more comments on GitHub >

github_iconTop Results From Across the Web

PostCSS - "Error: cannot find module 'tailwindcss'" - HUGO
Hi, I started from a new site: $ hugo new site foo $ cd foo $ hugo mod init foo added this to...
Read more >
Loading PostCSS Plugin failed: Cannot find module 'tailwindcss'
The package is tailwindcss not tailwind : npm install -D tailwindcss postcss autoprefixer vite npm tailwindcss init.
Read more >
Using with Preprocessors - Tailwind CSS
A guide to using Tailwind with common CSS preprocessors like Sass, Less, and Stylus. Since Tailwind is a PostCSS plugin, there's nothing stopping...
Read more >
Cannot find module 'tailwindcss' error | bobbyhadz
To solve the error "Cannot find module 'tailwindcss'", install tailwindcss , postcss and autoprefixer as dev dependencies in your project by running npm...
Read more >
Open side panel - You.com
src/styles.css Module build failed (from . ... node_modules/postcss-loader/dist/cjs.js): TypeError: Cannot read property '0' ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

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