title: How to fix Next.js Vercel deployment module not found error
body: <p>My next.js app works on my machine and was working when deployed on Vercel but now it fails when building on Vercel with the following error: </p>
  
  <p>I've tried deleting node_modules and running <code>npm install</code> a few times but with no joy. </p>
  
  <p>Any help would be hugely appreciated. Thank you!</p>
  
  <blockquote>
    <p>Running "npm run build"
    20:43:24.926<br>
    tdwcks@1.0.0 build /vercel/5ccaedc9
    20:43:24.926<br>
    next build
    20:43:24.967<br>
    internal/modules/cjs/loader.js:983
    20:43:24.967<br>
      throw err;
    20:43:24.967<br>
      ^
    20:43:24.967<br>
    Error: Cannot find module '../build/output/log'
    20:43:24.967<br>
    Require stack:
    20:43:24.967<br>
    - /vercel/5ccaedc9/node_modules/.bin/next
    20:43:24.967<br>
        at Function.Module._resolveFilename (internal/modules/cjs/loader.js:980:15)
    20:43:24.967<br>
        at Function.Module._load (internal/modules/cjs/loader.js:862:27)
    20:43:24.967<br>
        at Module.require (internal/modules/cjs/loader.js:1042:19)
    20:43:24.967<br>
        at require (internal/modules/cjs/helpers.js:77:18)
    20:43:24.967<br>
        at Object. (/vercel/5ccaedc9/node_modules/.bin/next:2:46)
    20:43:24.967<br>
        at Module._compile (internal/modules/cjs/loader.js:1156:30)
    20:43:24.967<br>
        at Object.Module._extensions..js (internal/modules/cjs/loader.js:1176:10)
    20:43:24.967<br>
        at Module.load (internal/modules/cjs/loader.js:1000:32)
    20:43:24.967<br>
        at Function.Module._load (internal/modules/cjs/loader.js:899:14)
    20:43:24.967<br>
        at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:74:12) {
    20:43:24.967<br>
      code: 'MODULE_NOT_FOUND',
    20:43:24.967<br>
      requireStack: [ '/vercel/5ccaedc9/node_modules/.bin/next' ]
    20:43:24.967<br>
    }
    20:43:24.969<br>
    npm ERR! code ELIFECYCLE
    20:43:24.969<br>
    npm ERR! errno 1
    20:43:24.970<br>
    npm ERR! tdwcks@1.0.0 build: <code>next build</code>
    20:43:24.970<br>
    npm ERR! Exit status 1
    20:43:24.970<br>
    npm ERR! 
    20:43:24.970<br>
    npm ERR! Failed at the tdwcks@1.0.0 build script.
    20:43:24.970<br>
    npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
    20:43:24.974<br>
    npm ERR! A complete log of this run can be found in:
    20:43:24.974<br>
    npm ERR!     /vercel/.npm/_logs/2020-06-17T19_43_24_971Z-debug.log
    20:43:24.979<br>
    Error: Command "npm run build" exited with 1
    20:43:25.342<br>
    [dmesg] follows:
    20:43:25.342<br>
    [  962.449223] ecs-bridge: port 1(veth2a021300) entered disabled state
    20:43:25.342<br>
    [  962.453655] device veth2a021300 entered promiscuous mode
    20:43:25.342<br>
    [  962.457686] ecs-bridge: port 1(veth2a021300) entered blocking state
    20:43:25.342<br>
    [  962.462004] ecs-bridge: port 1(veth2a021300) entered forwarding state
    20:43:26.242<br>
    Done with "package.json"</p>
  </blockquote>
  
  <p>Here's my Package.json</p>
  
  <pre><code>{
    "name": "tdwcks",
    "version": "1.0.0",
    "description": "",
    "main": "index.js",
    "scripts": {
      "dev": "next",
      "build": "next build",
      "start": "next start"
    },
    "keywords": [],
    "author": "",
    "license": "ISC",
    "dependencies": {
      "cjs": "0.0.11",
      "core-util-is": "^1.0.2",
      "framer-motion": "^1.11.0",
      "gray-matter": "^4.0.2",
      "next": "^9.4.4",
      "raw-loader": "^4.0.1",
      "react": "^16.13.1",
      "react-dom": "^16.13.1",
      "react-ga": "^3.0.0",
      "react-markdown": "^4.3.1",
      "react-player": "^2.2.0",
      "react-scripts": "^3.4.1"
    },
    "devDependencies": {
      "postcss-preset-env": "^6.7.0",
      "tailwindcss": "^1.4.6"
    }
  }
  </code></pre>