Webpack Build Dies With Node-Gyp Rebuild Failed. Is Node_modules Cursed? ugh

buildjavascriptnpm5 replies · 200 views · started
  1. ugh. merged a depednency update PR and now webpack refuses to build:

    $ npm install

    $ npm install
    npm ERR! code ERESOLVE
    npm ERR! ERESOLVE unable to resolve dependency tree
    npm ERR!
    npm ERR! While resolving: my-dashboard@0.1.0
    npm ERR! Found: react@19.x
    npm ERR! node_modules/react
    npm ERR!   react@"^19" from the root project
    npm ERR!
    npm ERR! Could not resolve dependency:
    npm ERR! peer react@"^17 || ^18" from some-chart-lib@x
    npm ERR!
    npm ERR! Fix the upstream dependency conflict, or retry
    npm ERR! this command with --force or --legacy-peer-deps
    

    The error is node-gyp rebuild falied. The PR looked harmless, a few version bumps. Id rather understand teh cause than blindly revert or slap a flag on it. Whats the right way to read this error and fix it properly? Happy to share more of teh log if someone tells me which lines matter.

    9
  2. uhh is teh lockfile committed, and does CI use npm ci?

    11 0 helpful
  3. sorry forgot to say the lines above show teh conflict comes from a plugin that hasn't updated its peer dependency range yet.

    2 0 helpful
  4. oof Can't resolve 'fs' means code meant for Node ended up in the browser bundle. Webpack 5 and Vite dont polyfill Node core modules. Find which import pulls it in (often a server-only helper imported from a shared file) and keep it on teh server side.

    7 2 helpful
  5. for JavaScript heap out of memory, raise teh limit for teh build: NODE_OPTIONS=--max-old-space-size=4096 npm run build, if it keeps growing, look for huge source maps, giant JSON imports or an accidnetal import of a whole library.

    thumbsup

    1 0 helpful
  6. hmmmm not sure about that id honestly just use --legacy-peer-deps temporarily if the app works fine. waiting for a plugin author to update their peer range can take months.

    0 1 helpful

Reply to this topic

Sign in or create an account to reply.