Skip to content

Executing codemod on Linux #9979

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

Open
yatsura opened this issue May 8, 2025 · 2 comments
Open

Executing codemod on Linux #9979

yatsura opened this issue May 8, 2025 · 2 comments

Comments

@yatsura
Copy link

yatsura commented May 8, 2025

Hi,

I'm encountering an issue when trying to run the Ember Data codemod on Linux using pnpx:

pnpx @ember-data/codemods apply legacy-compat-builders ./app/**/*.{js,ts}

The command fails with an "Exec format error". Upon investigation, I found that the executable file (node_modules/@ember-data/codemods/codemods) is a Mach-O 64-bit arm64 executable, which is incompatible with Linux.

Looking at the package.json file within @ember-data/codemods, the bin entry points to this codemods file, and the build script seems to use Bun with the --target node flag:

"bin": {
  "codemods": "codemods"
},
"scripts": {
  "build:cli": "bun build bin/codemods.ts --compile --target node --outfile codemods --sourcemap",
  // ... 
}

I've also tried running the codemod directly with Node.js:

node node_modules/@ember-data/codemods/codemods apply legacy-compat-builders ./app/**/*.{js,ts}

This resulted in a SyntaxError: Invalid or unexpected token, indicating that the file is not standard JavaScript.

Additionally, I attempted to run it using bunx on Linux (Bun version 1.2.12):

bunx @ember-data/codemods apply legacy-compat-builders ./app/**/*.{js,ts}

My system is running Ubuntu and I am using Node.js v22.13. I am managing my project dependencies with pnpm.

It appears that the Bun build process, even with the --target node flag, is producing an executable that is not compatible with Linux and is being misinterpreted by pnpx as a Mach-O binary.

Could you please investigate this issue?

@runspired
Copy link
Contributor

we need to fix it to use the strategy here https://runspired.com/2025/01/25/npx-executables-with-bun.html

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

No branches or pull requests

3 participants
@runspired @yatsura and others