"Dependencies installation error" on Netlify but successful build locally

Getting a Dependencies installation error when previewing a deploy. I have no issues when building locally. I initially though it was something with @netlify/plugin-nextjs v3.2.0 since another project I have error-free and is running v3.1.0. But downgrading didn’t fix it.

Between the error message and the fact it runs on Vercel I assume it is a Netlify problem which I cannot seem to resolve—also building my code takes 15 mins…

Here is the section of the build log with the error (scroll in the box :slight_smile: )and package.json:

───────────────────────────────────────────────────
 3. onBuild command from @netlify/plugin-nextjs                
───────────────────────────────────────────────────────────────

* Running Next on Netlify package **
🚀 Next on Netlify 🚀
🌍️ Copying public/ folder to out
nfo  - Using webpack 4. Reason: future.webpack5 option disabled https://nextjs.org/docs/messages/webpack5
💼 Copying static NextJS assets to out
💫 Setting up API endpoints as Netlify Functions in netlify/functions
💫 Setting up pages with getInitialProps as Netlify Functions in netlify/functions
💫 Setting up pages with getServerSideProps as Netlify Functions in netlify/functions
🔥 Copying pre-rendered pages with getStaticProps and JSON data to out
💫 Setting up pages with getStaticProps and fallback: true as Netlify Functions in netlify/functions
💫 Setting up pages with getStaticProps and revalidation interval as Netlify Functions in netlify/functions
🔥 Copying pre-rendered pages without props to out
🔀 Setting up redirects
🔀 Setting up headers
✅ Success! All done!

@netlify/plugin-nextjs onBuild completed in 797ms)

───────────────────────────────────────────────────────────────
 4. Functions bundling                                         
───────────────────────────────────────────────────────────────

ackaging Functions from netlify/functions directory:
- next_image.js
- next_deliverable/next_deliverable.js
- next_event/next_event.js
- next_ideas/next_ideas.js
- next_lab_lab/next_lab_lab.js
- next_lab_lab_offering/next_lab_lab_offering.js


───────────────────────────────────────────────────────────────
 Dependencies installation error                               
───────────────────────────────────────────────────────────────

 Error message
 A Netlify Function failed to require one of its dependencies.
 Please make sure it is present in the site's top-level "package.json".
​
 In file "/opt/build/repo/netlify/functions/next_deliverable/next_deliverable.js"
 Cannot find module '_process'
 Require stack:
 - /opt/buildhome/.netlify-build-nvm/versions/node/v12.16.3/lib/node_modules/@netlify/build/node_modules/@netlify/zip-it-and-ship-it/src/node_dependencies/resolve.js
 - /opt/buildhome/.netlify-build-nvm/versions/node/v12.16.3/lib/node_modules/@netlify/build/node_modules/@netlify/zip-it-and-ship-it/src/node_dependencies/index.js
 - /opt/buildhome/.netlify-build-nvm/versions/node/v12.16.3/lib/node_modules/@netlify/build/node_modules/@netlify/zip-it-and-ship-it/src/main.js
 - /opt/buildhome/.netlify-build-nvm/versions/node/v12.16.3/lib/node_modules/@netlify/build/src/plugins_core/functions/index.js
 - /opt/buildhome/.netlify-build-nvm/versions/node/v12.16.3/lib/node_modules/@netlify/build/src/commands/get.js
 - /opt/buildhome/.netlify-build-nvm/versions/node/v12.16.3/lib/node_modules/@netlify/build/src/core/main.js
 - /opt/buildhome/.netlify-build-nvm/versions/node/v12.16.3/lib/node_modules/@netlify/build/src/core/bin.js

  Resolved config
  build:
    command: npm run build
    commandOrigin: config
    environment:
      - GOOGLE_SHEETS_CLIENT_EMAIL
      - GOOGLE_SHEETS_PRIVATE_KEY
      - REVIEW_ID
      - SPREADSHEET_ID
    publish: /opt/build/repo/out
  plugins:
    - inputs: {}
      origin: config
      package: '@netlify/plugin-nextjs'
Caching artifacts
Started saving node modules
Finished saving node modules
Started saving build plugins
Finished saving build plugins
Started saving yarn cache
Finished saving yarn cache
Started saving pip cache
Finished saving pip cache
Started saving emacs cask dependencies
Finished saving emacs cask dependencies
Started saving maven dependencies
Finished saving maven dependencies
Started saving boot dependencies
Finished saving boot dependencies
Started saving rust rustup cache
Finished saving rust rustup cache
Started saving go dependencies
Finished saving go dependencies
Build failed due to a user error: Build script returned non-zero exit code: 2
Creating deploy upload records
Failing build: Failed to build site
Failed during stage 'building site': Build script returned non-zero exit code: 2
Finished processing build request in 14m48.817509211s

My package JSON:

{
  "version": "2.2.0-beta.1",
  "license": "ISC",
  "scripts": {
    "dev": "next",
    "build": "next build",
    "start": "next start",
    "export": "next export",
    "deploy": "npm run build && next export",
    "bump": "$(npm bin)/bump --tag --commit"
  },
  "dependencies": {
    "framer-motion": "^4.1.11",
    "googleapis": "^73.0.0",
    "image-trace-loader": "^1.0.2",
    "imagemin-gifsicle": "^7.0.0",
    "imagemin-mozjpeg": "^9.0.0",
    "imagemin-optipng": "^8.0.0",
    "imagemin-svgo": "^9.0.0",
    "jimp": "^0.16.1",
    "lottie": "^0.0.1",
    "lottie-react": "^2.1.0",
    "lqip-loader": "^2.2.0",
    "netlify-cli": "^3.24.3",
    "next": "^10.1.3",
    "next-compose-plugins": "^2.2.0",
    "next-mdx-remote": "^2.1.4",
    "next-optimized-images": "^2.6.1",
    "next-pwa": "^5.2.21",
    "nextjs-sitemap-generator": "^1.0.0",
    "node-sass": "^5.0.0",
    "parallax-js": "^3.1.0",
    "react": "^17.0.2",
    "react-device-detect": "^1.13.1",
    "react-dom": "^17.0.2",
    "react-icalendar-link": "^2.0.0",
    "react-intersection-observer": "^8.26.2",
    "react-normalize": "^0.4.4",
    "react-scrolllock": "^5.0.1",
    "react-use": "^17.2.4",
    "responsive-loader": "^2.3.0",
    "svg-sprite-loader": "^6.0.6",
    "typed.js": "^2.0.11",
    "version-bump-prompt": "^6.0.3",
    "webp-loader": "^0.6.0"
  },
  "devDependencies": {
    "@netlify/plugin-nextjs": "3.1.0",
    "frontmatter-markdown-loader": "^3.6.2"
  }
}

hey there! Sorry to be slow to reply.

If you are still experiencing this problem, could you please file an issue here?

many thanks!