parcel: Building simple TS file randomly throws 3221226356 exit code

πŸ› bug report

When building a relatively simple TypeScript file, it will build some of the time, but not others. For example, given the following TS file:

const config = {
  serverPort: 3000,
};

export default config;

It will semi-randomly throw the error code 3221226356

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

{
  "name": "@streampods/internalconfig",
  "description": "For internal use only. To share simple values between internal apps",
  "version": "0.0.0",
  "private": true,
  "source": "index.ts",
  "main": "dist/main.js",
  "module": "dist/module.js",
  "types": "dist/types.d.ts",
  "scripts": {
    "build": "parcel build"
  },
  "devDependencies": {
    "@parcel/packager-ts": "^2.2.1",
    "@parcel/transformer-typescript-types": "^2.2.1",
    "parcel": "^2.2.1",
    "typescript": "^4.5.4"
  }
}

πŸ€” Expected Behavior

No error should be thrown

😯 Current Behavior

When running build repeatedly, I get different results, but most of the time results in an exit code

ξ‚° 🌈 ξ‚° οŸ› ξ‚± git ξ‚± repro ξ‚± config ξ‚° ξ‚ main ≒ +6 | ~1 -1 ξ‚°
↳  yarn build
yarn run v1.22.17
$ parcel build
√ Built in 480ms

dist\main.js       557 B    142ms
dist\module.js     239 B    113ms
dist\types.d.ts    115 B     24ms
Done in 1.01s.
ξ‚° 🌈 ξ‚° οŸ› ξ‚± git ξ‚± repro ξ‚± config ξ‚° ξ‚ main ≒ +6 | ~1 -1 ξ‚°
↳  yarn build
yarn run v1.22.17
$ parcel build
√ Built in 469ms
error Command failed with exit code 3221226356.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
ξ‚° 🌈 ξ‚° οŸ› ξ‚± git ξ‚± repro ξ‚± config ξ‚° ξ‚ main ≒ +6 | ~1 -1 ξ‚°  ξ‚°
↳  yarn build
yarn run v1.22.17
$ parcel build
√ Built in 464ms

dist\main.js       557 B    142ms
dist\module.js     239 B    113ms
dist\types.d.ts    115 B     24ms
error Command failed with exit code 3221226356.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

πŸ’ Possible Solution

Unfortunately, I have no idea what might be causing this problem.

πŸ”¦ Context

I’m trying to use parcel to build a internal dependency in a TurboRepo monorepo for usage in both NodeJS (CJS) and Browser (ESM) applications

πŸ’» Code Sample

Minimal reproduction lives here:

https://github.com/oceanbit/parcel-3221226356-repro

🌍 Your Environment

Software Version(s)
Parcel 2.2.1
Node 16.13.1
npm/Yarn 1.22.17
Operating System Windows 11

About this issue

  • Original URL
  • State: closed
  • Created 2 years ago
  • Reactions: 4
  • Comments: 29 (8 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.

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

Same problem.

Software Version(s)
Parcel 2.2.1
Node 14.8.0
NPM 6.14.7
Operating System Win10

Same problem. Sometimes the exit code yarn reports is 3221225477.

Parcel version 2.0.0-rc.0 does not show this issue according to some limited testing.

BTW. I am running as a non-priveleged user account.

3221225477 could be access violation on Windows? https://github.com/nodejs/node/blob/842e5a10ac59c826f875ef79e92d144e2655cc9a/test/common.js#L502-L505