Tailwind CLI fails with "Cannot find module postcss" since v3.0.11
See original GitHub issueWhat 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:
- Created 2 years ago
- Reactions:4
- Comments:14
Top 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 >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
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 topeerDependencies
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!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!