我得到以下错误-
Failed to compile
./node_modules/primereact/components/dropdown/DropdownPanel.js
Module not found: Can't resolve 'react-transition-group' in 'D:my-appnode_modulesprimereactcomponentsdropdown'
这是我的包.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/*
repo只包含类型,不包含代码。