Set up environment
[MUST] For this tutorial, you must follow the versions specified on the first page when you are setting up the environment. Please change the node version to 10.16.0 by using nvm before downloading caver-js.
1. Install Node.js (npm)
- Download Node.js (npm) from the official site: https://nodejs.org/
- Install the package by clicking the download file.
- Type
$ node --versionin your terminal to verifynodehas been successfully installed.v10.16.0
⚠ At the time of writing, the latest LTS version that is compatible with caver-js is 10.16.0. If you have a higher Node version, caver-js cannot be installed. Reinstall the Node or use NVM (Node Version Manager) to set up a stable environment.
2. Install Truffle
Truffle is a great tool for compiling and deploying contract files.
Use
nvmto set the node version to 12.0.0 only if you are using truffle.
- Type
$ nvm install 12.0.0 - Type
$ nvm use 12.0.0 - Type
$ sudo npm install -g trufflein your terminal to install the truffle. - Type
$ truffle versionin your terminal to verifytrufflehas been installed successfully. - (Deploy your smart contract by using truffle)
- Type
$ nvm use 10.16.0to come back node v10.16.0 after using truffle.
⚠ If the version is lower than 5, install the truffle version 5.
$ sudo npm install -g truffle@5