s.k.paul
s.k.paul

Reputation: 7291

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?

Upvotes: 13

Views: 15934

Answers (1)

aryzing
aryzing

Reputation: 5867

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.

Upvotes: 22

Related Questions