问题如下:
npm install web3
npm ERR! git fetch -a origin (https://github.com/ethereum/web3.js.git) fatal: unable to connect to github.com:
npm ERR! git fetch -a origin (https://github.com/ethereum/web3.js.git) github.com[0: 20.205.243.166]: errno=Connection refused
npm ERR! Linux 5.4.0-126-generic
npm ERR! argv "/usr/bin/node" "/usr/bin/npm" "install" "web3"
npm ERR! node v8.10.0
npm ERR! npm v3.5.2
npm ERR! code 128
npm ERR! Command failed: git fetch -a origin
npm ERR! fatal: unable to connect to github.com:
npm ERR! github.com[0: 20.205.243.166]: errno=Connection refused
npm ERR!
npm ERR!
npm ERR!
npm ERR! If you need help, you may report this error at:
npm ERR! <https://github.com/npm/npm/issues>
npm ERR! Please include the following file with any support request:
npm ERR! /usr/local/blockbench/src/micro/npm-debug.log
解决办法:
安装的时候加上版本号: npm install web3@1.2.3
不知道版本号的可以随便@版本号,然后它会列出所有版本号
andres@ubuntu1:/usr/local/blockbench/src/micro$ npm install web3@1.2.3
npm WARN deprecated mkdirp-promise@5.0.1: This package is broken and no longer maintained. 'mkdirp' itself supports promises now, please switch to that.
npm WARN deprecated request@2.88.2: request has been deprecated, see https://github.com/request/request/issues/3142
npm WARN deprecated har-validator@5.1.5: this library is no longer supported
npm WARN deprecated uuid@3.4.0: Please upgrade to version 7 or higher. Older versions may use Math.random() in certain circumstances, which is known to be problematic. See https://v8.dev/blog/math-random for details.
loadDep:mkdirp → 200 ▐ ╢████████████████████████░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░╟
npm WARN deprecated @types/bignumber.js@5.0.0: This is a stub types definition for bignumber.js (https://github.com/MikeMcl/bignumber.js/). bignumber.js provides its own type definitions, so you don't need @types/bignumber.js installed!
npm WARN deprecated @web3-js/websocket@1.0.30: The branch for this fork was merged upstream, please update your package to websocket@1.0.31
npm WARN deprecated uuid@2.0.1: Please upgrade to version 7 or higher. Older versions may use Math.random() in certain circumstances, which is known to be problematic. See https://v8.dev/blog/math-random for details.
npm WARN deprecated uuid@3.3.2: Please upgrade to version 7 or higher. Older versions may use Math.random() in certain circumstances, which is known to be problematic. See https://v8.dev/blog/math-random for details.
npm WARN deprecated ethereumjs-common@1.5.2: New package name format for new versions: @ethereumjs/common. Please update.
npm WARN deprecated ethereumjs-tx@2.1.2: New package name format for new versions: @ethereumjs/tx. Please update.
npm WARN deprecated @web3-js/scrypt-shim@0.1.0: This package is deprecated, for a pure JS implementation please use scrypt-js
loadDep:secp256k1 → fetch ▐ ╢████████████████████████████░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░╟
loadDep:secp256k1 → fetch ▌ ╢████████████████████████████░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░╟
> secp256k1@4.0.3 install /usr/local/blockbench/src/micro/node_modules/secp256k1
> node-gyp-build || exit 0
> keccak@3.0.2 install /usr/local/blockbench/src/micro/node_modules/keccak
> node-gyp-build || exit 0
> @web3-js/websocket@1.0.30 install /usr/local/blockbench/src/micro/node_modules/@web3-js/websocket
> (node-gyp rebuild 2> builderror.log) || (exit 0)
make: Entering directory '/usr/local/blockbench/src/micro/node_modules/@web3-js/websocket/build'
CXX(target) Release/obj.target/bufferutil/src/bufferutil.o
SOLINK_MODULE(target) Release/obj.target/bufferutil.node
COPY Release/bufferutil.node
CXX(target) Release/obj.target/validation/src/validation.o
SOLINK_MODULE(target) Release/obj.target/validation.node
COPY Release/validation.node
make: Leaving directory '/usr/local/blockbench/src/micro/node_modules/@web3-js/websocket/build'
> @web3-js/scrypt-shim@0.1.0 postinstall /usr/local/blockbench/src/micro/node_modules/@web3-js/scrypt-shim
> node ./scripts/postinstall.js
You can improve the performance of scrypt by upgrading to Node.js version 10.5.0 or newer, or by installing the (deprecated) scrypt package in your project
> es5-ext@0.10.62 postinstall /usr/local/blockbench/src/micro/node_modules/es5-ext
> node -e "try{require('./_postinstall')}catch(e){}" || exit 0
> web3@1.2.3 postinstall /usr/local/blockbench/src/micro/node_modules/web3
> node angular-patch.js