Closed fxmb closed 1 year ago
The issue seems to be related to devDependencies. Whenever I add the missing package (e.g. typescript) to the regular dependencies it works for that package. It then throws the next error:
medusa-next:build: Type error: Could not find a declaration file for module 'js-cookie'. '/vercel/path0/node_modules/js-cookie/index.js' implicitly has an 'any' type.
If I then go ahead and add @types/js-cookie to the actual dependencies, not the dev dependencies it gets installed and works, e.g. it complains about the next type declaration file it is missing. However, all type declartaions are there in devDependencies already. they should be recognized and working without being part of the actual dependency ...
I am sure I am just missing a tiny detail in my setup but I would really appreciate some help to fix this and the deployments running. Thanks
Isn't the whole point of devDependencies that they get installed in a development environment, and not in production, such as on vercel?
This is expected behavior of yarn
when operating in a production context (docs). Do you have NODE_ENV
set to production by chance? That's one thing that will alter this behavior of yarn.
If you do need dev deps installed at build time on vercel you can override this by passing an arg to yarn on install (--prod=false
).
What version of Turborepo are you using?
latest
What package manager are you using / does the bug impact?
Yarn v2/v3 (node_modules linker only)
What operating system are you using?
Mac
Describe the Bug
I have an issue since more than a week about deploying my nextjs app on vercel using yarn.
I am using a standard turborepo setup forked from this repository: https://github.com/aaron5670/webshop-starter/tree/main
yarn install
turbo run build
locally. So far so good.a) I have left the install on vercel to the default using
yarn install
. It works fine. b) The build command iscd ../.. && turbo run build --filter={apps/store}...
. This is where things start to get funky:I consistently get build errors around certain packages and basic dependencies not found:
Obviously typescript should be installed.
This is my package.json at the root:
and then my package.json on the apps/store level:
My tsconfig on the apps/store:
We would really appreciate any kind of help, this has been an issue for more than a week now and I really do not understand what is causing the issue here.
It seems that my dependencies are not properly installed or that my vercel build command is off not recognizsing the correct
node_modules
folder.Expected Behavior
I would expect the build command to succeed on vercel
To Reproduce
Clone this repository and deploy to vercel: https://github.com/aaron5670/webshop-starter/tree/main
Reproduction Repo
https://github.com/aaron5670/webshop-starter/tree/main