Module not found: Can't resolve 'prop-types' for NextJS project
aditodkar opened this issue · comments
Aditya Todkar commented
I am trying to use react-csv package with nextJS but unable to use it due to following error:
error - ./node_modules/react-csv/lib/metaProps.js:12:0
Module not found: Can't resolve 'prop-types'
Import trace for requested module:
./node_modules/react-csv/lib/components/Download.js
./node_modules/react-csv/lib/index.js
./node_modules/react-csv/index.js
Package.json:
"react-csv": "^2.2.0",
and react version: react@18.2.0
dexi-symph-dev commented
@aditodkar were you able to find a fix for this error?
aaronmcdavid commented
The problem, as best I understand, is that prop-types is listed as a devDependency but is actually a runtime dependency. For the same reason, react-csv does not work in yarn PnP.
Aditya Todkar commented
Use patch package to solve the issue.