# Nextjs deploy error after installing remark-prism package

**URL:** <https://answers.netlify.com/t/nextjs-deploy-error-after-installing-remark-prism-package/40293>\
**Category:** Support\
**Tags:** deployment, nextjs\
**Created:** [July 3, 2021, 4:56pm UTC](https://answers.netlify.com/t/nextjs-deploy-error-after-installing-remark-prism-package/40293 "2021-07-03T16:56:39Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![gluethje](https://sea1.discourse-cdn.com/netlify/user_avatar/answers.netlify.com/gluethje/32/27112_2.png) [@gluethje](https://answers.netlify.com/u/gluethje)\
**Post date:** [July 3, 2021, 4:56pm UTC](https://answers.netlify.com/t/nextjs-deploy-error-after-installing-remark-prism-package/40293/1 "2021-07-03T16:56:39Z")

</div>

After installing remark-prism, I get this deploy error:

`ModuleNotFoundError: Module not found: Error: Can't resolve 'canvas' in '/opt/build/repo/node_modules/jsdom/lib/jsdom'`

The build does not fail locally, and the dev server also works fine.

It is mentioned in this github issue comment, but I am unsure of what the actual cause is, or how to fix it.

> <https://github.com/vercel/next.js/issues/16618#issuecomment-791788018>
>
> \# Bug report
> 
> \## Describe the bug
> 
> When doing a \`serverless\` build, the buil…d fails with \`ModuleNotFoundError: Module not found: Error: Can't resolve 'aws-sdk'\`
> I've trace it down to the \`bcrypt\` module being used in an api function. I assume since this module a server function running on the server side it should work. Running a normal \`server\` build does not produce any errors.
> 
> Here is the full error:
> \`\`\`
> \> next build
> 
> info - Creating an optimized production build
> Failed to compile.
> 
> ModuleNotFoundError: Module not found: Error: Can't resolve 'aws-sdk' in '/home/mike/test/nextjs-serverless-build/node\_modules/node-pre-gyp/lib'
> 
> 
> \> Build error occurred
> Error: \> Build failed because of webpack errors
> at build (/home/mike/test/nextjs-serverless-build/node\_modules/next/dist/build/index.js:15:918)
> at runMicrotasks (\<anonymous\>)
> at processTicksAndRejections (internal/process/task\_queues.js:93:5)
> npm ERR! code ELIFECYCLE
> npm ERR! errno 1
> npm ERR! test@0.1.0 build: \`next build\`
> npm ERR! Exit status 1
> npm ERR!
> npm ERR! Failed at the test@0.1.0 build script.
> npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
> 
> npm ERR! A complete log of this run can be found in:
> npm ERR! /home/mike/.npm/\_logs/2020-08-27T03\_25\_35\_982Z-debug.log
> \`\`\`
> 
> \## To Reproduce
> 
> I've created a repo from a barebones \`create-next-app\` example. The only change is \`pages/api/hello.js\` uses the \`bcrypt\` module and the \`next.config.js\` is set to \`serverless\`.
> 
> https://github.com/mikecao/nextjs-serverless-build
> 
> \## Expected behavior
> 
> Should not produce an error.
> 
> \## System information
> 
> \- OS: Ubuntu 20.04
> \- Version of Next.js: 9.5.2
> \- Version of Node.js: 14.8.0

---

<div class="post-metadata">

**Author:** ![hrishikesh](https://sea1.discourse-cdn.com/netlify/user_avatar/answers.netlify.com/hrishikesh/32/74607_2.png) [@hrishikesh](https://answers.netlify.com/u/hrishikesh)\
**Post date:** [July 5, 2021, 6:55am UTC](https://answers.netlify.com/t/nextjs-deploy-error-after-installing-remark-prism-package/40293/2 "2021-07-05T06:55:57Z")

</div>

The cause is that, the dependency needs another dependency which might not be installed. You might try installing the dependency yourself by adding it your `package.json` or try another workaround mentioned in that thread: [Serverless build fails with: ModuleNotFoundError: Module not found: Error: Can't resolve 'aws-sdk' · Issue #16618 · vercel/next.js · GitHub](https://github.com/vercel/next.js/issues/16618#issuecomment-778538334).

---

<div class="post-metadata">

**Author:** ![thefinnomenon](https://sea1.discourse-cdn.com/netlify/user_avatar/answers.netlify.com/thefinnomenon/32/28674_2.png) [@thefinnomenon](https://answers.netlify.com/u/thefinnomenon)\
**Post date:** [August 23, 2021, 8:50pm UTC](https://answers.netlify.com/t/nextjs-deploy-error-after-installing-remark-prism-package/40293/3 "2021-08-23T20:50:54Z")

</div>

Did you end up getting this to work? I am having the same issue.

---

<div class="post-metadata">

**Author:** ![hrishikesh](https://sea1.discourse-cdn.com/netlify/user_avatar/answers.netlify.com/hrishikesh/32/74607_2.png) [@hrishikesh](https://answers.netlify.com/u/hrishikesh)\
**Post date:** [August 26, 2021, 7:10am UTC](https://answers.netlify.com/t/nextjs-deploy-error-after-installing-remark-prism-package/40293/4 "2021-08-26T07:10:40Z")

</div>

Hi @thefinnomenon,

Have you tried the workarounds mentioned in the issue above? Can you share your progress with those?

---

<div class="post-metadata">

**Author:** ![Richard0017](https://avatars.discourse-cdn.com/v4/letter/r/ed8c4c/32.png) [@Richard0017](https://answers.netlify.com/u/Richard0017)\
**Post date:** [August 26, 2021, 7:33am UTC](https://answers.netlify.com/t/nextjs-deploy-error-after-installing-remark-prism-package/40293/5 "2021-08-26T07:33:35Z")

</div>

Did you have a fix on this issue? Facing same issue but no response from anyone. [Official Website](https://www.onevanilla.one/)

---

<div class="post-metadata">

**Author:** ![hrishikesh](https://sea1.discourse-cdn.com/netlify/user_avatar/answers.netlify.com/hrishikesh/32/74607_2.png) [@hrishikesh](https://answers.netlify.com/u/hrishikesh)\
**Post date:** [August 26, 2021, 8:46am UTC](https://answers.netlify.com/t/nextjs-deploy-error-after-installing-remark-prism-package/40293/6 "2021-08-26T08:46:01Z")

</div>

Hi @Richard0017,

Same question for you too. Have you tried what’s suggested above?
