dfx version: 0.12.1
assumes networks.json has been setup correctly
Steps to recreate:
dfx new demo
dfx start --clean --background
dfx nns install
dfx nns import
- edit dfx.json to include imported "nns-ledger" as dependency to demo_backend
- edit src/demo_backend/main.mo to include line the
import Ledger "canister:nns-ledger";
now anytime the following is run again
dfx stop
dfx start --clean --background
dfx nns install
followed by either of the following
dfx canister create demo_backend
dfx build demo_backend
//or
dfx deploy demo_backend
it will always produce the following output/error
Creating a wallet canister on the local network.
The wallet canister on the "local" network for user "default" is <a principal>
Deploying: demo_backend
Creating canisters...
Creating canister demo_backend...
demo_backend canister created with canister id: <the same principal>
Building canisters...
WARN: Failed to copy canister candid from ~/demo/candid/nns-ledger.did to ~/demo/.dfx/local/canisters/idl/ryjl3-tyaaa-aaaaa-aaaba-cai.did. This may produce errors during the build.
Error: Failed while trying to deploy canisters.
Caused by: Failed while trying to deploy canisters.
Failed to build call canisters.
Failed while trying to build all canisters.
The build step failed for canister '<the same pricipal>' (demo_backend) with an embedded error: Failed to build Motoko canister 'demo_backend'.: Failed to compile Motoko.: Failed to run 'moc'.: The command '"~/.cache/dfinity/versions/0.12.1/moc" "~/demo/src/demo_backend/main.mo" "-o" "~/demo/.dfx/local/canisters/demo_backend/demo_backend.wasm" "-c" "--debug" "--idl" "--stable-types" "--public-metadata" "candid:service" "--actor-idl" "~/demo/.dfx/local/canisters/idl/" "--actor-alias" "demo_backend" "<the same principal>" "--actor-alias" "nns-ledger" "ryjl3-tyaaa-aaaaa-aaaba-cai" "--package" "base" "~/.cache/dfinity/versions/0.12.1/base"' failed with exit status 'exit status: 1'.
Stdout:
Stderr:
~/demo/src/demo_backend/main.mo:1.1-1.36: import error [M0009], file "~/demo/.dfx/local/canisters/idl/ryjl3-tyaaa-aaaaa-aaaba-cai.did" does not exist
however running deploy once again will successfully deploy the canister
dfx deploy demo_backend
and now any calls from the demo_backend's code calling on the Ledger import will work as expected
Also the Motoko VS code extension (v0.7.2) persists to highlight the import line as an error in demo_backend.mo
dfx version: 0.12.1
assumes networks.json has been setup correctly
Steps to recreate:
import Ledger "canister:nns-ledger";now anytime the following is run again
followed by either of the following
it will always produce the following output/error
however running deploy once again will successfully deploy the canister
dfx deploy demo_backendand now any calls from the demo_backend's code calling on the Ledger import will work as expected
Also the Motoko VS code extension (v0.7.2) persists to highlight the import line as an error in demo_backend.mo