升级 web3 库后编译 typescript 应用程序失败

问题描述 投票:0回答:1

我已将

web3
库更新为
4.x
版本。但是升级后我的构建开始失败并出现这样的错误:

> tsc

node_modules/.pnpm/[email protected]/node_modules/web3-rpc-methods/lib/types/eth_rpc_methods.d.ts:3:33 - error TS2307: Cannot find module 'web3-types/src/eth_types' or its corresponding type declarations.

3 import { Eip712TypedData } from 'web3-types/src/eth_types';
                                  ~~~~~~~~~~~~~~~~~~~~~~~~~~


Found 1 error in node_modules/.pnpm/[email protected]/node_modules/web3-rpc-methods/lib/types/eth_rpc_methods.d.ts:3

 ELIFECYCLE  Command failed with exit code 2.
node.js typescript compilation tsconfig web3
1个回答
0
投票

moduleResolution
中更新
tsconfig.json
对我有帮助。

是:

        "moduleResolution": "NodeNext",

我把它改为:

        "moduleResolution": "node",

希望这会有所帮助!

© www.soinside.com 2019 - 2024. All rights reserved.