Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can't resolve 'react-transition-group' in primereact dropdown

I am getting the following error-

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'

This is my 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"
},

In App.js

import React, { useState } from 'react';
import { Dropdown } from 'primereact/dropdown'; //getting error after adding this line
import 'primeflex/primeflex.css';

What am I missing here?

like image 340
s.k.paul Avatar asked Mar 14 '21 09:03

s.k.paul


1 Answers

Could it be that you only included the types, "@types/react-transition-group": "^4.4.1",, but did not install the actual package?

Try installing the package with npm install react-transition-group. The @types/* repo only contains types, not code.

like image 91
aryzing Avatar answered Sep 28 '22 09:09

aryzing