我按照https://tailwindcss.com/docs/installation和https://web-crunch.com/posts/how-to-install-tailwind-css-2-using-ruby-on-rails按照安装顺风
~/code/example % yarn add tailwindcss@npm:@tailwindcss/postcss7-compat postcss@^7 autoprefixer@^9
yarn add v1.22.4
[1/4] 🔍 Resolving packages...
[2/4] 🚚 Fetching packages...
[3/4] 🔗 Linking dependencies...
warning " > webpack-dev-server@3.11.0" has unmet peer dependency "webpack@^4.0.0 || ^5.0.0".
warning "webpack-dev-server > webpack-dev-middleware@3.7.2" has unmet peer dependency "webpack@^4.0.0".
[4/4] 🔨 Building fresh packages...
success Saved 0 new dependencies.
✨ Done in 3.87s.
当我试图删除它来安装最新版本时,我得到了这个错误:
~/code/example % yarn remove tailwindcss @tailwindcss/postcss7-compat
yarn remove v1.22.4
[1/3] 🗑 Removing module tailwindcss...
[2/3] 🗑 Removing module @tailwindcss/postcss7-compat...
error This module isn't specified in a package.json file.
info Visit https://yarnpkg.com/en/docs/cli/remove for documentation about this command.
我不完全理解去除纱线包装的工作原理——有人能帮忙吗?
如果你有错误
yarn install yarn install v0.27.5 warning ../package.json: No license field [1/4] Resolving packages... success Already up-to-date. Done in 0.09s.
试试这个npx clear-npx-cache
这个工作为我
我在从节点v16.10.0
升级到v17.4.0
后解决了这个问题。您也可以使用最新的稳定版本16.13.2。之后,您可以使用npm cache clean -f
清除缓存然后再次运行您的命令。