Node-canvas package not works after update to meteor3

I have a problem with node-canvas package not works after update to meteor3 on Apple M1 CPU.

Error message:

 I'm unable to build nodejs app with 'node-canvas' npm package, because  
Error: dlopen(/Users/..../node_modules/canvas/build/Release/canvas.node, 0x0001): 
tried: '/Users/..../node_modules/canvas/build/Release/canvas.node' 
(mach-o file, but is an incompatible architecture (have 'arm64', need 'x86_64')), '/System/Volumes/Preboot/Cryptexes/OS/..../node_modules/canvas/build/Release/canvas.node' 
(no such file), '/Users/..../node_modules/canvas/build/Release/canvas.node' (mach-o file, but is an incompatible architecture (have 'arm64', need 'x86_64'))

after rebuild from source codes, package is working directly from globally installed node, but from meteor node there is still getting the same error related to architecture.

More info, you can found in my thread here: node.js - Error during the building 'node-canvas' on arm64 M1 CPU - Stack Overflow

Thanks a lot for and each help!

Update: after downgrade Meteor from 3.1 to 3.0.4 it works withour error, therefore there must be some difference related to node architecture between 3.0.4 and 3.1

Some meteor 3.1 bug?

Meteor 3.0.4 on M1:
meteor node -p "process.arch" => arm64

Meteor after update to 3.1
meteor node -p "process.arch" => x64

@storyteller

@klaucode does it still happen if you completely remove ~/.meteor and run npx meteor from scratch? I can’t repro in my install.


1 Like

I can confirm my processor in 3.1 is still arm64 (on M1). I upgraded meteor via meteor update command and not via npm. This is the only way, I guess, a change my appear in the interpreted processor architecture.

@leonardoventurini when I completely removed .meteor and then installed again, the architecture was set correctly (arm64), the problem was only when updating from 3.0.4 to 3.1. I tested it multiple times and situation was always same (after upgrading to 3.1, node architecture was x64) and after downgrading, the architecture was changed into arm64.

I also updated with command (not npm) multiple times and always, where I updated to 3.1 architecture was x64 and back on 3.0.4 architecture was arm64.

Then: I removed .meteor and installed it again and then tried the same. Architecture was always correct (arm64).

Then: I removed .meteor again and installed meteor 2.6. Then I upgraded into 3.0.4 and then 3.1 and architecture was also always correct (arm64).

Therefore I don’t know, why I before had those strange issue :frowning:

Glad it works now. Interesting, perhaps it’s not playing nice with some older version, some symlink etc, we will investigate.

Hello @leonardoventurini It will be hard to investigate (my mistake, because I removed the old .meteor and replaced with latest version). But I repeated upgrade and downgrade multiple times and still the result was the same (x64 instead of arm64 on Meteor 3.1).

You mean even after you fully replaced .meteor it somehow reverted to the x64 arch at some point? Inside ~/.meteor there should be a symlink which points to a specific version of Meteor, perhaps you could check to which one it is pointing to

after those problems, I fully removed .meteor and then installed it again through sh. After reinstallation was everything solved (but we losted previous .meteor content to deeper investigate about this problem). After reinstallation I was trying the same, but I was not able to replicate the problem. Probably it was comming something from previous meteor versions during updating (something comming from previous then latest Meteor 2.6 Meteor version).

1 Like