ipfs / js-ipfs

IPFS implementation in JavaScript
https://js.ipfs.tech
Other
7.44k stars 1.25k forks source link

Can't resolve '@libp2p/crypto/keys' #4148

Closed kailash360 closed 2 years ago

kailash360 commented 2 years ago

Severity: Critical

Description:

On adding the package to my ReactJS application, the entire project breaks with the following error image

Steps to reproduce the error:

  1. Add latest release of the package to ReactJS application
  2. It would give an error while compilation
welcome[bot] commented 2 years ago

Thank you for submitting your first issue to this repository! A maintainer will be here shortly to triage and review. In the meantime, please double-check that you have provided all the necessary information to make this process easy! Any information that can help save additional round trips is useful! We currently aim to give initial feedback within two business days. If this does not happen, feel free to leave a comment. Please keep an eye on how this issue will be labeled, as labels give an overview of priorities, assignments and additional actions requested by the maintainers:

Finally, remember to use https://discuss.ipfs.io if you just need general support.

silkroadnomad commented 2 years ago

I can confirm this problem on MacOS too. Downgrading to 0.15.2 doesn't seem to help either. I assume the problem is inside libp2p/js-libp2p-crypto/keys and found something possibly related: https://github.com/libp2p/js-libp2p-crypto/issues/256 I am going to fork this and give it a try!

silkroadnomad commented 2 years ago

This strategy was unfortunately not successful. My problem disappeared when

function App() {

const { ipfs, ipfsInitError } = useIpfsFactory({ commands: ['id'] }) return (


After yarn start - ipfs starts nicely as you I can see in the browser console.

Which version of React you are using and do you have any other modules in your packages .json then the standard ones coming after creating the React project?

I was using 
- React version 17 and 
- react-scripts version 4.0.3 

in order to eliminate a "process not found" problem when I ran into your error message after playing around with the latest orbit-db package. 
shiyicode commented 2 years ago
Xnip2022-07-16_18-40-08

I encountered the same situation

SyedImam1998 commented 2 years ago

Facing Same issue.. Can't resolve '@libp2p/crypto/keys' image

BigLep commented 2 years ago

Please can we have a reproduction to reproduce the problem?

aantaya1 commented 2 years ago

Importing the entire ipfs library fixed this for me:

npm i ipfs

Note: this will also install the CLI and HTTP server modules.

silkroadnomad commented 2 years ago

I tried reproducing this problem as described above one more time with ipfs@0.15.4 (instead of 0.15.2) and this problem seems resolved imho! (I don't know about the others having the same issue with different approaches)

shaolongcai commented 2 years ago

I also facing same issue,I have tried many ways

github-actions[bot] commented 2 years ago

Oops, seems like we needed more information for this issue, please comment with more details or this issue will be closed in 7 days.

2color commented 2 years ago

I had a look at @libp2p/crypto dependency: https://github.com/ipfs/js-ipfs/blob/7a7e091c5d7110542ca7ab6eca1c0c9abb19e54b/packages/ipfs-core/package.json#L75

Since we use a caret range (^) for this dependency making the exact dependency installed by users non-deterministic, I suspect that there may be changes since @libp2p/crypto@0.22.9 that might have affected the use of the package in storage.js:

https://github.com/ipfs/js-ipfs/blob/965f5a4e00254cee48fca2127d95209deaee09cf/packages/ipfs-core/src/components/storage.js#L15

https://github.com/libp2p/js-libp2p-crypto/compare/v0.22.9...v0.22.14#diff-267997474c206a5c43bf7716d132bfeabca32ff6b13441a251ddb70bb5454adbR60

To those experiencing this issue, could you please run the following command: npm ls @libp2p/crypto and share which version of the dependency you have?

asgeir-s commented 2 years ago

@2color, here you go:

➜ npm ls @libp2p/crypto
zodiac-app...
└─┬ ipfs-core@0.15.4
  ├─┬ @chainsafe/libp2p-noise@6.2.0
  │ └── @libp2p/crypto@0.22.14 deduped
  ├── @libp2p/crypto@0.22.14
  ├─┬ @libp2p/kad-dht@1.0.16
  │ └── @libp2p/crypto@0.22.14 deduped
  ├─┬ @libp2p/peer-id-factory@1.0.18
  │ └── @libp2p/crypto@1.0.3
  ├─┬ ipfs-core-config@0.4.1
  │ └─┬ @chainsafe/libp2p-gossipsub@1.2.0
  │   ├── @libp2p/crypto@0.22.14 deduped
  │   └─┬ @libp2p/pubsub@1.3.0
  │     └── @libp2p/crypto@0.22.14 deduped
  ├─┬ ipns@1.0.2
  │ └── @libp2p/crypto@0.22.14 deduped
  └─┬ libp2p@0.37.3
    ├── @libp2p/crypto@0.22.14 deduped
    └─┬ @libp2p/peer-record@1.0.12
      └── @libp2p/crypto@0.22.14 deduped
github-actions[bot] commented 2 years ago

Oops, seems like we needed more information for this issue, please comment with more details or this issue will be closed in 7 days.

github-actions[bot] commented 2 years ago

This issue was closed because it is missing author input.

BigLep commented 2 years ago

Reopening since input was provided (just not by the original author).

Does that help with debugging @2color ?

2color commented 2 years ago

Couldn't find any changes that may have caused this in the hotfix range and version provided by @manboy-eth.

Without a full reproduction, it's really hard determining the root cause here.

aignermax commented 2 years ago

I still have the same issue with libp2p/logger and with ipfs-http-client. It always looks like that:

image

those are the installed packages

image

Even when installing the logger globally it wont find it in the npmpackages anymore.

image

The weird thing about that is, that it does not work on my windows and neither on my linux machine, but it works on my colleagues Mac computer. Node is on v18.10.0 npm -v 8.19.2