Reading your documentation on doing previews for Next.js, you make specific reference to needing 4.0.0 of the @prismicio/client.
Make sure that you are using the latest @prismicio/client v.4.0.0 kit or above.
This is doubly confusing because it would appear you have deprecated the @prismicio/client package or renamed it on NPM/Github to prismic-javascript. And then if you use Yarn/NPM to pull in prismic-javascript, you haven't updated the package registry to use anything above v3.0.2 so it isn't possible.
Perhaps this is intentional because v4 of primsic-javascript looks to have jumped up to TS and that may cause some issues?
In the meantime, I have gotten v4 to work by manually adding the package into my Next repo in /api/prismic. But, if you're project is running as a JS project, you will have to make sure you set Next up for TS support. That's pretty easy - just follow their instructions.