$ dfx deploy --network=ic
Deploying all canisters.
All canisters have already been created.
Building canisters...
Error: Field 'main' is mandatory for canister test.
code
import Principal "mo:base/Principal";
import Time "mo:base/Time";
actor {
var nat:Nat = 1;
public func queryData(): async Nat{
return nat
}
}
This error message refers to dfx.json, meaning that you have not told dfx which file to compile if you try to deploy canister ‘test’. Here’s an example for a proper Motoko canister declaration in dfx.json: