Skip to content
This repository has been archived by the owner on Aug 9, 2021. It is now read-only.

Module not found: Can't resolve 'multicodec/src/name-table' #687

Closed
polluterofminds opened this issue Dec 28, 2019 · 12 comments
Closed

Module not found: Can't resolve 'multicodec/src/name-table' #687

polluterofminds opened this issue Dec 28, 2019 · 12 comments
Assignees
Labels
bug Something isn't working package & dependencies
Milestone

Comments

@polluterofminds
Copy link

Describe the bug

After installing 3box (npm i 3box) and requiring it in a React project (const Box = require('3box')), the module error referenced is thrown:

Module not found: Can't resolve 'multicodec/src/name-table'

I tried to manually install the multicodec module but that didn't resolve the problem. Downgrading to 1.13.2 (which was the last version I worked with) allows me to keep working, but I'd like to work on the most recent release.

I'm on MacOS Catalina. Error happens across all browsers.

@polluterofminds
Copy link
Author

The issue appears to be tied to the ipfs-bitswap library which is a 3box dependency. It is referencing the multicodec/src/name-table file which does not seem to exist.

@oed
Copy link
Member

oed commented Dec 31, 2019

Thanks @jehunter5811, I'm not sure why this is happening for you. What does your build process look like? Perhaps @oznekenzo can provide some help here!

@oed oed self-assigned this Dec 31, 2019
@polluterofminds
Copy link
Author

I just tried again with a fresh project. Here's the flow:

npx create-react-app app-name
cd app-name
npm i 3box

In app.js, simply adding the following line causes this error as soon as the app is run:

const Box = require('3box')

@jcastro-geodb
Copy link

jcastro-geodb commented Jan 2, 2020

The version of ipfs-bitswap should be updated to 0.26.2 to fix this issue, they released a hotfix to address it (https://github.com/ipfs/js-ipfs-bitswap/releases/tag/v0.26.2). It seems that updating to ipfs 0.40.0 should fix the issue (https://github.com/ipfs/js-ipfs/releases/tag/v0.40.0)

@oznekenzo
Copy link
Contributor

A similar problem I experienced was with a depency updating a file from .js to .json and the file type was not accepted in the webpack configs, had to update to include json:

resolve: {
    extensions: ['.js', '.jsx', '.scss', '.svg', '.css', '.json'] 
  },   

@oed
Copy link
Member

oed commented Jan 2, 2020

@jcastro-geodb Thanks for the info! We're still hesitant to update the js-ipfs version at this point since we need to make sure it doesn't break anything in OrbitDB.

Hopefully the problem can be solved by what @oznekenzo suggested. Lmk if there are still any issue here!

@oznekenzo
Copy link
Contributor

After further inspection, the fix I suggested was for an issue in the same library but with a different file: multicodec/src/base-table.json - a fix for an issue with /name-table was suggested elsewhere: Downgrade multicodec to version 0.5.6 before required file was removed

@JasoonS
Copy link

JasoonS commented Jan 12, 2020

@oznekenzo is correct here. Quick fix is to run npm i multicodec@0.5.6

@oed
Copy link
Member

oed commented Jan 22, 2020

We are currently working on a fix for this by updating ipfs to the latest version.

@adamsoffer
Copy link

adamsoffer commented Feb 3, 2020

Hey @oed 👋- has this been addressed in the latest release?

update: nevermind looks like that PR is still open.

@oed
Copy link
Member

oed commented Feb 4, 2020

@adamsoffer yeah, it's still not released. Aiming to have it out this week. If you really need it right now you can try npm i 3box@next

@oed oed closed this as completed Feb 5, 2020
@oed
Copy link
Member

oed commented Feb 5, 2020

This is fixed in the new version of 3box-js since ipfs was updated to the latest version.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Something isn't working package & dependencies
Projects
None yet
Development

No branches or pull requests

7 participants