node.jsdocker

why are alpine versions of node throwing an error that @jridgewell/gen-mapping module not found?


I haven't had this issue till today and all my instances of node, including node:20-alpine and node:alpine are producing the error

frontend-coffee-1     | Support for loading ES Module in require() is an experimental feature and might change at any time
frontend-coffee-1     | (Use `node --trace-warnings ...` to show where the warning was created)
\node:internal/modules/cjs/loader:645
frontend-coffee-1     |       throw e;
frontend-coffee-1     |       ^
frontend-coffee-1     |
frontend-coffee-1     | Error: Cannot find module '/app/node_modules/@jridgewell/gen-mapping/dist/gen-mapping.umd.js'
frontend-coffee-1     |     at createEsmNotFoundErr (node:internal/modules/cjs/loader:1275:15)
frontend-coffee-1     |     at finalizeEsmResolution (node:internal/modules/cjs/loader:1264:15)
frontend-coffee-1     |     at resolveExports (node:internal/modules/cjs/loader:638:14)
frontend-coffee-1     |     at Function._findPath (node:internal/modules/cjs/loader:737:31)
frontend-coffee-1     |     at Function._resolveFilename (node:internal/modules/cjs/loader:1225:27)
frontend-coffee-1     |     at Function._load (node:internal/modules/cjs/loader:1064:27)
frontend-coffee-1     |     at TracingChannel.traceSync (node:diagnostics_channel:322:14)
frontend-coffee-1     |     at wrapModuleLoad (node:internal/modules/cjs/loader:218:24)
frontend-coffee-1     |     at Module.require (node:internal/modules/cjs/loader:1325:12)
frontend-coffee-1     |     at require (node:internal/modules/helpers:136:16) {
frontend-coffee-1     |   code: 'MODULE_NOT_FOUND',
frontend-coffee-1     |   path: '/app/node_modules/@jridgewell/gen-mapping'
frontend-coffee-1     | }
frontend-coffee-1     |
frontend-coffee-1     | Node.js v23.3.0

Solution

  • There is issue with v0.3.6 which doesn't have dist folder.

    Adding a override to version 0.3.5 in package json to root works here

    "overrides": {
    "@jridgewell/gen-mapping": "0.3.5"
    }
    

    Link to issue - https://github.com/jridgewell/gen-mapping/issues/14