question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Error resolving module specifier “.prisma/client/index-browser”.

See original GitHub issue

Describe the bug

I have the following error message in my browser upon using sveltekit (adaptor-node) and the command “npm run preview”:

Uncaught TypeError: Error resolving module specifier “.prisma/client/index-browser”. Relative module specifiers must start with “./”, “../” or “/”.

It references a piece of code that was compiled with “npm run build” in localhost:3000/_app/start-b07b1607.js:

...s-d1fb5791.js";import".prisma/client/index-browser";let Be="",et="";function ...

However, it is unclear why this piece of code was inserted by npm run build. Is there a way to remove it?

Reproduction

I have tried reproducing this error with using older versions of Prisma, the adaptor and Svelte, switching from pnpm to npm, but nothing helps. I have a MWE repository that comes close to reproducing the error but doesn’t actually reproduce it at https://github.com/wvhulle/prisma-sveltekit-bug-report.

Logs

`Uncaught TypeError: Error resolving module specifier “.prisma/client/index-browser”. Relative module specifiers must start with “./”, “../” or “/”.`

System Info

System:
    OS: Linux 5.14 Linux Mint 20.3 (Una)
    CPU: (8) x64 11th Gen Intel(R) Core(TM) i5-1145G7 @ 2.60GHz
    Memory: 4.41 GB / 15.37 GB
    Container: Yes
    Shell: 3.4.0 - /usr/bin/fish
  Binaries:
    Node: 17.8.0 - /usr/bin/node
    npm: 8.5.5 - /usr/bin/npm
  Browsers:
    Chromium: 99.0.4844.82
    Firefox: 98.0.2
  npmPackages:
    @sveltejs/adapter-node: next => 1.0.0-next.73 
    @sveltejs/kit: next => 1.0.0-next.303 
    svelte: ^3.46.4 => 3.46.4 

Severity

blocking all usage of SvelteKit

Additional Information

No response

Issue Analytics

  • State:closed
  • Created a year ago
  • Reactions:3
  • Comments:5 (2 by maintainers)

github_iconTop GitHub Comments

3reactions
Rich-Harriscommented, Apr 23, 2022

Closing as there’s nothing we can do here - vite doesn’t support enums, because esbuild doesn’t. Libraries generally shouldn’t be distributing code with enums IMHO

1reaction
DeepDogecommented, May 24, 2022

this is not an enum issue, node_modules/.prisma contains generated js files. index.js and index-browser.js doesn’t have real enums, they only have objects mapping the enums.

My not too elegant solution: https://github.com/prisma/prisma/issues/12504#issuecomment-1136126199

Read more comments on GitHub >

github_iconTop Results From Across the Web

No results found

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found