Skip to content
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

tailwindcss: "Can't resolve 'tailwindcss'" error occurs when attempting to build CSS file #205505

Open
4 tasks done
nint8835 opened this issue Jan 25, 2025 · 4 comments
Open
4 tasks done
Labels
upstream issue An upstream issue report is needed

Comments

@nint8835
Copy link

nint8835 commented Jan 25, 2025

brew gist-logs <formula> link OR brew config AND brew doctor output

~/Development/issue-repro
❯ brew config
HOMEBREW_VERSION: 4.4.17
ORIGIN: https://github.com/Homebrew/brew
HEAD: 55f399c10dc7e6cc07497bdfccdecc96329e3b57
Last commit: 6 days ago
Branch: stable
Core tap JSON: 25 Jan 17:45 UTC
Core cask tap JSON: 25 Jan 17:45 UTC
HOMEBREW_PREFIX: /opt/homebrew
HOMEBREW_CASK_OPTS: []
HOMEBREW_MAKE_JOBS: 8
Homebrew Ruby: 3.3.7 => /opt/homebrew/Library/Homebrew/vendor/portable-ruby/3.3.7/bin/ruby
CPU: octa-core 64-bit arm_ibiza
Clang: 16.0.0 build 1600
Git: 2.39.5 => /Library/Developer/CommandLineTools/usr/bin/git
Curl: 8.7.1 => /usr/bin/curl
macOS: 15.2-arm64
CLT: 16.2.0.0.1.1733547573
Xcode: N/A
Rosetta 2: false

~/Development/issue-repro
❯ brew doctor
Your system is ready to brew.

Verification

  • My brew doctor output says Your system is ready to brew. and am still able to reproduce my issue.
  • I ran brew update and am still able to reproduce my issue.
  • I have resolved all warnings from brew doctor and that did not fix my problem.
  • I searched for recent similar issues at https://github.com/Homebrew/homebrew-core/issues?q=is%3Aissue and found no duplicates.

What were you trying to do (and why)?

I am attempting to use the version of the Tailwind CLI available through Homebrew to bundle a CSS file for my project using Tailwind. Since upgrading to V4, this no longer works. It does, however, work through the latest release of the CLI downloaded from their GitHub

What happened (include all command output)?

❯ tailwindcss -i index.css -o output.css
Error: Can't resolve 'tailwindcss' in '/Users/nint8835/Development/issue-repro'

What did you expect to happen?

I expected the file to build successfully, as occurs with the version of the Tailwind CLI file I downloaded from the GitHub release (https://github.com/tailwindlabs/tailwindcss/releases/tag/v4.0.0)

❯ ./tailwindcss-macos-arm64 -i index.css -o output.css
≈ tailwindcss v4.0.0

Done in 30ms

Step-by-step reproduction instructions (by running brew commands)

  • Create a new directory to perform repro in

  • Create an index.css containing the bare minimum to use Tailwind

    @import "tailwindcss";
  • Install Tailwind via brew (brew install tailwindcss)

  • Attempt to build your index.css (tailwindcss -i index.css -o output.css)

You should get the error Error: Can't resolve 'tailwindcss' in <current working directory>

You should not get an error, and output.css should be generated successfully

I have had another person test this and confirm they were able to reproduce the same

@nint8835 nint8835 added the bug Reproducible Homebrew/homebrew-core bug label Jan 25, 2025
@daeho-ro
Copy link
Member

Is this still happen? My brand-new installation of tailwindcss is working good, no errors.

m4 pro 15.3

@nint8835
Copy link
Author

Yes, still running into this

@DanielPower
Copy link

DanielPower commented Jan 29, 2025

I can reproduce the error following the steps provided, with a fresh install of tailwindcss.

@branchvincent
Copy link
Member

Thanks for the report, this looks like an upstream issue where the CLI assumes it can resolve the tailwindcss package from a node_modules folder in CWD/its parents (which isn't the case in a standard npm install -g installation like we do or even just via an isolated npx):

$ cd "$(mktemp -d)"
$ npx -p @tailwindcss/cli tailwindcss --watch
Error: Can't resolve 'tailwindcss' in ...

I assume this is unintentional. Their standalone binary uses different resolution logic and so isn't affected. Someone has already raised a discussion tailwindlabs/tailwindcss#15873 but I don't see a bug report yet

@branchvincent branchvincent added upstream issue An upstream issue report is needed and removed bug Reproducible Homebrew/homebrew-core bug labels Jan 30, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
upstream issue An upstream issue report is needed
Projects
None yet
Development

No branches or pull requests

4 participants