embroider-build / embroider

Compiling Ember apps into spec-compliant, modern Javascript.
MIT License
333 stars 136 forks source link

Ember build fails if a new project has @embroider/macros and fabric.js installed #567

Open jakesjews opened 3 years ago

jakesjews commented 3 years ago

If the latest @embroider/macros and fabric.js are installed in a new Ember project then running ember build fails with this error.

Build Error (broccoli-persistent-filter:Babel > [Babel: @embroider/macros]) in @embroider/macros/runtime.js

Module did not self-register: '/Users/jacob/dev/tmp/embroider-fabric-bug/node_modules/canvas/build/Release/canvas.node'.

If @embroider/macros is removed then builds work again. I ran into this issue while trying to upgrade ember-bootstrap.

A replication is available here.

AndreJoaquim commented 3 years ago

Hello @ef4! Do you have any idea how could we fix this? I'm not being able to update some packages (e.g. ember-power-select) in my application due to this 😢

I believe this is ultimately caused by the canvas package, that's not necessary in the browsers, right? So, could we ignore this package some how? :)

dwickern commented 3 years ago

Since yarn v2 no longer has the --ignore-optional flag, here's my current workaround:

yarn add --dev canvas@dwickern/canvas-noop

It will replace canvas with this empty package

ef4 commented 3 years ago

Thanks for sharing a reproduction. Running the reproduction, I did see the bug, once. But try as I might I can't get it to reproduce a second time. Removing node modes and clearing the npm cache doesn't do it.

I suspect this is a transient problem caused by NPM. Does it happen reliably for you?

AndreJoaquim commented 3 years ago

@ef4 Yes, in my case it happens every time I boot up the application

cloke commented 3 years ago

@ef4 I get this 100% of the time if I update ember past 3.20 (although it doesn't seem to be specific to upgrading ember, trying to update font awesome while on 3.20 triggers the same issue). I'm happy to provide any logs if it helps. I posted this in discord as well and can be contacted via Cloke there.