Hello welcome to this post.
Straight to the answer, here it goes:
Tried running first nextjs app
λ npm run dev
> developfe-dev@1.0.0 dev
> next
ready - started server on 0.0.0.0:3000, url: http://localhost:3000
info - Loaded env from F:\windows\developapp\code\.env
info - Using webpack 5. Reason: Enabled by default https://nextjs.org/docs/messages/webpack5
error - ./node_modules/@apollo/client/cache/core/cache.js:1:0
Module not found: Can't resolve 'optimism'
Import trace for requested module:
./node_modules\@apollo\client\cache\index.js
./node_modules\@apollo\client\core\index.js
./node_modules\@apollo\client\index.js
./pages\_app.js
https://nextjs.org/docs/messages/module-not-found
Terminate batch job (Y/N)?
^C
Next reinstalled package
F:\windows\developapp\code (main -> origin) (developfe-dev@1.0.0)
λ npm i @apollo/client@latest --save
added 9 packages, changed 1 package, and audited 1119 packages in 13s
90 packages are looking for funding
run `npm fund` for details
6 vulnerabilities (4 low, 2 high)
To address issues that do not require attention, run:
npm audit fix
Some issues need review, and may require choosing
a different dependency.
Run `npm audit` for details.
Then run again! boom!
F:\windows\developapp\code (main -> origin) (developfe-dev@1.0.0)
λ npm run dev
> developfe-dev@1.0.0 dev
> next
ready – started server on 0.0.0.0:3000, url: http://localhost:3000
info – Loaded env from F:\windows\developapp\code\.env
info – Using webpack 5. Reason: Enabled by default https://nextjs.org/docs/messages/webpack5
event – compiled successfully
So, here is the simple answer to the question.
Thanks for reading and Happy Learning!