This is code demonstrates how to use the yahooFinance2 node.js package in a simple Next.js project.
First, install yahooFinance2:
npm install yahooFinance
From there, you should be able to run this code.
Thanks to @gadicc for building yahooFinance2!