Deploying Error on prismic_dom module

I’m trying to deploy a small application using Svelte[Kit] + Prismic and I’m running into error when trying to acess it:
https://cranky-yonath-43f7d1.netlify.app/

{"errorType":"Error","errorMessage":"Cannot find package 'prismic-dom' imported from /var/task/src/app.mjs","trace":["Error [ERR_MODULE_NOT_FOUND]: Cannot find package 'prismic-dom' imported from /var/task/src/app.mjs"," at packageResolve (internal/modules/esm/resolve.js:650:9)"," at moduleResolve (internal/modules/esm/resolve.js:691:18)"," at Loader.defaultResolve [as _resolve] (internal/modules/esm/resolve.js:784:11)"," at Loader.resolve (internal/modules/esm/loader.js:100:40)"," at Loader.getModuleJob (internal/modules/esm/loader.js:246:28)"," at ModuleWrap.<anonymous> (internal/modules/esm/module_job.js:47:40)"," at link (internal/modules/esm/module_job.js:46:36)"]}

The Build runs normally but the error occurs when trying to access the url.
I’ve ran the build locally and everything works, npm run dev and also npm run build (which build over ‘@sveltejs/adapter-netlify’

Does anyone have a clue on what’s happening?
Thank you in advance.

hi there, any chance the dependency you need is listed in devDependencies instead of dependencies in your package.json? that would affect availability at runtime, i think.

Hey Perry
Yes the prismic-dom is installed as devDependency, I tried to install it as dependency instead but then the my project doens’t work.

Here’s what my package.json looks like:
{
“name”: “svelte-prismic”,
“version”: “0.0.1”,
“scripts”: {
“dev”: “svelte-kit dev”,
“build”: “svelte-kit build”,
“start”: “svelte-kit start”
},
“devDependencies”: {
@prismicio/client”: “^4.0.0”,
@sveltejs/adapter-netlify”: “^1.0.0-next.4”,
@sveltejs/adapter-node”: “next”,
@sveltejs/kit”: “next”,
“prismic-dom”: “^2.2.5”,
“svelte”: “^3.29.0”,
“vite”: “^2.1.0”
},
“type”: “module”
}

Hey @eurmarcelo,

This is Sam from Prismic. Did you try installing the adapter @next?

Sam

1 Like

Yes I did. The build process is working fine.

The issue seems to be with the Svelte Kit/Vite solution about SSR. I found others having the same problem at Discord forum.

I’m using the @prismicio/client and prismic-dom packages as devDependency, I tried to use them as normal dependency, but that didn’t work. Here’s where I think the issue is.

Unfortunately I couldn’t figure out the solution yet.

welcome sam! great to have you here in our forums :smiley: :netliheart:

Hey guys just to update. I found a solution!
I switched the adapter from netlify@next to static@next and now it’s working!

2 Likes

fantastic! thank you for sharing!