A few days ago, I got stuck trying to install Graph-cli on my Ubuntu operating system. I had to make a lot of research to figure it out, and I did with the help of my peers too.
In this article, I will be sharing how to install Graph-cli on Ubuntu, and this will be a quick one.
The Graph CLI is written in JavaScript, and you will need to install either yarn or npm to use it; it is assumed that you have yarn in what follows. Once you have yarn, install the Graph CLI by running,
For Ubuntu, install with yarn or npm:
sudo yarn global add @graphprotocol/graph-cli
The sudo keyword gives the dependencies root access to your OS
Other Methods on Linux
libsecret is used for storing access tokens, so you may need to install it before getting started. Use one of the following commands, depending on your distribution:
Debian/Ubuntu:
sudo apt-get install libsecret-1-dev
Red Hat:
sudo yum install libsecret-devel
Arch Linux:
sudo pacman -S libsecret
For other OS, install with yarn or npm:
yarn global add @graphprotocol/graph-cli
Once installed, the graph init command can be used to set up a new subgraph project, either from an existing contract on any of the public Ethereum networks or from an example subgraph. This command can be used to create a subgraph on the Subgraph Studio by passing in graph init --product subgraph-studio.
If you already have a smart contract deployed to the Ethereum mainnet or one of the testnets, bootstrapping a new subgraph from that contract can be a good way to get started.
Learn more about creating and deploying subgraph here.
Top comments (0)