npm install web3
web3@4.1.0 버전 설치 후 공식 문서를 참고하여 트랜잭션 조회하는 로직을 실행시켰는데 오류가 발생했다.
오류발생
Module not found: Error: Can't resolve '../error_codes' in 'C:\Users\USER\VsProject\superswap-dex\node_modules\web3-errors\lib\esm\errors'
원인
참고 자료: https://github.com/web3/web3.js/issues/6359
Using an older version of Web3 (4.0.3) also does not work as the dependencies of Web3 v4.0.3 includes web3-validator, web3-errors and their versions were stated as "^1.0.2" which caused the latest buggy version "2.0.0" or "1.1.0" to be pulled instead of the stable "1.0.2".
Web3 4.x 버전에 포함되어 있는 web3-errors dependencies 버전에 문제가 있어서 오류가 발생한다고 한다.
해당 내용을 참고하여 web3 github에서 다음과 같이 버전을 확인했다.
https://github.com/web3/web3.js/tree/v4.0.1
버전을 확인해보니 모든 4.x 버전에서 오류가 발생하는걸 확인했다.
가급적 최신 버전을 사용해보려 했지만 반복된 버전 변경과 오류 발견으로 인해 1.10.1 버전으로 변경했다.
npm uninstall web3
npm install web3@1.10.1