Could not resolve "convex/server"
I run this error while trying to create the "convex/tasks.ts" from the NextJS quickstart.
16 Replies
Hi @shanghuang, did you figure this out? It looks like you need to install convex. Since it looks like you're using yarn, I think what you want in
yarn add convex
Hi Tom, thanks for you reply. I wan't able to figure this out yet.
Yarn was not used in the project.
I was following the quickstart guide for nextjs. using npm.
I am sure the package is installed. I was able to
and sees the data on Convex dashboard.
When it gets to preparing Convex functions.... for tasks.ts, it jumps up this erorr:
Here is the package.json
I am using npm 10.0.0 npx 10.0.0
Do you intend to be using yarn plug'n'play? The error makes it sound like you need to add convex to that file, ../.pnp.cjs
that's what i thought so. But I don't have yarn on my develop machine, and i can't find a .pnp.cjs on the machine.
My guess is that it has somethign to do with the previous yarn I installed. But, at this moment, i can't spot the error.
Hi Tom, after installing a clean version of MacOS, installed node through Brew. It still jumps up the same message.
@shanghuang what's the output of
npm i
@shanghuang I'd make sure to start with a fresh project directory that never uses Yarn.
Hi @jamwt , the message after npm install convex, , and the message after npm i.


@Michal Srb I am pretty sure it's a fresh project and a fresh development machine. The operation system was just reset to factory default. Then used brew and npm to install a couple of required packages.



@shanghuang can you rm -rf the convex/_generated folder and then just try
npx convex codegen
by itself?Do you have
.pnp.cjs
in the project folder? ls -al
to see all files.
(if yes, delete it with rm .pnp.cjs
)Hi Michal, No, I don't have .pnp.cjs in the project folder.
Hey Jamie, Thanks for looking into this issue. I try to rm the _generate fold. But still, the issue raised.

This appears to be triggered by a .pnp.cjs file in the parent directory… ~/Code
After reading https://stackoverflow.com/questions/76015181/the-yarn-plugnplay-manifest-forbids-importing-xyz-here-because-its-not-list , I’d recommend rm ../.pnp.cjs and trying again
Stack Overflow
The Yarn Plug'n'Play manifest forbids importing "XYZ" here because ...
Yarn 3.5 (stable) using ViteJS - I keep getting this same error for various third party packages. I'm lost on how to properly solve this. The message says I can mark "react" as external, ...
Problem solved! Thanks @jamwt , and Thanks @Michal Srb as well. I should have checked the parent folder.
I love the concept and idea behind convex, so wanna try it out and introduce to my friends !!
really glad to hear it!