Mops - on-chain package manager for Motoko!

Many of my packages have semi-permanent migration pathways. If an old version has a github ref, I kind of have to keep around forever(unless it becomes clear that no one is still using it and hasn’t upgraded yet).

Could version pinning be the solution?

It would if I controlled them, but many of them are just things that pre-date mops and haven’t been added it. I can certainly clean some things up and it likely isn’t a heavy lift, but it certainly is nice to include things that aren’t in Mops(especially in proprietary code situations that I run into every once in a while…and sometimes people just aren’t ready to share their code with the world.)

I get an unexpected error when I have an expect clause that fails. I re-installed and upgraded mops to no avail.

// fail.test.mo

import { test; expect } "mo:test";


test("fail", func () {
    expect.nat(2).equal(1);
} )
[vmr@project]$ mops test
Test files:
• test/fail.test.mo
==================================================
node:fs:751
  return binding.read(fd, buffer, offset, length, position);
                 ^

Error: EISDIR: illegal operation on a directory, read
    at Object.readSync (node:fs:751:18)
    at tryReadSync (node:fs:425:20)
    at Object.readFileSync (node:fs:479:19)
    at file:///home/vmr/.nvm/versions/node/v20.19.2/lib/node_modules/ic-mops/cli.js:1960:255
    at String.replace (<anonymous>)
    at Socket.<anonymous> (file:///home/vmr/.nvm/versions/node/v20.19.2/lib/node_modules/ic-mops/cli.js:1960:116)
    at Socket.emit (node:events:524:28)
    at addChunk (node:internal/streams/readable:561:12)
    at readableAddChunkPushByteMode (node:internal/streams/readable:512:3)
    at Readable.push (node:internal/streams/readable:392:5) {
  errno: -21,
  code: 'EISDIR',
  syscall: 'read'
}

Node.js v20.19.2

Do other commands work? For example mops sources

Can you share mops.toml content?

1 Like

This was a big clue. mops test works no problem in a new project, and after deleting .mops and cleaning up mops.toml in my project I am back to expected behavior.

For reference, before I removed unneeded dependencies and deleted .mops cache:

[vmr@project]$ mops sources
--package core .mops/core@0.5.0/src
--package vector .mops/vector@0.4.1/src
--package base .mops/base@0.14.9/src
--package bench .mops/bench@1.0.0/src
--package fuzz .mops/fuzz@1.0.0/src
--package test .mops/test@2.1.1/src
# mops.toml

[dependencies]
core = "0.5.0"
vector = "0.4.1"
bench = "1.0.0"
fuzz = "1.0.0"
base = "0.14.9"
test = "2.1.1"
1 Like