如何开始使用web3版本1.x.

时间:2018-03-17 12:10:43

标签: npm solidity web3

在web3版本1.x文档中:https://web3js.readthedocs.io/en/1.0/getting-started.html它表示使用

安装Web 3
npm install web3

但是这会安装0.2x.00版本。

那我该怎么办?

1 个答案:

答案 0 :(得分:0)

直接使用1.0分支从github repo安装:

npm install git+https://github.com/ethereum/web3.js.git\#1.0ES6

编辑:将示例安装添加到新项目目录中。

$ npm install git+https://github.com/ethereum/web3.js.git\#1.0ES6

> web3@1.0.0-beta.24 postinstall C:\cygwin\home\adamk\eth\web3-1.0\node_modules\web3
> lerna bootstrap

lerna info version 2.9.0
lerna info Bootstrapping 20 packages
lerna info lifecycle preinstall
lerna info Installing external dependencies
lerna info Symlinking packages and binaries
lerna info lifecycle postinstall
lerna info lifecycle prepublish
lerna info lifecycle prepare
lerna success Bootstrapped 20 packages
npm WARN saveError ENOENT: no such file or directory, open 'C:\cygwin\home\adamk\eth\web3-1.0\package.json'
npm notice created a lockfile as package-lock.json. You should commit this file.
npm WARN enoent ENOENT: no such file or directory, open 'C:\cygwin\home\adamk\eth\web3-1.0\package.json'
npm WARN web3-1.0 No description
npm WARN web3-1.0 No repository field.
npm WARN web3-1.0 No README data
npm WARN web3-1.0 No license field.

+ web3@1.0.0-beta.24
added 1 package in 65.026s