<p>I am facing this error when building nextjs app.</p>
<hr />
<pre><code>Error: Cannot find module 'crypto'
    at webpackEmptyContext (C:\Users\User\Desktop\my-project\app_name\packages\website\.next\server\chunks\648.js:9:10)
    at __wbg_require_6461b1e9a0d7c34a (C:\Users\User\Desktop\equine\dev-client-equine\packages\website\.next\server\chunks\8571.js:19424:109)
    at &lt;rand_os::wasm32_bindgen::OsRng as rand_os::OsRngImpl&gt;::new::h9c7a4b6a2b8ae92f (wasm://wasm/00a9b126:wasm-function[1724]:0x13a630)
    at rand_os::OsRng::new::he9ba4878a48d4dc5 (wasm://wasm/00a9b126:wasm-function[4526]:0x1bbe8c)
    at cardano_serialization_lib::crypto::Bip32PrivateKey::generate_ed25519_bip32::h0e42fd6e7efb4205 (wasm://wasm/00a9b126:wasm-function[1262]:0x117108)
    at bip32privatekey_generate_ed25519_bip32 (wasm://wasm/00a9b126:wasm-function[4677]:0x1c069e)
    at Function.generate_ed25519_bip32 (C:\Users\User\Desktop\my-project\app_name\packages\website\.next\server\chunks\8571.js:2163:83)
    at C:\Users\User\Desktop\my-project\app_name\packages\website\.next\server\chunks\648.js:4522:165 {
  type: 'Error',
  code: 'MODULE_NOT_FOUND'
</code></pre>
<p>My package.json dependencies:</p>
<pre><code> &quot;dependencies&quot;: {
    &quot;@apollo/client&quot;: &quot;^3.6.9&quot;,
    &quot;@emurgo/cardano-serialization-lib-browser&quot;: &quot;^11.0.5&quot;,
    &quot;@emurgo/cardano-serialization-lib-nodejs&quot;: &quot;^11.1.0&quot;,
    &quot;axios&quot;: &quot;^0.27.2&quot;,
    &quot;big-integer&quot;: &quot;^1.6.51&quot;,
    &quot;classnames&quot;: &quot;^2.3.1&quot;,
    &quot;cookie&quot;: &quot;^0.5.0&quot;,
    &quot;cookies-next&quot;: &quot;^2.1.1&quot;,
    &quot;formik&quot;: &quot;^2.2.9&quot;,
    &quot;graphql&quot;: &quot;^16.6.0&quot;,
    &quot;js-cookie&quot;: &quot;^3.0.1&quot;,
    &quot;next&quot;: &quot;12.2.2&quot;,
    &quot;react&quot;: &quot;18.2.0&quot;,
    &quot;react-cookie&quot;: &quot;^4.1.1&quot;,
    &quot;react-dom&quot;: &quot;18.2.0&quot;,
    &quot;react-modal&quot;: &quot;^3.15.1&quot;,
    &quot;react-responsive&quot;: &quot;^9.0.0-beta.10&quot;,
    &quot;react-youtube&quot;: &quot;^9.0.3&quot;,
    &quot;replace-in-file&quot;: &quot;^6.3.5&quot;,
    &quot;swiper&quot;: &quot;^8.3.1&quot;,
    &quot;yup&quot;: &quot;^0.32.11&quot;
  },
  &quot;devDependencies&quot;: {
    &quot;@types/js-cookie&quot;: &quot;^3.0.2&quot;,
    &quot;@types/node&quot;: &quot;18.0.3&quot;,
    &quot;@types/react&quot;: &quot;18.0.15&quot;,
    &quot;@types/react-dom&quot;: &quot;18.0.6&quot;,
    &quot;@types/react-modal&quot;: &quot;^3.13.1&quot;,
    &quot;crypto&quot;: &quot;^1.0.1&quot;,
    &quot;eslint&quot;: &quot;8.19.0&quot;,
    &quot;eslint-config-next&quot;: &quot;12.2.2&quot;,
    &quot;jest&quot;: &quot;^29.0.3&quot;,
    &quot;next-intercept-stdout&quot;: &quot;^1.0.1&quot;,
    &quot;sass&quot;: &quot;^1.53.0&quot;,
    &quot;ts-jest&quot;: &quot;^29.0.1&quot;,
    &quot;typescript&quot;: &quot;4.7.4&quot;
  },
</code></pre>
<p>I installed crypto as devDependency to check if it will resolve issue. Failure.
I installed emurgo nodejs to check if it will resolve issue. Failure.</p>

CC BY-SA 4.0
2022-11-09T12:36:20.170Z
What guide are you running off of? Please post the link to the guide.
MC_Brisbane - JUST Pool
CC BY-SA 4.0
2022-11-17T11:08:10.103Z
What do you mean by guide ?

I have the private api file(cant share), on React (create-react-app) project works fine, but for NextJS this happens.
Jeffrey Abra
<emurgo>
NextJS build - Error: Cannot find module 'crypto'
# NextJS build - Error: Cannot find module 'crypto'

(Asked by: username_0 on 2022-11-08)

I am facing this error when building nextjs app.

Error: Cannot find module 'crypto'
    at webpackEmptyContext (C:\Users\User\Desktop\my-project\app_name\packages\website\.next\server\chunks\648.js:9:10)
    at __wbg_require_6461b1e9a0d7c34a (C:\Users\User\Desktop\equine\dev-client-equine\packages\website\.next\server\chunks\8571.js:19424:109)
    at ::new::h9c7a4b6a2b8ae92f (wasm://wasm/00a9b126:wasm-function[1724]:0x13a630)
    at rand_os::OsRng::new::he9ba4878a48d4dc5 (wasm://wasm/00a9b126:wasm-function[4526]:0x1bbe8c)
    at cardano_serialization_lib::crypto::Bip32PrivateKey::generate_ed25519_bip32::h0e42fd6e7efb4205 (wasm://wasm/00a9b126:wasm-function[1262]:0x117108)
    at bip32privatekey_generate_ed25519_bip32 (wasm://wasm/00a9b126:wasm-function[4677]:0x1c069e)
    at Function.generate_ed25519_bip32 (C:\Users\User\Desktop\my-project\app_name\packages\website\.next\server\chunks\8571.js:2163:83)
    at C:\Users\User\Desktop\my-project\app_name\packages\website\.next\server\chunks\648.js:4522:165 {
  type: 'Error',
  code: 'MODULE_NOT_FOUND'

My package.json dependencies:
 "dependencies": {
    "@apollo/client": "^3.6.9",
    "@emurgo/cardano-serialization-lib-browser": "^11.0.5",
    "@emurgo/cardano-serialization-lib-nodejs": "^11.1.0",
    "axios": "^0.27.2",
    "big-integer": "^1.6.51",
    "classnames": "^2.3.1",
    "cookie": "^0.5.0",
    "cookies-next": "^2.1.1",
    "formik": "^2.2.9",
    "graphql": "^16.6.0",
    "js-cookie": "^3.0.1",
    "next": "12.2.2",
    "react": "18.2.0",
    "react-cookie": "^4.1.1",
    "react-dom": "18.2.0",
    "react-modal": "^3.15.1",
    "react-responsive": "^9.0.0-beta.10",
    "react-youtube": "^9.0.3",
    "replace-in-file": "^6.3.5",
    "swiper": "^8.3.1",
    "yup": "^0.32.11"
  },
  "devDependencies": {
    "@types/js-cookie": "^3.0.2",
    "@types/node": "18.0.3",
    "@types/react": "18.0.15",
    "@types/react-dom": "18.0.6",
    "@types/react-modal": "^3.13.1",
    "crypto": "^1.0.1",
    "eslint": "8.19.0",
    "eslint-config-next": "12.2.2",
    "jest": "^29.0.3",
    "next-intercept-stdout": "^1.0.1",
    "sass": "^1.53.0",
    "ts-jest": "^29.0.1",
    "typescript": "4.7.4"
  },

I installed crypto as devDependency to check if it will resolve issue. Failure.
I installed emurgo nodejs to check if it will resolve issue. Failure.

**Tags:** emurgo
> **Comments:**
> **username_1**: What guide are you running off of? Please post the link to the guide.  
> **username_0**: What do you mean by guide ?  I have the private api file(cant share), on React (create-react-app) project works fine, but for NextJS this happens.  

---

## 0 answers

