parcel: After updating to parcel 2.2.1 the build system is flacky. It often fails. It take 2,3,4 runs to make it work.

๐Ÿ› bug report

After updating to parcel 2.2.1 the build system is flaky. It often fails. It takes 2,3,4 runs to make it work. /c/Program Files/nodejs/npm: line 44: 2128 Segmentation fault โ€œ$NODE_EXEโ€ โ€œ$NPM_CLI_JSโ€ โ€œ$@โ€

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

parcel watch src/web/pages/**/*.pug --dist-dir ./ --target public
{
  "plugins": [
    [
      "transform-react-pug",
      {
        "classAttribute": "className"
      }
    ],
    "styled-jsx/babel",
    "transform-jsx-css-modules",
    "@babel/plugin-transform-runtime"
  ]
}

๐Ÿค” Expected Behavior

It should work the first time.

๐Ÿ˜ฏ Current Behavior

After updating to parcel 2.2.1 the build system is flacky. It often fails. It take 2,3,4 runs to make it work. Sometimes it works aftet rimraffing .parcel_cache or npm rebuild, or both.

/c/Program Files/nodejs/npm: line 44: 2128 Segmentation fault โ€œ$NODE_EXEโ€ โ€œ$NPM_CLI_JSโ€ โ€œ$@โ€

๐Ÿ’ Possible Solution

Sometimes it works aftet rimraffing .parcel_cache or npm rebuild, or both.

๐Ÿ”ฆ Context

๐Ÿ’ป Code Sample

๐ŸŒ Your Environment

Software Version(s)
Parcel 2.2.1
Node v16.13.2
npm/Yarn npm 8.1.2
Operating System Windows 10

About this issue

  • Original URL
  • State: closed
  • Created 2 years ago
  • Reactions: 4
  • Comments: 32 (6 by maintainers)

Most upvoted comments

I think we narrowed this down to an upgrade of napi-rs in the @parcel/source-map package, which was released sometime after Parcel 2.2.1. I still donโ€™t know the exact root cause, but for now Iโ€™ve reverted this upgrade and published @parcel/source-map v2.0.2. See https://github.com/parcel-bundler/source-map/pull/91.

Youโ€™ll need to remove @parcel/source-map 2.0.1 from your lock file and re-install to get the upgrade. Please comment whether this works for you. Apologies again for the issue, and thanks for your patience while we track it down.

I have 4 students hitting this bug tonight.

Yes, I also drop the parcel version from 2.2.1 to 2.0.0, these bug still happened on my Windows develop machine.

Does it work for anyone if you set the PARCEL_WORKER_BACKEND=process environment variable?

Yes, it works on my Windows 10 machine from git bash

Hello! I am also experiencing the same issue. Unfortunately my repository is also private however I will share as much as I can: dvnYc1dXj9

OR Even using the following: rKWoorIWWs

Software Version(s)
Parcel 2.2.1
Node v16.13.2
npm/Yarn npm 6.* OR 8.3.2 (I upgraded thinking this was it)
Operating System Windows 10

my package.json might be smaller:

{
  "engines": {
    "node": ">=16"
  },
  "source": "src/index.html",
  "browserslist": "> 0.5%, last 2 versions, not dead",
  "scripts": {
    "test": "echo \"Error: no test specified\" && exit 1",
    "start": "parcel",
    "build": "parcel build"
  },
  "author": "Amasia",
  "license": "UNLICENSED",
  "devDependencies": {
    "parcel": "^2.2.1"
  },
  "dependencies": {
    "aws-amplify": "^4.0.0"
  }
}

Another thing that may or may not be related: I have other students who are hitting what looks to be the same bug, but it doesnโ€™t necessarily crash the same way (i.e., fails but no seg fault). The process seems to get stuck, and holds port 1234 open, blocking future invocations.

FWIW, the people Iโ€™ve seen hit it were all on Windows. I havenโ€™t been able to reproduce this on macOS with 2.2.1.

@dailypixie I ended up doing the same. For reference in case someone needs it:

for dir in $(ls node_modules/\@parcel/); do ver=$(jq '.version' node_modules/\@parcel/$dir/package.json); if [[ "$ver" = "\"2.2.1\"" ]]; then echo "\"@parcel/${dir%/}\": \"2.1.1\","; fi; done

(Works on Cygwin, YMMV.)

But it still crashes a lot for me.

Has anyone managed to downgrade? Since Parcel packages specify dependences using ^ (e.g. https://github.com/parcel-bundler/parcel/blob/v2.2.0/packages/configs/default/package.json#L21), I get 2.2.1 versions even if I specify 2.2.0 in my package.json.