ZenVoich / mops

Package manager for the Motoko programming language
https://mops.one
MIT License
35 stars 3 forks source link

Issue using mops with a mac M chip #199

Open danboyce92 opened 6 months ago

danboyce92 commented 6 months ago

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:

tommygames commented 6 months ago

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.

ZenVoich commented 5 months ago

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.

baolongt commented 1 month ago

Same problem in ubuntu WSL

 Error: Cannot find module '@napi-rs/lzma-linux-x64-gnu'
    Require stack:
baolongt commented 1 month ago

My WSL have npm and pnpm , I removed the npm global and installed ic-mops in pnpm and it work