Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Docs: How to initial install all modules in all packages in the workspace? #7910

Open
theogravity opened this issue Apr 6, 2024 · 8 comments
Labels
area: docs Improvements or additions to documentation needs: reproduction owned-by: turborepo

Comments

@theogravity
Copy link

What is the improvement or update you wish to see?

I'm looking at https://turbo.build/repo/docs/handbook/package-installation and followed the instructions to just do an npm install, but none of my workspace packages have a node_modules directory.

Not sure what I'm doing wrong here. I'm using normal npm and my package.json has a workspaces value of "packages/*" and all my packages are in that dir.

Is there any context that might help us understand?

I just want to recursively run npm install on all packages in my turbo monorepo

Does the docs page already exist? Please link to it.

https://turbo.build/repo/docs/handbook/package-installation

@theogravity
Copy link
Author

Note: I tried also with latest yarn (4.x) and it also doesn't install recursively.

pnpm does work, though, where pnpm install will recursively install once I set up the pnpm-workspace.yaml file.

@anthonyshew
Copy link
Contributor

This sounds like intended behavior. Different package managers install to different locations in Workspaces. The dependencies you're looking for are likely in the node_modules in the root of your repository.

If you start your development server or run a build, do your dependencies resolve? If so, that means your package manager is doing its job correctly and you can close this issue.

@theogravity
Copy link
Author

theogravity commented Apr 6, 2024

I have dependencies in my workspace packages that need to be installed. If I try to build my workspace packages like turbo build, it will fail because the deps in the workspace packages aren't installed (their respective package.json files have the deps listed).

I have to manually run yarn install / npm install on each of those package directories for it to work.

The turbo documentation says that running either should install all deps for workspace packages, but it doesn't. It seems to be an issue with npm and yarn respectively instead of turbo based on my research so far, but the turbo docs are incorrect in claiming that it would.

@theogravity
Copy link
Author

theogravity commented Apr 6, 2024

Via the document link

You'll now see node_modules folders appear in the root of your repository, and in each workspace.

I only see it in the root, not each workspace package. Exception is pnpm which works as expected.

@tknickman
Copy link
Member

Could you share a reproduction repo, along with the npm version you're using?

@arlyon arlyon added the area: docs Improvements or additions to documentation label Apr 8, 2024
@GabenGar
Copy link

@theogravity

I have dependencies in my workspace packages that need to be installed. If I try to build my workspace packages like turbo build, it will fail because the deps in the workspace packages aren't installed (their respective package.json files have the deps listed).

This is quite vague, are you resolving the dependencies manually within workspaces?

@theogravity
Copy link
Author

@theogravity

I have dependencies in my workspace packages that need to be installed. If I try to build my workspace packages like turbo build, it will fail because the deps in the workspace packages aren't installed (their respective package.json files have the deps listed).

This is quite vague, are you resolving the dependencies manually within workspaces?

Running npm / yarn install in the respective dirs.

@mehulkar
Copy link
Contributor

@theogravity node_modules appearing in each package or not is up to the package manager, you should consult their docs or open issues there if you're seeing unusual behavior. Based on my experience with package managers, a node_module directory only appearing in the root of the workspace is quite normal (although there are various configurations and versions that might produce different results).

If I try to build my workspace packages like turbo build, it will fail because the deps in the workspace packages aren't installed

this seems like a red herring and unrelated to your npm install based on the info provided. Please provide a reproduction or a the logs from turbo build or something to help further diagnose the problem.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: docs Improvements or additions to documentation needs: reproduction owned-by: turborepo
Projects
None yet
Development

No branches or pull requests

6 participants