Ledger deploying to IC error

I am writing a test project using internet identity and ICP ledger. I’m able to deploy locally, but when I try to deploy to IC I get the following:

Error: Failed while trying to deploy canisters.
Caused by: Failed to build all canisters.
Caused by: Failed while trying to build all canisters.
Caused by: The build step failed for canister 'qhk7d-iaaaa-aaaal-amshq-cai' (project_backend)
Caused by: Failed to build Motoko canister 'project_backend'.
Caused by: Failed to compile Motoko.
Caused by: Failed to run 'moc'.
Caused by: The command 'cd "/path/" && "/path/moc" "/path/src/project_backend/main.mo" "-o" "/path/.dfx/ic/canisters/project_backend/project_backend.wasm" "-c" "--debug" "--idl" "--stable-types" "--public-metadata" "candid:service" "--public-metadata" "candid:args" "--actor-idl" "/path/.dfx/ic/canisters/idl/" "--actor-alias" "project_backend" "qhk7d-iaaaa-aaaal-amshq-cai" "--actor-alias" "project_frontend" "s2xrl-3iaaa-aaaal-amsia-cai" "--actor-alias" "icp_ledger" "ryjl3-tyaaa-aaaaa-aaaba-cai" "--actor-alias" "internet_identity" "rdmx6-jaaaa-aaaaa-aaadq-cai" "--package" "base" "/path/base"' failed with exit status 'exit status: 1'.
Stdout:

Stderr:
/path/src/project_backend/main.mo:1.1-1.39: import error [M0009], file "/path/.dfx/ic/canisters/idl/ryjl3-tyaaa-aaaaa-aaaba-cai.did" does not exist

Have you tried copying the .dfx/local/canisters/idl folder to .dfx/ic/canisters/idl? I had a similar issue in the past and managed to solve it this way.

@Severin is this a bug of the dfx CLI?

This could be a bug that I already filed. @galenoshea would you mind sharing how you declare the ledger canister in dfx.json? (the canister id of the file that’s not found is the ICP ledger)

1 Like

I see .dids are created when building locally and then they are deleted prior to the build completing. However local can still deploy