我已将
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.
在
moduleResolution
中更新 tsconfig.json
对我有帮助。
是:
"moduleResolution": "NodeNext",
我把它改为:
"moduleResolution": "node",
希望这会有所帮助!