无法在tailwind中使用daisyui,并且npm install未安装

r1wp621o  于 2023-03-30  发布在  其他
关注(0)|答案(2)|浏览(202)

我试图安装DaisyUI,通过npm i daisyui,它给我一个错误:

npm WARN ERESOLVE overriding peer dependency
npm WARN While resolving: react-reconciler@0.23.0
npm WARN Found: react@17.0.2
npm WARN node_modules/react
npm WARN   peer react@">=16.8.0" from @emotion/react@11.9.0
npm WARN   node_modules/@emotion/react
npm WARN     peer @emotion/react@"^11.0.0-rc.0" from @emotion/styled@11.8.1
npm WARN     node_modules/@emotion/styled
npm WARN     4 more (@mui/material, @mui/styled-engine, @mui/system, the root project)
npm WARN   35 more (@emotion/styled, @mui/base, @mui/icons-material, ...)
npm WARN
npm WARN Could not resolve dependency:
npm WARN peer react@"^16.0.0" from react-reconciler@0.23.0
npm WARN node_modules/react-reconciler
npm WARN   react-reconciler@"^0.23.0" from @react-pdf/renderer@2.1.1
npm WARN   node_modules/@react-pdf/renderer
npm WARN
npm WARN Conflicting peer dependency: react@16.14.0
npm WARN node_modules/react
npm WARN   peer react@"^16.0.0" from react-reconciler@0.23.0
npm WARN   node_modules/react-reconciler
npm WARN     react-reconciler@"^0.23.0" from @react-pdf/renderer@2.1.1
npm WARN     node_modules/@react-pdf/renderer
npm ERR! code ERESOLVE
npm ERR! ERESOLVE could not resolve
npm ERR!
npm ERR! While resolving: react-tradingview-widget@1.3.2
npm ERR! Found: react@17.0.2
npm ERR! node_modules/react
npm ERR!   peer react@">=16.8.0" from @emotion/react@11.9.0
npm ERR!   node_modules/@emotion/react
npm ERR!     peer @emotion/react@"^11.0.0-rc.0" from @emotion/styled@11.8.1
npm ERR!     node_modules/@emotion/styled
npm ERR!       peerOptional @emotion/styled@"^11.3.0" from @mui/material@5.8.1
npm ERR!       node_modules/@mui/material
npm ERR!         peer @mui/material@"^5.0.0" from @mui/icons-material@5.8.0
npm ERR!         node_modules/@mui/icons-material
npm ERR!         1 more (the root project)
npm ERR!       3 more (@mui/styled-engine, @mui/system, the root project)
npm ERR!     peerOptional @emotion/react@"^11.5.0" from @mui/material@5.8.1
npm ERR!     node_modules/@mui/material
npm ERR!       peer @mui/material@"^5.0.0" from @mui/icons-material@5.8.0
npm ERR!       node_modules/@mui/icons-material
npm ERR!         @mui/icons-material@"^5.8.0" from the root project
npm ERR!       1 more (the root project)
npm ERR!     3 more (@mui/styled-engine, @mui/system, the root project)
npm ERR!   peer react@">=16.8.0" from @emotion/styled@11.8.1
npm ERR!   node_modules/@emotion/styled
npm ERR!     peerOptional @emotion/styled@"^11.3.0" from @mui/material@5.8.1
npm ERR!     node_modules/@mui/material
npm ERR!       peer @mui/material@"^5.0.0" from @mui/icons-material@5.8.0
npm ERR!       node_modules/@mui/icons-material
npm ERR!         @mui/icons-material@"^5.8.0" from the root project
npm ERR!       1 more (the root project)
npm ERR!     peerOptional @emotion/styled@"^11.3.0" from @mui/styled-engine@5.8.0
npm ERR!     node_modules/@mui/styled-engine
npm ERR!       @mui/styled-engine@"^5.8.0" from @mui/system@5.8.1
npm ERR!       node_modules/@mui/system
npm ERR!         @mui/system@"^5.8.1" from @mui/material@5.8.1
npm ERR!         node_modules/@mui/material
npm ERR!     2 more (@mui/system, the root project)
npm ERR!   34 more (@mui/base, @mui/icons-material, @mui/material, ...)
npm ERR!
npm ERR! Could not resolve dependency:
npm ERR! peer react@"^16.0.0" from react-tradingview-widget@1.3.2
npm ERR! node_modules/react-tradingview-widget
npm ERR!   react-tradingview-widget@"^1.3.2" from the root project
npm ERR!
npm ERR! Conflicting peer dependency: react@16.14.0
npm ERR! node_modules/react
npm ERR!   peer react@"^16.0.0" from react-tradingview-widget@1.3.2
npm ERR!   node_modules/react-tradingview-widget
npm ERR!     react-tradingview-widget@"^1.3.2" from the root project
npm ERR!
npm ERR! Fix the upstream dependency conflict, or retry
npm ERR! this command with --force, or --legacy-peer-deps
npm ERR! to accept an incorrect (and potentially broken) dependency resolution.
npm ERR!
npm ERR! See /Users/alex/.npm/eresolve-report.txt for a full report.

npm ERR! A complete log of this run can be found in:
npm ERR!     /Users/alex/.npm/_logs/2022-09-26T02_27_08_062Z-debug-0.log

然后我尝试“npm i daisyui --force”,我可以看到依赖项在我的package.json文件中。然而,当我试图在“tailwind.config.js”中使用它时,通过插入plugins: [require("daisyui")],到文件中,然而vscode显示
无法找到模块“daisyui”的声明文件。“/Users/alex/Maqro-Portal-Frontend/node_modules/daisyui/src/index.js”隐式具有“any”类型。如果存在,请尝试npm i --save-dev @types/daisyui,或添加包含declare module 'daisyui'; ts的新声明(.d.ts)文件(7016)
然后我做npm i --save-dev @types/daisyui,终端给我错误

