How do I enable / install moc?

On dfx deploy icrc_token I’m getting:

How do I install it / add it / make it runnable?

1 Like

The problem was that mops install needs to be run, I had gotten two repos mixed up.

It’s not listed as part of the instructions in the mops documentation Internet Computer Content Validation Bootstrap

@ZenVoich ^
Maybe add a line in there about mops install
@blabagastered
My guess is the mops add <..> installs them, vs just modifying the config file and doing mops install

2 Likes

mops add <package_name> seems a bit odd to me because if you need 10 packages that means running 10 commands, which seems off.

Perhaps stating on docs there are two ways: adding dependencies to mops.toml + running mops install, or running mops add <package_name> for each package individually (if that is indeed correct).

Generally, for cloned repos, mops install will make more sense.

2 Likes

@blabagastered @Gekctek
I will add information about mops install to the documentation

2 Likes

Great.

@ZenVoich,maybe a 4.A and a 4.B sections (mops add, mops install), with a brief “you can do either this or that” sort of thing.

I’d also suggest changing this line

import Lib "mo:<package_name>";

for these two:

import PackageName "mo:<package_name>";
for example, import Itertools "mo:itertools/Iter";

To avoid ambiguity and to stay consistent in the “packages” language (as opposed to “library”) found in the rest of the documentation.

1 Like

Hey, how can I install this repo (GitHub - ZhenyaUsenko/motoko-hash-map: Stable hash maps for Motoko
) into a project so that I can use it via

import Map "mo:hashmap/Map";
?

Tried mops add hashmap but no luck.

This only works for packages published to mops.

Try this to install from github:

mops add https://github.com/ZhenyaUsenko/motoko-hash-map#v7.0.0

and import like this

import Map "mo:motoko-hash-map/Map";

Also you can rename motoko-hash-map to hashmap in mops.toml to be able to import like this

import Map "mo:hashmap/Map";

If you rename package in mops.toml you need to run mops install to install the package with new name.

2 Likes

Thank you.

I only realised now this is meant to be a vessel package. I’ve not used vessel. Only mops.

Is it ok to use both vessel and mops together in the same project / repo, or might it cause issues?

You can use only one of these when you build canisters (which is listed in packtool in dfx.json)

1 Like