Package management in Truffle
With a growing number of reusable modules and libraries, it is important to have a package management mechanism for every development environment. Truffle supports both npm
and EthPM
. This recipe focuses mainly on installing, using, and publishing packages to various registries that are available with Truffle.
Getting ready
You need to have Truffle installed on your machine to download and run packages. Also, ensure that you have a stable version of npm available.
How to do it...
Truffle comes with two package managers: EthPM and npm. EthPM is the new package registry for Ethereum. It follows certain community-supported specifications for publishing and consuming smart contract packages. npm is the traditional package manager for Node.js, and Truffle provides support for using those packages.
EthPM
- To install a package from EthPM, use the truffle install command. You can also specify the version number exactly like you do with npm:
truffle install <package_name...