找不到模块“tailwindcss”

Ana*_*van 3 routing vue.js tailwind-css

我正在我的 Vue 项目中尝试使用 tailwindcss,虽然我解决了路由方面的一些问题(同时试图将我的代码分解成更小的组件),但我想我破坏了其他一些东西。

在我添加新路由之前,代码正在编译。在这种情况下,我似乎无法找到问题所在。

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'

Run Code Online (Sandbox Code Playgroud)

你可以查看这个 repo,文件很少https://github.com/anaivanm/vue-tw/

Hes*_*our 6

第一的 :

npm run dev
Run Code Online (Sandbox Code Playgroud)

然后

npm install -D tailwindcss@latest postcss@latest autoprefixer@latest
Run Code Online (Sandbox Code Playgroud)

更多信息: Tailwind 文档

另请查看:重新启动 NPM

  • 对于那些使用纱线 ```yarn 添加 tailwindcss@latest postcss@latest autoprefixer@latest --dev``` (3认同)