parcel-bundler / parcel

The zero configuration build tool for the web. πŸ“¦πŸš€
https://parceljs.org
MIT License
43.43k stars 2.26k forks source link

Segmentation fault in Node 22.7.0+ #9976

Open louh opened 1 day ago

louh commented 1 day ago

πŸ› bug report

When running parcel (either in build or watch mode) in Node 22.7.0 or later, the command will crash with a segmentation fault error.

πŸŽ› Configuration (.babelrc, package.json, cli command)

n/a -- this occurs even on no configuration.

πŸ€” Expected Behavior

Application should build or run.

😯 Current Behavior

Parcel crashes:

➜  parcel-segfault node --version
v22.7.0
➜  parcel-segfault npx parcel src/index.html
(node:97502) [DEP0040] DeprecationWarning: The `punycode` module is deprecated. Please use a userland alternative instead.
Server running at http://localhost:1234
β ™ Building index.html...
node(97068,0x17455b000) malloc: Incorrect checksum for freed object 0x12793fc00: probably modified after being freed.
Corrupt value: 0x3131303865353330
node(97068,0x174967000) malloc: Incorrect checksum for freed object 0x13810b200: probably modified after being freed.
Corrupt value: 0x3131303865353330
node(97068,0x17455b000) malloc: *** set a breakpoint in malloc_error_break to debug
node(97068,0x174967000) malloc: *** set a breakpoint in malloc_error_break to debug
[1]    97046 segmentation fault  npx parcel src/index.html
➜  parcel-segfault nvm use 22.6.0
Now using node v22.6.0 (npm v10.8.2)
➜  parcel-segfault npx parcel src/index.html
(node:97502) [DEP0040] DeprecationWarning: The `punycode` module is deprecated. Please use a userland alternative instead.
(Use `node --trace-deprecation ...` to show where the warning was created)
Server running at http://localhost:1234
✨ Built in 236ms

(I have also included a portion where downgrading to 22.6.0 demonstrates a working scenario.)

πŸ’ Possible Solution

Unknown, but only workaround I have is to pin node versions on 22.6.0 or below for the time being.

πŸ”¦ Context

This occurs both building locally and this also fails when deploying on Heroku.

πŸ’» Code Sample

This occurs for my own project, but I have also created a very basic test case using the quick-start instructions https://parceljs.org/getting-started/webapp/ -- which I am hosting here: https://github.com/louh/parcel-segfault

You can run this repository (make sure your local node version matches) with:

npm install
npx parcel src/index.html

Note that if you downgrade node to 22.6.0 the build will succeed as expected.

🌍 Your Environment

Software Version(s)
Parcel 2.12.0
Node 22.7.0
npm/Yarn 10.8.2
Operating System MacOSX Sonoma 14.6.1 and Heroku (NodeJS buildpack)
louh commented 1 day ago

I have just noticed https://github.com/parcel-bundler/parcel/issues/9926. Related?