无法解析 primereact 下拉列表中的 'react-transition-group'
Can't resolve 'react-transition-group' in primereact dropdown
我收到以下错误-
Failed to compile
./node_modules/primereact/components/dropdown/DropdownPanel.js
Module not found: Can't resolve 'react-transition-group' in 'D:\my-app\node_modules\primereact\components\dropdown'
这是我的package.json
"dependencies": {
"@testing-library/jest-dom": "^5.11.4",
"@testing-library/react": "^11.1.0",
"@testing-library/user-event": "^12.1.10",
"@types/react-transition-group": "^4.4.1",
"primeflex": "^2.0.0",
"primeicons": "^4.1.0",
"primereact": "^6.1.0",
"react": "^17.0.1",
"react-dom": "^17.0.1",
"react-scripts": "4.0.3",
"web-vitals": "^1.0.1"
},
在App.js
import React, { useState } from 'react';
import { Dropdown } from 'primereact/dropdown'; //getting error after adding this line
import 'primeflex/primeflex.css';
我在这里错过了什么?
会不会是你只包含了类型,"@types/react-transition-group": "^4.4.1",
,但没有安装实际的包?
尝试使用 npm install react-transition-group
安装软件包。 @types/*
存储库仅包含类型,不包含代码。
我收到以下错误-
Failed to compile
./node_modules/primereact/components/dropdown/DropdownPanel.js
Module not found: Can't resolve 'react-transition-group' in 'D:\my-app\node_modules\primereact\components\dropdown'
这是我的package.json
"dependencies": {
"@testing-library/jest-dom": "^5.11.4",
"@testing-library/react": "^11.1.0",
"@testing-library/user-event": "^12.1.10",
"@types/react-transition-group": "^4.4.1",
"primeflex": "^2.0.0",
"primeicons": "^4.1.0",
"primereact": "^6.1.0",
"react": "^17.0.1",
"react-dom": "^17.0.1",
"react-scripts": "4.0.3",
"web-vitals": "^1.0.1"
},
在App.js
import React, { useState } from 'react';
import { Dropdown } from 'primereact/dropdown'; //getting error after adding this line
import 'primeflex/primeflex.css';
我在这里错过了什么?
会不会是你只包含了类型,"@types/react-transition-group": "^4.4.1",
,但没有安装实际的包?
尝试使用 npm install react-transition-group
安装软件包。 @types/*
存储库仅包含类型,不包含代码。