7

I am trying out tailwindcss with my Vue project and while I solved some issue I had with the routing (while trying to break down my code into smaller components), I think I broke something else.

The code was compiling before I added my new routes. I can't seem to find what is wrong in this case.

Failed to compile.

./src/components/SiteHeader.vue?vue&type=style&index=0&lang=css& (./node_modules/css-loader/dist/cjs.js??ref--6-oneOf-1-1!./node_modules/vue-loader/lib/loaders/stylePostLoader.js!./node_modules/postcss-loader/src??ref--6-oneOf-1-2!./node_modules/cache-loader/dist/cjs.js??ref--0-0!./node_modules/vue-loader/lib??vue-loader-options!./src/components/SiteHeader.vue?vue&type=style&index=0&lang=css&)
Module build failed (from ./node_modules/postcss-loader/src/index.js):
Error: Cannot find module 'tailwindcss'

you can check out this repo, has very few files https://github.com/anaivanm/vue-tw/

2
  • 1
    Everything working fine having downloaded your repo and installed the packages. Had to fix the router config though, the component part must be a reference not a string. Could be that your node_modules is out of sync with the package-lock/yarn.lock files and you are missing the tailwind dependency?
    – yuriy636
    Commented Nov 9, 2019 at 22:45
  • I did fix that. Removed the quotes. Restarted the server and I still had that error. I don't really know how to sync node_modules, but I'll just clone the repo again and give it a shot. Thank you!
    – Ana Ivan
    Commented Nov 10, 2019 at 9:12

1 Answer 1

23

First :

npm run dev

Then

npm install -D tailwindcss@latest postcss@latest autoprefixer@latest

For More Info : Tailwind Docs

Also check this out :Restarting NPM

1
  • 3
    For those using yarn yarn add tailwindcss@latest postcss@latest autoprefixer@latest --dev
    – blockhead
    Commented Nov 5, 2021 at 7:03

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.