[Next.js + Now serverless] Can't resolve 'child_process' in './node_modules/@prisma/photon/runtime'
See original GitHub issueI am using preview019
with a SQLite db
Photon sits in a file and being used everywhere
import { Photon } from "@prisma/photon";
export const photon = new Photon();
The initialization caused the problem if I change that to something like export const photon = 123;
, then this error goes away.
Maybe I get the initialization wrong? Should not reuse this instance?
The project is next.js v9, api is Now serverless, sits in pages/api
After running next
, the 1st render to index works, but go to any page will show the following error:
However, api is working: /api/graphql
is working:
anything to do with https://github.com/prisma/prisma2/issues/1021 ?
Issue Analytics
- State:
- Created 4 years ago
- Comments:13 (3 by maintainers)
Top Results From Across the Web
Module not found: Error can't resolve 'child_process', how to fix?
create (/home/fionn/anaconda3/envs/jupyterlab-ext/share/jupyter/lab/staging/node_modules/webpack/lib/Compilation.
Read more >Can I use Back4App with Next.js? - Google Groups
I want to Use Back4App in my Next.js project, but ... Module not found: Can't resolve 'child_process' in. and if I use. import...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
I here 👋
I made a minimal reproduction of the
child_process
error with Next.js.https://github.com/guillaumeLamanda/nextjs-prisma
Hope it can help
I had a similar issue. It seems that a generic package import, traverses all files underneath regardless of whether the methods are actually called:
import { clientSideMethod } from 'mypackage'
Actually first goes to the root index.js inside the package and calls:
Therefore the error was triggered. Solutions are:
Very simple to fix, but frustrating to find the cause!