Truffle初体验之Windows

Truffle初体验之Windows

第一步: 安装nodejs

第二步: 安装truffle

进入cmd

D:\truffle>npm install -g truffle

第三步:

D:\truffle>npm install ganache-cli -g

启动ganache

D:\truffle>ganache-cli

Ganache CLI v6.12.2 (ganache-core: 2.13.2)

说明:这里如果使用如下命令安装的话,到时候部署会报错【切记不要使用这种过期的安装方式---踩坑了!!!】

  • 这种错误信息:VM Exception while processing transaction: invalid opcode*
  • npm -g install [email protected]
  • D:\truffle\MetaCoin>TestRPC*
  • EthereumJS TestRPC v6.0.3 (ganache-core: 2.0.2)*

第四步:

进入一个新的cmd

    mkdir MetaCoin

    cd MetaCoin

d:\truffle\MetaCoin>truffle unbox metacoin

说明:这里可能会报错【Got error: getaddrinfo ENOENT raw.githubusercontent.com.】

解决方案是:

    1、查看raw.githubusercontent.com的真实IP地址【https://www/ipaddress.com/】

    2、把查询到的ip,配置到C:\Windows\System32\drivers\etc\hosts文件里面

        比如:185.199.108.133 raw.githubusercontent.com

                    185.199.109.133 raw.githubusercontent.com

                    185.199.110.133 raw.githubusercontent.com

                    185.199.111.133 raw.githubusercontent.com

第五步:

修改:truffle-config.js文件

第六步:

truffle compile

truffle migrate

truffle test

本文参与2022世界杯预选赛赛程直播社区写作激励计划 ,好文好收益,欢迎正在阅读的你也加入。

3 条评论

请先 登录 后评论
Roway
Roway

1 篇文章, 81 学分