Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Running on an Intel Mac, Parcel Fails with "Illegal Hardware Instruction" #10083

Open
stevematney opened this issue Feb 4, 2025 · 7 comments

Comments

@stevematney
Copy link

🐛 bug report

I'm not sure if it's something to do with my code, configuration, or dependencies, but when trying to run parcel on an Intel mac, I get a failure with "illegal hardware instruction". On a fresh, very simple project, everything runs fine, and even on my more complex project, everything works in v2.8. v2.9 has a segfault, and the "illegal hardware instruction" error shows up in 2.10.0.

🎛 Configuration (.babelrc, package.json, cli command)

The relevant portion of my package.json is

  "targets": {
    "bff-frontend": {
      "source": [
        "src/index.html"
      ],
      "distDir": "./dist"
    },
    "bff-web-components": {
      "source": [
        "src/web-components/New-Record/NewRecordCreation.js"
      ],
      "distDir": "./dist/member-info/web-components"
    }
  },

🤔 Expected Behavior

Everything should work as normal.

😯 Current Behavior

Parcel fails with "illegal hardware instruction". I have tried to nail down exactly what is causing this, but the interplay between native code and Parcel's js is not something I'm comfortable traversing, and I have not been able to find the source of the error. (I could use some help on this, if you have any advice!)

🔦 Context

All the context is above. I think probably the most complicated thing I'm trying to do is to build two separate bundles, but that doesn't seem too wild.

🌍 Your Environment

Software Version(s)
Parcel 2.10.0—latest
Node v22.13.1 (latest LTS)
npm/Yarn npm
Operating System MacOS 15.3 (Intel)
@devongovett
Copy link
Member

Going to need a complete reproduction in order to debug this

@stevematney
Copy link
Author

stevematney commented Feb 4, 2025

Here's the minimum I could come up with (plus prettier). It seems that there is some kind of dependency conflict with WTW-IM/es-components. The code that parcel is building is not actually importing that dependency, but it works if the dependency is uninstalled. This is the component library we build and use internally, so it should be relatively easy for us to update it as soon as we know what the issue is.
https://github.com/stevematney/parcel-illegal-hardware-instruction

As I said in the original description, I don't know how to actually run down the source of the error. Even with verbose logging, the output doesn't make clear where this blows up.

Thanks for your help!

@stevematney
Copy link
Author

Just a note on this: I had a thought that it might be something to do with types, so I switched to using transformer-typescript-tsc, but still ran into the same issue.

@stevematney
Copy link
Author

It seems that there is some kind of dependency conflict with WTW-IM/es-components...

I was able to narrow down that the issue is actually in @types/styled-components. I updated the reproduction repo with that dependency and removed the es-components dependency.

@stevematney
Copy link
Author

I eventually found that the problem was setting paths in the tsconfig.json with

      "*": ["./node_modules/@types/*"]

I assume this somehow gums up the works with module resolution, but I'm not exactly sure how. The Parcel docs say that the paths property is not supported, so I assumed this meant that it would simply be ignored. That assumption doesn't seem to be quite correct.

@javierprietodeveloper
Copy link

Hello,

I'm having the same issue but with "react": ["./node_modules/@types/react"]:

/bin/sh: line 1: 73663 Illegal instruction: 4  parcel build ...
error Command failed with exit code 132.

Currently I cannot use a version of parcel greater than 2.8.3.

@javierprietodeveloper
Copy link

javierprietodeveloper commented Mar 1, 2025

Hello @devongovett

this is a basic example that reproduces the error 76672 illegal hardware instruction.

Environment

Software Version(s)
Parcel 2.13.3
Node v20.18.3
npm/Yarn npm v10.8.2
Operating System MacOS 15.3.1 (Apple M1 Pro)

package.json

{
  "name": "parcel",
  "version": "1.0.0",
  "license": "MIT",
  "scripts": {
    "build": "parcel build ./index.html --no-cache --no-source-maps"
  },
  "dependencies": {
    "react": "^18.3.1",
    "react-dom": "^18.3.1"
  },
  "devDependencies": {
    "@types/react": "^18.3.18",
    "@types/react-dom": "^18.3.5",
    "parcel": "^2.13.3",
    "typescript": "5.5.4"
  }
}

tsconfig.json

{
  "compilerOptions": {
    "allowJs": true,
    "allowSyntheticDefaultImports": true,
    "baseUrl": ".",
    "declaration": false,
    "esModuleInterop": true,
    "forceConsistentCasingInFileNames": true,
    "importHelpers": true,
    "isolatedModules": true,
    "jsx": "react",
    "lib": ["esnext"],
    "module": "esnext",
    "moduleResolution": "node",
    "noEmit": true,
    "outDir": "dist",
    "paths": {
      // #####################################
      // # THIS IS THE LINE THAT CAUSES THE ERROR. #
      // #####################################
      "react": ["./node_modules/@types/react"]
    },
    "removeComments": true,
    "resolveJsonModule": true,
    "skipLibCheck": true,
    "strict": true,
    "target": "es2017",
    "noErrorTruncation": true
  },
  "exclude": ["dist", "node_modules", "src/**/*.js", "src/**/*.jsx"]
}

index.html

<!DOCTYPE html>
<html>
  <body>
    <div id="app"></div>
    <script type="module" src="./App.tsx"></script>
  </body>
</html>

App.tsx

import React from "react";
import { createRoot } from "react-dom/client";

const App: React.FC = () => "Hello World";

const container = document.querySelector("#app");
const root = createRoot(container!);
root.render(<App />);

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants