Can't resolve 'react-transition-group' in primereact dropdown
Asked Answered
B

1

13

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?

Benedictus answered 14/3, 2021 at 9:30 Comment(2)
What are you compiling with? What's the compile command?Latrena
@Latrena after adding "import { Dropdown } from 'primereact/dropdown';"Benedictus
L
22

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.

Latrena answered 14/3, 2021 at 9:36 Comment(2)
I used "npm install @types/react-transition-group"Benedictus
try npm install react-transition-groupLatrena

© 2022 - 2024 — McMap. All rights reserved.