找不到模块“flowbite/plugin”的声明文件

Adi*_*tra 8 reactjs tailwind-css tailwind-in-js flowbite

所以我使用 flowbite 和 tailwind css 来开发我的 React 应用程序。我遵循了他们的网站中提到的所有标准安装程序,以使用 React 设置 Flowbite,请在此处参考文档: https: //flowbite.com/docs/getting-started/react/

\n

因此,在完成基本设置过程后,我的 tailwind 文件如下所示:

\n
module.exports = {\n    content: [\'./src/**/*.{js,jsx,ts,tsx}\', \'./node_modules/flowbite/**/*.js\'],\n    theme: {\n        extend: {},\n    },\n    plugins: [require(\'flowbite/plugin\')],\n}\n    \n
Run Code Online (Sandbox Code Playgroud)\n

当我需要 Flowbite 插件时,我不断收到的错误是:

\n
    > Could not find a declaration file for module \'flowbite/plugin\'.\n    > \'C:/dev/flowbite-test/node_modules/flowbite/plugin.js\' implicitly has\n    > an \'any\' type.   Try `npm i --save-dev @types/flowbite` if it exists\n    > or add a new declaration (.d.ts) file containing `declare module\n    > \'flowbite/plugin\';`\n    \n
Run Code Online (Sandbox Code Playgroud)\n

这里还有我的 app.js 和 index.js 供参考:

\n

\r\n
\r\n
module.exports = {\n    content: [\'./src/**/*.{js,jsx,ts,tsx}\', \'./node_modules/flowbite/**/*.js\'],\n    theme: {\n        extend: {},\n    },\n    plugins: [require(\'flowbite/plugin\')],\n}\n    \n
Run Code Online (Sandbox Code Playgroud)\r\n
\r\n
\r\n

\n

\r\n
\r\n
    > Could not find a declaration file for module \'flowbite/plugin\'.\n    > \'C:/dev/flowbite-test/node_modules/flowbite/plugin.js\' implicitly has\n    > an \'any\' type.   Try `npm i --save-dev @types/flowbite` if it exists\n    > or add a new declaration (.d.ts) file containing `declare module\n    > \'flowbite/plugin\';`\n    \n
Run Code Online (Sandbox Code Playgroud)\r\n
\r\n
\r\n

\n

我看到了一些关于向 package.json 文件添加几行的帖子,我也尝试过但没有成功,我的 package.json 文件在这里:

\n
{\n  "name": "flowbite-test",\n  "version": "0.1.0",\n  "private": true,\n  "typings": "dist/src/index",\n  "main": "dist/index",\n  "dependencies": {\n    "@testing-library/jest-dom": "^5.16.4",\n    "@testing-library/react": "^13.2.0",\n    "@testing-library/user-event": "^13.5.0",\n    "flowbite": "^1.4.5",\n    "react": "^18.1.0",\n    "react-dom": "^18.1.0",\n    "react-scripts": "5.0.1",\n    "web-vitals": "^2.1.4"\n  },\n  "scripts": {\n    "start": "react-scripts start",\n    "build": "react-scripts build",\n    "test": "react-scripts test",\n    "eject": "react-scripts eject"\n  },\n  "eslintConfig": {\n    "extends": [\n      "react-app",\n      "react-app/jest"\n    ]\n  },\n  "browserslist": {\n    "production": [\n      ">0.2%",\n      "not dead",\n      "not op_mini all"\n    ],\n    "development": [\n      "last 1 chrome version",\n      "last 1 firefox version",\n      "last 1 safari version"\n    ]\n  },\n  "devDependencies": {\n    "autoprefixer": "^10.4.7",\n    "postcss": "^8.4.13",\n    "tailwindcss": "^3.0.24"\n  }\n}\n
Run Code Online (Sandbox Code Playgroud)\n

有人可以帮我解决这个问题吗,因此我无法在反应中使用手风琴、模态和轮播交互

\n

小智 -2

尝试应用此更改

plugins: [require("/node_modules/flowbite/plugin.js")],
Run Code Online (Sandbox Code Playgroud)