beginner-corp/cli

`begin dev` confuses `esbuild`

macdonst opened this issue · 1 comments

I have an Enhance project that is using a bundle to include lit.

@bundles
lit './node_modules/lit/index.js'

When I run begin dev it reports the error below but I cannot reproduce the same issue with arc sandbox

Error:

× Error:
You installed esbuild for another platform than the one you're currently using.
This won't work because esbuild is written with native code and needs to
install a platform-specific binary executable.

Specifically the "esbuild-darwin-arm64" package is present but this platform
needs the "esbuild-darwin-64" package instead. People often get into this
situation by installing esbuild with npm running inside of Rosetta 2 and then
trying to use it with node running outside of Rosetta 2, or vice versa (Rosetta
2 is Apple's on-the-fly x86_64-to-arm64 translation service).

If you are installing with npm, you can try ensuring that both npm and node are
not running under Rosetta 2 and then reinstalling esbuild. This likely involves
changing how you installed npm and/or node. For example, installing node with
the universal installer here should work: https://nodejs.org/en/download/. Or
you could consider using yarn instead of npm which has built-in support for
installing a package on multiple platforms simultaneously.

If you are installing with yarn, you can try listing both "arm64" and "x64"
in your ".yarnrc.yml" file using the "supportedArchitectures" feature:
https://yarnpkg.com/configuration/yarnrc/#supportedArchitectures
Keep in mind that this means multiple copies of esbuild will be present.

Another alternative is to use the "esbuild-wasm" package instead, which works
the same way on all platforms. But it comes with a heavy performance cost and
can sometimes be 10x slower than the "esbuild" package, so you may also not
want to do that.
Error:
    at generateBinPath (my-project/node_modules/esbuild/lib/main.js:1799:17)
    at esbuildCommandAndArgs (my-project/node_modules/esbuild/lib/main.js:1875:33)
    at ensureServiceIsRunning (my-project/node_modules/esbuild/lib/main.js:2040:25)
    at build (my-project/node_modules/esbuild/lib/main.js:1931:26)
    at build (my-project/node_modules/@architect/plugin-bundles/src/index.js:65:9)
    at buildAll (my-project/node_modules/@architect/plugin-bundles/src/index.js:81:9)
    at Object.start (my-project/node_modules/@architect/plugin-bundles/src/index.js:93:15)
    at processTicksAndRejections (internal/process/task_queues.js:95:5)
    at async start (my-project/node_modules/@enhance/arc-plugin-enhance/src/plugins/beginner.js:9:7)
    at async runPlugins (/snapshot/cli/node_modules/@architect/sandbox/src/sandbox/plugins/index.js)
× Error: Sandbox is not running
Error:
    at Object.end (/snapshot/cli/node_modules/@architect/sandbox/src/index.js)
    at end (/snapshot/cli/node_modules/@architect/sandbox/src/cli/_stdin.js)
    at processTicksAndRejections (internal/process/task_queues.js:95:5)

Update: this will be service/hardware dependent, and will be resolved when #94 merges. Should be in the next week or so!