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.

`yarn rw setup tailwind` fails if packages already installed or if imports exist in `index.css`

See original GitHub issue

Continued from https://github.com/redwoodjs/redwood/issues/1223

Note: --force option does not resolve the issue

Error output:

$ yarn rw setup tailwind
yarn run v1.22.4
$ C:\Users\tobbe\dev\redwood\rw20\node_modules\.bin\rw setup tailwind
  √ Installing packages...
  √ Configuring PostCSS...
  × Initializing Tailwind CSS...
    → info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
    Adding imports to index.css...
    One more thing...
Command failed with exit code 1: yarn tailwindcss init
error Command "tailwindcss" not found.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
Done in 25.85s.

What’s happening is that either:

  • the installed packages are already present …and/or…
  • the tailwind imports already exist in index.css

Note: if either of the config files exist, the error output makes sense and states the issue accurately. But the error given above is confusing and inaccurate.

Way to reproduce:

  1. Successfully run yarn rw setup tailwind
  2. Remove the postcss config file rm web/config/postcss.config.js
  3. Remove the tailwind config file rm web/tailwind.config.js
  4. Run yarn rw setup tailwind again

From @Tobbe

Now it might seem like a strange/contrived thing to do to remove the config files. But say you’re new, and screw something up with the config. You decide to delete the config files to try to start over again. It won’t work.

So I think yarn rw setup tailwind should re-create any missing config files (it does for the postcss config file already). And it could also have a --force option to recreate/override config files even if they already exist

How to improve

  • In case of only packages already existing but no files or imports present, this command should work
  • In case of imports already present, the command should fail but give accurate explanation
  • Using --force should allow the command to run regardless of what is present

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Reactions:1
  • Comments:26 (26 by maintainers)

github_iconTop GitHub Comments

1reaction
mohinderpscommented, Oct 27, 2020

@thedavidprice, created PR https://github.com/redwoodjs/redwood/pull/1407. This is just to show you the work. Feel free to suggest any kind of changes. Would be more than happy to work on them.

1reaction
mohinderpscommented, Oct 23, 2020

Yes, makes sense @thedavidprice. Thank you.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Tailwind import failed - Stack Overflow
After some time looking trough my code I've found that if I remove these import at the top of my global.scss the app...
Read more >
How to build a full-stack app in RedwoodJS - LogRocket Blog
Setting up TailwindCSS. Installing TailwindCSS is straightforward; run the following command in the root directory: yarn rw setup ui ...
Read more >
Webpack Configuration | RedwoodJS Docs
While you can configure webpack dev server using web/config/webpack.config.js , it's often simpler to use yarn rw dev 's --forward option. For example,...
Read more >
Webpack Configuration : RedwoodJS Docs
This is the config used when building for production ( yarn rw build ). There's not much here right now. # webpack.stat.js. Redwood...
Read more >
IntelliJ IDEA 2022.3 (223.7571.182 build) Release Notes
Usability, IDEA-299516, Maven project import is blocked by indexing ... Cosmetics, IDEA-303168, Install-Windows-zip.txt instructions are out of date since ...
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