Issue using mops with a mac M chip
Apologies if this is the wrong place for this, I'm having trouble getting mops to work at all. Since I installed it, I can't get my canisters to deploy. The error mentions something about a missing module darwin-x64, is this because I'm using an M chip with mac? I've followed install instructions closely, even uninstalled everything and tried again same error. Is there a work around for this?
Here is my dfx.json
{
"canisters": {
"main_canister": {
"main": "src/Main.mo",
"type": "motoko"
},
"game_canister": {
"main": "src/Game.mo",
"type": "motoko"
}
},
"defaults": {
"build": {
"args": "",
"packtool": "mops sources"
}
}
}
and here is the error :
Caused by: Failed while trying to deploy canisters. Failed to build all canisters. Failed while trying to build all canisters. The build step failed for canister 'bd3sg-teaaa-aaaaa-qaaba-cai' (main_canister) with an embedded error: Failed to build Motoko canister 'main_canister'.: Failed to load package arguments.: The command '"mops" "sources"' failed with exit status 'exit status: 1'. Stdout:
Stderr: node:internal/modules/cjs/loader:1144 const err = new Error(message); ^
Error: Cannot find module '@napi-rs/lzma-darwin-x64' Require stack:
- /usr/local/lib/node_modules/ic-mops/node_modules/@napi-rs/lzma/index.js
- /usr/local/lib/node_modules/ic-mops/node_modules/@napi-rs/lzma/xz.js
at Module._resolveFilename (node:internal/modules/cjs/loader:1144:15)
at Module._load (node:internal/modules/cjs/loader:985:27)
at Module.require (node:internal/modules/cjs/loader:1235:19)
at require (node:internal/modules/helpers:176:18)
at Object.
(/usr/local/lib/node_modules/ic-mops/node_modules/@napi-rs/lzma/index.js:1:2289) at Module._compile (node:internal/modules/cjs/loader:1376:14) at Module._extensions..js (node:internal/modules/cjs/loader:1435:10) at Module.load (node:internal/modules/cjs/loader:1207:32) at Module._load (node:internal/modules/cjs/loader:1023:12) at Module.require (node:internal/modules/cjs/loader:1235:19) { code: 'MODULE_NOT_FOUND', requireStack: [ '/usr/local/lib/node_modules/ic-mops/node_modules/@napi-rs/lzma/index.js', '/usr/local/lib/node_modules/ic-mops/node_modules/@napi-rs/lzma/xz.js' ] }
Two devs on our team are also getting this same exact issue, both of them are using macbooks with M chips. It just started happening recently. We're blocked from being able to deploy canisters because of it.
Thank you for bug report. I suppose this started after updating mops cli?
The problem with dependencies of decomp-tarxz package that required to unzip wasmtime xz archive.
I just published mops 0.38.2 with temp fix, now decomp-tarxz is imported only when you download wasmtime binary. I hope this will fix it for you now. Just update mops cli npm i -g ic-mops
If you have problems with mops toolchain and wasmtime, I can propose these steps(I didn't check):
npm uninstall -g ic-mops
npm install -g --arch=x64 --platform=darwin ic-mops
If this didn't work, please post here and I will look for another solution.
Same problem in ubuntu WSL
Error: Cannot find module '@napi-rs/lzma-linux-x64-gnu'
Require stack:
My WSL have npm and pnpm , I removed the npm global and installed ic-mops in pnpm and it work