npm WARN ERESOLVE overriding peer dependency
npm WARN While resolving: react-reconciler@0.23.0
npm WARN Found: react@17.0.2
npm WARN node_modules/react
npm WARN   peer react@">=16.8.0" from @emotion/react@11.9.0
npm WARN   node_modules/@emotion/react
npm WARN     peer @emotion/react@"^11.0.0-rc.0" from @emotion/styled@11.8.1
npm WARN     node_modules/@emotion/styled
npm WARN     4 more (@mui/material, @mui/styled-engine, @mui/system, the root project)
npm WARN   35 more (@emotion/styled, @mui/base, @mui/icons-material, ...)
npm WARN
npm WARN Could not resolve dependency:
npm WARN peer react@"^16.0.0" from react-reconciler@0.23.0
npm WARN node_modules/react-reconciler
npm WARN   react-reconciler@"^0.23.0" from @react-pdf/renderer@2.1.1
npm WARN   node_modules/@react-pdf/renderer
npm WARN
npm WARN Conflicting peer dependency: react@16.14.0
npm WARN node_modules/react
npm WARN   peer react@"^16.0.0" from react-reconciler@0.23.0
npm WARN   node_modules/react-reconciler
npm WARN     react-reconciler@"^0.23.0" from @react-pdf/renderer@2.1.1
npm WARN     node_modules/@react-pdf/renderer
npm ERR! code ERESOLVE
npm ERR! ERESOLVE could not resolve
npm ERR!
npm ERR! While resolving: react-tradingview-widget@1.3.2
npm ERR! Found: react@17.0.2
npm ERR! node_modules/react
npm ERR!   peer react@">=16.8.0" from @emotion/react@11.9.0
npm ERR!   node_modules/@emotion/react
npm ERR!     peer @emotion/react@"^11.0.0-rc.0" from @emotion/styled@11.8.1
npm ERR!     node_modules/@emotion/styled
npm ERR!       peerOptional @emotion/styled@"^11.3.0" from @mui/material@5.8.1
npm ERR!       node_modules/@mui/material
npm ERR!         peer @mui/material@"^5.0.0" from @mui/icons-material@5.8.0
npm ERR!         node_modules/@mui/icons-material
npm ERR!         1 more (the root project)
npm ERR!       3 more (@mui/styled-engine, @mui/system, the root project)
npm ERR!     peerOptional @emotion/react@"^11.5.0" from @mui/material@5.8.1
npm ERR!     node_modules/@mui/material
npm ERR!       peer @mui/material@"^5.0.0" from @mui/icons-material@5.8.0
npm ERR!       node_modules/@mui/icons-material
npm ERR!         @mui/icons-material@"^5.8.0" from the root project
npm ERR!       1 more (the root project)
npm ERR!     3 more (@mui/styled-engine, @mui/system, the root project)
npm ERR!   peer react@">=16.8.0" from @emotion/styled@11.8.1
npm ERR!   node_modules/@emotion/styled
npm ERR!     peerOptional @emotion/styled@"^11.3.0" from @mui/material@5.8.1
npm ERR!     node_modules/@mui/material
npm ERR!       peer @mui/material@"^5.0.0" from @mui/icons-material@5.8.0
npm ERR!       node_modules/@mui/icons-material
npm ERR!         @mui/icons-material@"^5.8.0" from the root project
npm ERR!       1 more (the root project)
npm ERR!     peerOptional @emotion/styled@"^11.3.0" from @mui/styled-engine@5.8.0
npm ERR!     node_modules/@mui/styled-engine
npm ERR!       @mui/styled-engine@"^5.8.0" from @mui/system@5.8.1
npm ERR!       node_modules/@mui/system
npm ERR!         @mui/system@"^5.8.1" from @mui/material@5.8.1
npm ERR!         node_modules/@mui/material
npm ERR!     2 more (@mui/system, the root project)
npm ERR!   34 more (@mui/base, @mui/icons-material, @mui/material, ...)
npm ERR!
npm ERR! Could not resolve dependency:
npm ERR! peer react@"^16.0.0" from react-tradingview-widget@1.3.2
npm ERR! node_modules/react-tradingview-widget
npm ERR!   react-tradingview-widget@"^1.3.2" from the root project
npm ERR!
npm ERR! Conflicting peer dependency: react@16.14.0
npm ERR! node_modules/react
npm ERR!   peer react@"^16.0.0" from react-tradingview-widget@1.3.2
npm ERR!   node_modules/react-tradingview-widget
npm ERR!     react-tradingview-widget@"^1.3.2" from the root project
npm ERR!
npm ERR! Fix the upstream dependency conflict, or retry
npm ERR! this command with --force, or --legacy-peer-deps
npm ERR! to accept an incorrect (and potentially broken) dependency resolution.
npm ERR!
npm ERR! See /Users/alex/.npm/eresolve-report.txt for a full report.

npm ERR! A complete log of this run can be found in:
npm ERR!     /Users/alex/.npm/_logs/2022-09-26T02_33_39_239Z-debug-0.log

如何解决这个问题?谢谢。

bvuwiixz

bvuwiixz1#

您可以尝试删除node_modules文件夹和package-lock.json,然后执行
npm install daisyui

ttisahbt

ttisahbt2#

我有两个建议
1.删除node_modulespackage-lock.json并重新安装DaisyUIreact-daisyui
1.您可以尝试安装DaisyUi,版本为npm i daisyui@0.1.10

相关问题