当我运行 npm run dev
时,它找不到模块 @tailwindcss/jit
,我该如何解决?
$ npm run dev
> myproject@1.0.0 dev
> nuxt
WARN webpack@5.37.0 is installed but ^4.46.0 is expected 11:44:40
ℹ Merging Tailwind config from ~/tailwind.config.js nuxt:tailwindcss 11:44:40
ℹ Parsed 4 files in 0,6 seconds @nuxt/content 11:44:41
╭───────────────────────────────────────────────────────╮
│ │
│ Nuxt @ v2.15.5 │
│ │
│ ▸ Environment: development │
│ ▸ Rendering: server-side │
│ ▸ Target: server │
│ │
│ Listening: http://localhost:3003/ │
│ │
│ Tailwind Viewer: http://localhost:3003/_tailwind/ │
│ │
╰───────────────────────────────────────────────────────╯
ℹ Preparing project for development 11:44:43
ℹ Initial build may take a while 11:44:43
ℹ Tailwind JIT activated nuxt:tailwindcss 11:44:43
ℹ Discovered Components: .nuxt/components/readme.md 11:44:43
✔ Builder initialized 11:44:43
✔ Nuxt files generated 11:44:43
ERROR Cannot find module '@tailwindcss/jit' 11:44:43
Require stack:
- /Users/me/myproject/node_modules/@nuxt/core/dist/core.js
Require stack:
- node_modules/@nuxt/core/dist/core.js
at Function.Module._resolveFilename (internal/modules/cjs/loader.js:885:15)
at Function.resolve (internal/modules/cjs/helpers.js:94:19)
at m (node_modules/jiti/dist/jiti.js:1:52899)
at Resolver.f [as _require] (node_modules/jiti/dist/jiti.js:1:53712)
at Resolver.requireModule (node_modules/@nuxt/core/dist/core.js:381:29)
at node_modules/@nuxt/webpack/dist/webpack.js:792:58
at Array.map (<anonymous>)
at PostcssConfig.loadPlugins (node_modules/@nuxt/webpack/dist/webpack.js:791:10)
at PostcssConfig.config (node_modules/@nuxt/webpack/dist/webpack.js:830:14)
at StyleLoader.postcss (node_modules/@nuxt/webpack/dist/webpack.js:909:39)
at StyleLoader.apply (node_modules/@nuxt/webpack/dist/webpack.js:969:12)
at WebpackClientConfig.rules (node_modules/@nuxt/webpack/dist/webpack.js:1357:28)
at WebpackClientConfig.config (node_modules/@nuxt/webpack/dist/webpack.js:1537:21)
at WebpackClientConfig.config (node_modules/@nuxt/webpack/dist/webpack.js:1708:26)
at WebpackBundler.getWebpackConfig (node_modules/@nuxt/webpack/dist/webpack.js:2016:19)
at WebpackBundler.build (node_modules/@nuxt/webpack/dist/webpack.js:2023:12)
tailwind.config.js
:
module.exports = {
prefix: 'tw-',
purge: [],
darkMode: false, // or 'media' or 'class'
theme: {
extend: {},
},
variants: {
extend: {},
},
plugins: [],
}