Truffle初体验之Windows

Roway 发布于 2021-12-16 阅读 5128

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 ethereumjs-testrpc@6.0.3
  • 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

相关文章

3 条评论

发布文章怎么还扣积分呢?

2021-12-16 17:51

你在windows直接这样安装不会报错吗?

2022-04-12 23:47

点赞,阅读返还积分,棒棒~

2021-12-17 09:54