Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error: Cannot find module 'multicodec/src/base-table.json' - yarn #1022

Open
FrozenKiwi opened this issue Feb 18, 2021 · 1 comment
Open
Labels
bug Something isn't working dontclose p3 Moderate

Comments

@FrozenKiwi
Copy link

the way modules are hoisted & imported can mean that cids ends up referencing the wrong version multicodec.

My modules are as below

docid
CN/docid@0.4.6
  - multicodec@2.0.0
cids@1.0.2
multicodec@2.1.0

cids@1.0.2 depends on multicodec "^2.0.1". The issue is that when cids requires multicodec, it gets v2.1.0. In this version, base-table.js exists but not base-table.json. This is confirmed by yarn.lock:

multicodec@^2.0.0, multicodec@^2.0.1, multicodec@^2.1.0:
  version "2.1.0"

docid (I assume) specifies multicode explicitly despite not using it anywhere because tries to force CIDS to import the correct version.

"multicodec": "2.0.0",
However, because cids has been hoisted it has escaped the scope of the docid/node_modules and does not reference the intended version.

Upgrading cids to a more recent version will fix this issue.

@FrozenKiwi
Copy link
Author

This is the same as previously closed issue: #999

The workaround probably works because it puts an incompatible version of muticodec at the root of the node_modules, forcing cids to resolve it's own (presumably compatible) version in it's own node_modules. However, this isn't an ideal workaround.

@FrozenKiwi FrozenKiwi changed the title Error: Cannot find module 'multicodec/src/base-table.json' Error: Cannot find module 'multicodec/src/base-table.json' - yarn Feb 18, 2021
@oed oed added bug Something isn't working p3 Moderate labels Feb 18, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working dontclose p3 Moderate
Projects
None yet
Development

No branches or pull requests

3 participants