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?

2
  • What are you compiling with? What's the compile command? Commented Mar 14, 2021 at 9:34
  • @aryzing after adding "import { Dropdown } from 'primereact/dropdown';" Commented Mar 14, 2021 at 9:36

1 Answer 1

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.

Sign up to request clarification or add additional context in comments.

2 Comments

I used "npm install @types/react-transition-group"
try npm install react-transition-group

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.