Reputation: 1953
I ran into this error when trying to build nextjs commerce into an existing monorepo. There were a slew of other errors resulting from switching to yarn workspaces and turbo, but this one was the most cryptic. I was able to determine that the files in the repo were perfectly fine by successfully deploying the same files in a different repo and different project. So the question is WHY IS THIS HAPPENING only for this project deploy on Vercel in my monorepo?
Upvotes: 0
Views: 878
Reputation: 1953
This can be caused if you have next@latest as one of the dependencies in a related project. If you examine the failing build's warnings carefully you will notice:
warning Pattern ["next@latest"] is trying to unpack in the same destination "/vercel/.cache/yarn/v6/npm-next-12.1.5-7a07687579ddce61ee519493e1c178d83abac063-integrity/node_modules/next" as pattern ["next@^12.0.8","next@^12.0.8","next@^12.0.8","next@^12.0.8"]. This could result in non-deterministic behavior, skipping.
This is the revealing error. The manifested problem in my case was that the error above. However I suspect it could show up in other ways. This is just one of the gotchas you should be aware of if using yarn workspaces. Moved to next@latest to ^12.0.8 and suddenly all problems will vanish. You're welcome. Don't waste a day on this like I did.
Upvotes: 0