isomorphic-dompurify icon indicating copy to clipboard operation
isomorphic-dompurify copied to clipboard

Node.js v22.x - [email protected] from [email protected] causing an error during server start in next.js

Open riungemaina opened this issue 5 months ago • 6 comments

We’re encountering a problem with Next.js (v15) when using the latest version of isomorphic-dompurify (2.28.0) on Node.js v22.x (both locally and on Vercel). Error (Next.js v15, Node 22.x, during server start):

Error: ENOENT: no such file or directory, open '.../.next/browser/default-stylesheet.css'
    at 80131 (.next/server/chunks/9049.js:80:184774)
    at c (.next/server/webpack-runtime.js:1:485)
    at 82681 (.next/server/chunks/9049.js:81:31137)
    at c (.next/server/webpack-runtime.js:1:485)
    at 86282 (.next/server/chunks/9049.js:82:267932)
    at c (.next/server/webpack-runtime.js:1:485)
    at 57165 (.next/server/chunks/9049.js:71:5350)
    at c (.next/server/webpack-runtime.js:1:485)
    at 29511 (.next/server/chunks/9049.js:21:403122) {
  errno: -2,
  code: 'ENOENT',
  syscall: 'open',
  path: '.../.next/browser/default-stylesheet.css'
}

Workaround

Adding the following to next.config.ts resolves the build for now: serverExternalPackages: ["isomorphic-dompurify", "jsdom"]

#355

riungemaina avatar Sep 23 '25 12:09 riungemaina

Thanks for reporting @riungemaina !

kkomelin avatar Sep 23 '25 14:09 kkomelin

Experiencing the same. I saw in the previous thread that updating Node solved it for some people. We're on v22.16.0, however.

The workaround provided works in the meantime.

doug-stewart avatar Sep 26 '25 18:09 doug-stewart

Same here:

  • Next: 15.5.4
  • Node: 22.18.0

Can it be related to the jsdom version?

▶ npm ls jsdom
├─┬ [email protected]
│ └── [email protected]
├─┬ [email protected]
│ └── [email protected]
└── [email protected]

santosguilherme avatar Oct 02 '25 19:10 santosguilherme

Having the same issue. The workaround fixed it in the meantime.

beamsky avatar Oct 07 '25 15:10 beamsky

Having the same issue. The workaround has been fixed for now. Thank you!

Helvin159 avatar Oct 07 '25 15:10 Helvin159

I’m using Next.js 15.5.6, and the workaround didn't work for me until I updated my package.json to override the parse5 version:

"pnpm": {
  "overrides": {
    "parse5": "^7.1.2"
  }
}

After that, I ran pnpm install, and in production, I just redeployed , everything worked fine.

issam-seghir avatar Oct 23 '25 00:10 issam-seghir