hyperbrew / bolt-cep

A lightning-fast boilerplate for building Adobe CEP Extensions in React, Vue, or Svelte built on Vite + TypeScript + Sass
MIT License
296 stars 41 forks source link

Mac M1 can't build JSXBIN // yarn build: No matches found: "dist/*" #15

Closed utenma closed 1 year ago

utenma commented 2 years ago

Hello i tried to run the cep extension, however i get: Which version of yarn should be used? Currently on Yarn 3.2.0, Mac M1

steps to reproduce

  1. clone
  2. yarn
  3. yarn build
bolt-cep % yarn buld
Usage Error: Couldn't find a script named "build".

$ yarn run [--inspect] [--inspect-brk] [-T,--top-level] [-B,--binaries-only] <scriptName> ...
saulpalv@mac bolt-cep % yarn build
No matches found: "dist/*"

i will try with yarn 1...

utenma commented 2 years ago

build does run with yarn version 1 however the toolchain does not support m1

bolt-cep/node_modules/jsxbin/esdebugger-core/mac/esdcorelibinterface.node' (mach-o file, but is an incompatible architecture (have 'x86_64', need 'arm64e')), '/usr/local/lib/esdcorelibinterface.node' (no such file), '/usr/lib/esdcorelibinterface.node' (no such file)
justintaylor-dev commented 2 years ago

Hi @saulpalv. Yes the project is set up for Yarn 1, so I would recommend that. I don't have an M1 Mac to test with, but it looks like the error is due to the JSXBIN feature not having a library for M1. Here's what I'd try:

  1. Re install by running yarn and then yarn build with Yarn 1
  2. If you're getting the same error, you can just disable the JSXBIN export for now by editing the cep.config.ts to:

build: { jsxBin: "off", sourceMap: true, },

justintaylor-dev commented 2 years ago

Update: This is in fact an issue with the jsxbin package, see details here:

Issue 29

I'll bump that issue.

justintaylor-dev commented 2 years ago

Until Adobe releases the ExtendScript debugger 2.0 to the public, (right now it's in NDA beta), JSXBIN won't work on M1 Macs. You can either build in Rosetta mode, or make your own local fork of jsxbin and try to update with the latest esdebugger libraries after joining the beta group, outlined here:

ExtendScript Debugger 2.0

utenma commented 2 years ago

thanks for investigating further, is there a command to run npm install as arch=x64?

justintaylor-dev commented 2 years ago

yarn install will install for your platform, no need to specify, however, this won't solve the JSXBIN issue as the package doesn't contain the right binaries for M1 Macs anyway.

imHowie commented 2 years ago

@justintaylor-dev So as a novice developer, what should I do now? After reading the comments section, my understanding is to replace JSXBIN or esdebugger-core 's bag? I'm sorry that my English is not very good, so I can only write it well in Chinese and communicate with you in English.

justintaylor-dev commented 2 years ago

@imHowie you have a few options:

  1. Build on a non-M1 Mac
  2. Build on an M1 Mac in Rosetta mode
  3. Make a PR for the jsxbin repo that includes the M1 binaries from the VS Code ExtendScript Debugger beta
utenma commented 2 years ago

Rosseta does not work by default because npm tries to install arm64 binaries because node -p process.arch = arm64 which are not available, hopefully there would be a way to instruct npm to install x64 binaries that could work with Rosseta.

cojennin commented 1 year ago

Just wanted to document my steps for getting this working with Rosetta, for folks who are interested.

Caveats

Steps

  1. If iTerm is running, quit it, then go to your Applications directory (assuming that's where iTerm resides) and duplicate iTerm (right click the iTerm app, select Duplicate), rename the duplicated version to iTerm - Rosetta, and configure to use Rosetta
  2. Double click iTerm - Rosetta (again, make sure to quit iTerm before double clicking if iTerm was running)
  3. Run arch and make sure it returns i386
  4. If you don't already have it, install nvm
  5. Run nvm install v19.0.0 (or some other version of Node, I went with v19.0.0 but you can go with whatever works!). This is a critical step, you need a version of Node that was installed on the right architecture, which is what this step is doing
  6. Then nvm use v19.0.0 (or again, whatever version of Node you chose)
  7. Run node -e 'console.log(process.arch)' and confirm you see x64
  8. You'll probably need to install yarn again, so run npm install -g yarn
  9. Then, if you've already run yarn install on in the directory of your Bolt CEP project, make sure to delete yarn.lock and node_modules
  10. Run yarn
  11. Run yarn build
utenma commented 1 year ago

Another option is to use node 14.16.1, which is the last version that didn't support arm64 for mac, so installs x86_64 to run with rosetta you add it to a

.nvmrc

14.16.1

switch with nvm use

justintaylor-dev commented 1 year ago

Adobe hasn't released binaries for Apple Silicon machines yet. If and when they do, we can revisit this.