Next.js Discord

Discord Forum

Package works in create-next-app but not my existing app

Unanswered
Reddish carpenter ant posted this in #help-forum
Open in Discord
Reddish carpenter antOP
I've been trying to use a package installed via npm (https://github.com/ae9is/react-fontpicker) but have been running into some difficulties in getting it to work with my existing Next.js app:

⨯ ./node_modules/react-fontpicker-ts/dist/sprite.1-S3RIP6YW.svg TypeError: Cannot read properties of undefined (reading '0') at Array.filter (<anonymous>)

However, I created a new Next.js app via create-next-app@latest and the package worked perfectly, so it seems that there's some error with my existing application's config/node_modules/cache/I'm not sure what.

What's the best way for me to nuke all existing installations, configs, etc.? I've tried to update next, react, react-dom, and the rest to @latest as well as clearing cache, deleting .next and node_modules, but I still seem to run into the same error.

I've attached a pic of my package.json for reference...

1 Reply

Reddish carpenter antOP
Closing issue, figured it out after a while:

the svgr package was causing some sort of svg issue. Commenting out svgr in my next config seemed to do the trick!