【问题标题】:Getting errors in tsconfig.json after adding Tailwindcss v3 to Nextjs (create-next-app --typescipt)将 Tailwind Css v3 添加到 Nextjs (create-next-app --typescript) 后,在 tsconfig.json 中出现错误
【发布时间】:2022-08-04 02:02:00
【问题描述】:

这是VS代码中的错误

Cannot find type definition file for \'accepts\'.
  The file is in the program because:
    Entry point for implicit type library \'accepts\'

我尝试使用 \"yarn add @types/accepts\" 为 \'accepts\' 安装类型,但随后它为 \"body-parser\" 显示相同的错误,并继续告诉我为我不知道的不同软件包。

包版本:

\"next\": \"^12.0.8\"
\"tailwindcss\": \"^3.0.15\",
\"postcss\": \"^8.4.5\",
\"autoprefixer\": \"^10.4.2\",
\"typescript\": \"^4.5.5\"

    标签: reactjs typescript visual-studio-code next.js tailwind-css


    【解决方案1】:

    我在运行next build 时出现了这个错误,并且找不到tailwindcss 的类型!在我的文件夹node_modules/@types/tailwindcss 中没有任何文件.d.ts 另一个文件夹存在具有类型规则的文件index.d.ts...我刚刚删除了@types/tailwindcss 的依赖项并工作了,也试试这个!

    如果您需要文件类型,请尝试创建自定义文件.d.ts

    【讨论】:

      猜你喜欢
      • 2023-01-02
      • 2018-08-28
      • 2022-01-18
      • 2018-08-04
      • 1970-01-01
      • 2018-11-15
      • 2022-01-10
      • 2022-01-18
      • 2022-10-01
      相关资源
      最近更新 更多