If making the gnocchi from scratch, begin by cooking the potatoes. Wash and prick the potatoes with a fork, then place them on a baking sheet. Bake at 400°F for about 1 hour, or until the potatoes are tender. Remove the potatoes from the oven and let them cool slightly.
Once the potatoes are cool enough to handle, peel them and pass them through a potato ricer or a food mill. Spread the riced potatoes out on a clean work surface and let them cool completely.
Once the potatoes are cool, make a well in the center and add the flour, egg, salt, and pepper. Using your hands, mix the ingredients together until a dough forms. If the dough is too sticky, add more flour as needed.
Divide the dough into 4 equal pieces. On a lightly floured surface, roll each piece of dough into a long rope about 1/2 inch in diameter. Cut the rope into 1/2 inch pieces.
To form the gnocchi, use a fork to gently press down on each piece of dough, creating a small indentation. Place the gnocchi on a lightly floured baking sheet as you work.
Bring a large pot of salted water to a boil. Add the gnocchi to the pot and cook for about 2-3 minutes, until they float to the surface. Remove the gnocchi from the water with a slotted spoon and set aside.
While the gnocchi are cooking, make the basil pesto. Add the basil leaves, pine nuts, Parmigiano Reggiano, olive oil, garlic, salt, and pepper to a blender or food processor. Pulse until a smooth and creamy sauce forms.
In a large skillet, melt the butter over medium heat. Add the cooked gnocchi and the basil pesto to the skillet. Toss to coat the gnocchi in the pesto.
Season with salt and pepper to taste.
Serve hot and enjoy!