Next.js Discord

Discord Forum

Instrumentation error

Unanswered
LeonTM posted this in #help-forum
Open in Discord
Hello, I am continously running into an issue with the dotenv package and my instrumentation. I am running the dotenv.config() function there, so I dont have to do it all the time afterwards, but for some reason it always throws the error:
./node_modules/dotenv/lib/main.js:4:1
Module not found: Can't resolve 'crypto'

I do not know how to fix it, I tried the ways the dotenv package suggested => didnt work
I also tried asking StackOverflow and GitHub Copilot, both didnt know a shit.

Does somebody here know how to fix it?

3 Replies

The error after running "npm run dev"
Webpack config as suggested by dotenv package:
My installed packages: