-
Notifications
You must be signed in to change notification settings - Fork 3.2k
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
--install-strategy=nested still hoists workspace packages #6537
Comments
I have experienced the same issue. @pcone to get around the Another repo for reproducing: https://github.com/morganney/npm-workspaces If you run I have created a workaround for this shortcoming by running |
I have also experienced this. I have also seen shared dependencies still being hoisted. node-fetch seems to be affected. We have a several dependencies that depend on it and no matter what It would be great to see a fix for this. |
I have the same issue. I removed node_modules
and ran install command with |
Also affected by this |
Same issue here, npm 10.5.2 on node v20.11.1. I can't used linked either because it breaks the angular compiler. |
|
Note: this is configured in .npmrc file but it's different that npm's install strategy, tried to use npm's workspaces and disable hoisting but stumbled upon npm/cli#6537
aimed to make minimal updates to the build process to work with workspaces. - node modules are hoisted in npm workspaces, this is not configurable AFAIK, better to use PNPM (npm symlink support is experimental, and hoisting is not configurable see npm/cli#6537) - will discuss on discord further refactoring opportunities with the package scripts.
You can still use All you have to do is
It looks like cli parameters are not passed/parsed correctly. Environment variables are also possible according to The Docs but I didn't test that. I used [email protected] |
Does not work with [email protected]. Dependencies are still hoisted to |
I have the same issue All dependencies are installed in the root The local |
…gement (won't work with npm workspaces & npm/cli#6537 (comment))
Is there an existing issue for this?
This issue exists in the latest npm version
Current Behavior
Currently, running npm install at the root of a monorepo using npm workspaces with the '--install-strategy=nested' flag almost does what I would expect it to do - it puts all the dependencies in separate node_modules folders for each package, but it still puts the symlinks to the local monorepo packages at the root.
Expected Behavior
I would expect the symlinks to the monorepo packages to be inserted into the nested node_modules folders rather than the root (and only for the packages that depend on them).
I also noticed that the --omit=dev flag seems to not work in this use case - note in the linked repro repo running 'npm install --install-strategy=nested --omit=dev' still results in eslint being added to workspace2's node_modules folder, even though it's only a devDependency. (I can make a separate issue for this if that would be better?)
Note for context: My use case here is a monorepo with multiple node apps in it, each of which needs to be separately bundled into a docker image with only it's dependencies, I don't want to unnecessarily include the dependencies of other packages in the monorepo. The '--install-strategy=nested' flag seems like what I need for my use case, but the current behaviour doesn't quite work.
Steps To Reproduce
Environment
The text was updated successfully, but these errors were encountered: