我有一个包(@polkadot/api),它依赖于其他一些包(@polkadot/keyring、@polkadot/util-crypto 和@polkadot/wasm-crpyto)。我需要要求这些软件包中的每一个。
如果我安装了 3 个临时依赖项,npm 会给我这样的错误:
Multiple instances of @polkadot/keyring detected, ensure that there is only one package in your dependency tree.
5.6.3 /home/clay/projects/saito-lite/node_modules/@polkadot/keyring
5.6.3 /home/clay/projects/saito-lite/node_modules/@polkadot/api/node_modules/@polkadot/keyring
Multiple instances of @polkadot/wasm-crypto detected, ensure that there is only one package in your dependency tree.
3.2.3 /home/clay/projects/saito-lite/node_modules/@polkadot/wasm-crypto
3.2.3 /home/clay/projects/saito-lite/node_modules/@polkadot/api/node_modules/@polkadot/wasm-crypto
Multiple instances of @polkadot/util-crypto detected, ensure that there is only one package in your dependency tree.
5.6.3 /home/clay/projects/saito-lite/node_modules/@polkadot/util-crypto
5.6.3 /home/clay/projects/saito-lite/node_modules/@polkadot/api/node_modules/@polkadot/util-crypto
如果我删除了@polkadot/keyring(例如),我会收到如下错误:
Cannot find module '@polkadot/keyring'
有人可以告诉我如何告诉 npm 解决这些依赖关系吗?我想我可以使用一个别名,并在我的 node_modules 中保留每个临时依赖项中的 2 个(实际上是 4 个),但是当版本匹配时这似乎几乎没有必要,我只需要每个版本的一个版本。
我觉得 NPM 在这里是愚蠢的,但是我吗?这不应该“正常工作”吗?