# Build a Web3 App with Solidity + Ethereum Smart Contracts section01 notes # Get your local Ethereum networking running|部署本地Ethereum环境 ## 1. 安装node ## 2. 安装nvm: ## [nvm 安装与使用(详细步骤) - 掘金](https://juejin.cn/post/7000652162950758431) ## [2\. Setting up the environment | Hardhat | Ethereum development environment for professionals by Nomic Labs](https://hardhat.org/tutorial/setting-up-the-environment.html) ```bash curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.35.2/install.sh | bash nvm install 16 ## 需要重新打开terminal 运行 nvm use 16 nvm alias default 16 npm install npm --global # Upgrade npm to the latest version ``` * 坑1 如果你是mac电脑,已经安装了npm ,注意先卸载再安装nvm 原因参考下述链接 * [想要在 Mac 电脑上面安装 nvm 来管理 npm,要保证 Mac 电脑上面没有安装 node 或者要提前卸载现有已安装的 node 版本,如果不提前清理 Mac 电脑上面的 node 版本会造成 nvm 安装失败](https://cloud.tencent.com/developer/article/1756404)](https://segmentfault.com/a/1190000018110318) * [如果你和我一样之前已经全局安装了 node,最好先将此删除,避免以后出现不必要的冲突。](https://juejin.cn/post/6844904056024989710) * npm node 的联系与区别:[nvm 和 npm 都是 node.js 应用程序开发的常用工具。 nvm 是 node.js 版本管理工具。 npm 是 JavaScript 包管理工具。](https://juejin.cn/post/6844904013398278157) * 坑2 gt push nvm到本地出现Git - SSL\_ERROR\_SYSCALL,解决方法如下 * [git - fatal: unable to access 'https://github.com/xxx': OpenSSL SSL\_connect: SSL\_ERROR\_SYSCALL in connection to github.com:443 - Stack Overflow](https://stackoverflow.com/questions/49345357/fatal-unable-to-access-https-github-com-xxx-openssl-ssl-connect-ssl-error) t - SSL\_ERROR\_SYSCALL 问题解决 | Hyperzsb’s Ideas](https://blog.hyperzsb.tech/git-ssl-error/) * 坑3 node 版本过高出现'ERR\_OSSL\_EVP\_UNSUPPORTED',解决方法如下(就是安装node 16就行了🥲) * [node.js - Node 17.0.1 causes some error - digital envelope routines::unsupported - Stack Overflow](https://stackoverflow.com/questions/69665222/node-17-0-1-causes-some-error-digital-envelope-routinesunsupported) ## 3. 安装hardhat ```bash mkdir my-wave-portal cd my-wave-portal npm init -y npm install --save-dev hardhat ``` ## 4. Get sample project going ```bash npx hardhat ## Choose the option to create a sample project. Say yes to everything. npm install --save-dev @nomiclabs/hardhat-waffle ethereum-waffle chai @nomiclabs/hardhat-ethers ethers ## Go ahead and install these other dependencies just in case it didn't do it automatically. npx hardhat accounts ``` ![image](https://tva1.sinaimg.cn/large/008i3skNgy1gwyod1s7jlj30v80dmjuh.jpg) ![image](https://tva1.sinaimg.cn/large/008i3skNgy1gwyod0n20oj30ry0h2wiz.jpg) ## 5. 🌟 Run it ```bash npx hardhat compile npx hardhat test ``` ![image](https://tva1.sinaimg.cn/large/008i3skNgy1gwyocwv1szj30t009c0tz.jpg) ## 6 delet it Go ahead and delete the file `sample-test.js` under `test`.  Also, delete `sample-script.js` under `scripts`. Then, delete `Greeter.sol` under `contracts`. Don't delete the actual folders! ![image](https://tva1.sinaimg.cn/large/008i3skNgy1gwyoedbn8nj315o0gwgo1.jpg) ## 7 summary 这一课是在电脑本地安装你的ETH编程环境,你需要安装git,nvm,node和hardhat,这一课我踩了不少坑,如果你网好,没有选择错,或许你会比我顺利。对了,如果你安装nvm和hardhat中遇到了问题,或者无法卸载node,直接删除nvm,node的文件夹重新安装即可。