Setting up a Node project
This guide will help you get your Node development environment set up, which you’ll need to use the different OpenZeppelin tools and other third party products.
|If you are already familiar with Node, npm and Git, feel free to skip this guide!|
|If you are running Windows consider using Windows Subsystem for Linux as much of the ecosystem is written for Linux.|
Once you’re done, run
node --version on a terminal to check your installation: any version of the 10.x or 12.x line should be compatible with most Ethereum software.
$ node --version v12.22.1
package.json, describing the package’s name, version, content, and others. When you build your own project, you will be creating a package, even if you don’t plan to distribute it.
All Node installations include a command-line client for the npm registry, which you’ll use while developing your own projects. To start a new project, create a directory for it:
$ mkdir learn && cd learn
Then we can initialize it:
$ npm init -y
Simple as that! Your newly created
package.json file will evolve as your project grows, such as when installing dependencies with
A third binary was included when installing node:
npx. This is used to run executables installed locally in your project.
For clarity we’ll display the full command in our guides including
npx so we don’t get errors due to the binary not being in the system path:
$ truffle init truffle: command not found $ npx truffle init - Fetching solc version list from solc-bin. Attempt #1 Starting init... ================ > Copying project files to ... Init successful, sweet!
Make sure you are inside your project’s directory when running
Before you get coding, you should add version control software to your project to track changes.
|If you’ve never used Git before, a good starting place is the Git Handbook.|
Don’t commit secrets such as mnemonics, private keys and API keys to version control! Make sure you