-
Notifications
You must be signed in to change notification settings - Fork 2.7k
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
yarn add local file copy node_modules directory #1334
Comments
Also it seems, that the |
If the child project is also a git repository, yarn add makes a copy of the .git folder in the parent project's node_modules/child_project. Trying to add another dependency to the parent project fails because it cannot delete the locked files in the .git folder. |
Surely what @mmeineke mentioned is a bug? Right now if you have three packages: packages/number-one Where three depends on two, two depends on one, it installs node_modules three times, like this: packages/number-one/yarn install -> creates node_modules Since it replicates node_modules of each local package, you quickly get huge megalomanically big directories with several hunderds of thousands of files. (Since it replicates all node_modules). P.S. These packages are linked using file syntax e.g. "file:../number-two". Also I've confirmed that with |
I've run into this issue as well. Copying the |
Confirmed still an issue with This bug causes Another workaround is to add a |
This is a major issue I've come across in several projects now. The behaviour of copying the node_modules folder results in multiple copies of the same library being used, which in turn results in lots of weird behaviour. Right now I'm using the same workaround as @cooperka ( Also on yarn v0.27.5. |
I too am exhibiting this problem. This occurs when trying to import Typescript definitions like I'm using yarn 1.2.1 $ yarn --version
1.2.1 I'm also fixing it by adding a line to our |
I have the same problem as explained above.
The problem disappears after installing the dependencies with npm. |
This is still happening with yarn v1.3.2. |
I've given up on yarn for handling this at the moment. I have a monorepo with a core component I reuse and I've added this script to package.json, and I run in on postinstall. Maybe it helps someone else:
|
Finally figured out that this is what's been happening to us when our devs' local builds fail for seemingly mysterious, spurious reasons. Ugh. |
This is still a problem for us in 1.7.0 |
Still a problem in 1.13.0 |
I run into this issue when installing local packages with peer dependencies. A longer explanation: I'm developing package P, which has a peer dependency PD. P is a TS project, so I need PD installed in order to compile it. I create package T to test P, install P ( A workaround: Remove P's node_modules before installing it in T. This really complicates my workflow though. yarn --version
1.13.0 |
Just wanted to mention this is still a problem in yarn 1.22.4. |
- Add prepare: - Remove node_modules in node_modules/eslint-plugin-filenames-simple: recursive created - Build plugin in node_modules - Fix prepack: - Rename clean to clean:dist See also: - https://docs.npmjs.com/cli/v6/using-npm/scripts#life-cycle-operation-order - yarnpkg/yarn#1334 (comment) - https://github.com/yarnpkg/yarn/blob/785cda8020aa5f513d6f60b8349bca8dab9dd79b/src/cli/commands/install.js#L1198-L1213 - https://github.com/yarnpkg/yarn/blob/785cda8020aa5f513d6f60b8349bca8dab9dd79b/src/cli/commands/publish.js#L46-L49
- Add prepare: - Remove node_modules in node_modules/eslint-plugin-filenames-simple: recursive created - Build plugin in node_modules - Fix prepack: - Rename clean to clean:dist See also: - https://docs.npmjs.com/cli/v6/using-npm/scripts#life-cycle-operation-order - yarnpkg/yarn#1334 (comment) - https://github.com/yarnpkg/yarn/blob/785cda8020aa5f513d6f60b8349bca8dab9dd79b/src/cli/commands/install.js#L1198-L1213 - https://github.com/yarnpkg/yarn/blob/785cda8020aa5f513d6f60b8349bca8dab9dd79b/src/cli/commands/publish.js#L46-L49
- Add prepare: - Remove node_modules in node_modules/eslint-plugin-filenames-simple: recursive created - Build plugin in node_modules - Fix prepack: - Rename clean to clean:dist See also: - https://docs.npmjs.com/cli/v6/using-npm/scripts#life-cycle-operation-order - yarnpkg/yarn#1334 (comment) - https://github.com/yarnpkg/yarn/blob/785cda8020aa5f513d6f60b8349bca8dab9dd79b/src/cli/commands/install.js#L1198-L1213 - https://github.com/yarnpkg/yarn/blob/785cda8020aa5f513d6f60b8349bca8dab9dd79b/src/cli/commands/publish.js#L46-L49
- Add prepare: - Remove node_modules in node_modules/eslint-plugin-filenames-simple: recursive created - Build plugin in node_modules - Fix prepack: - Rename clean to clean:dist See also: - https://docs.npmjs.com/cli/v6/using-npm/scripts#life-cycle-operation-order - yarnpkg/yarn#1334 (comment) - https://github.com/yarnpkg/yarn/blob/785cda8020aa5f513d6f60b8349bca8dab9dd79b/src/cli/commands/install.js#L1198-L1213 - https://github.com/yarnpkg/yarn/blob/785cda8020aa5f513d6f60b8349bca8dab9dd79b/src/cli/commands/publish.js#L46-L49
- Add prepare: - Remove node_modules in node_modules/eslint-plugin-filenames-simple: recursive created - Build plugin in node_modules - Fix prepack: - Rename clean to clean:dist See also: - https://docs.npmjs.com/cli/v6/using-npm/scripts#life-cycle-operation-order - yarnpkg/yarn#1334 (comment) - https://github.com/yarnpkg/yarn/blob/785cda8020aa5f513d6f60b8349bca8dab9dd79b/src/cli/commands/install.js#L1198-L1213 - https://github.com/yarnpkg/yarn/blob/785cda8020aa5f513d6f60b8349bca8dab9dd79b/src/cli/commands/publish.js#L46-L49
- Add prepare: - Remove node_modules in node_modules/eslint-plugin-filenames-simple: recursive created - Build plugin in node_modules - Fix prepack: - Rename clean to clean:dist See also: - https://docs.npmjs.com/cli/v6/using-npm/scripts#life-cycle-operation-order - yarnpkg/yarn#1334 (comment) - https://github.com/yarnpkg/yarn/blob/785cda8020aa5f513d6f60b8349bca8dab9dd79b/src/cli/commands/install.js#L1198-L1213 - https://github.com/yarnpkg/yarn/blob/785cda8020aa5f513d6f60b8349bca8dab9dd79b/src/cli/commands/publish.js#L46-L49
- Add prepare: - Remove node_modules in node_modules/eslint-plugin-filenames-simple: recursive created - Build plugin in node_modules - Fix prepack: - Rename clean to clean:dist See also: - https://docs.npmjs.com/cli/v6/using-npm/scripts#life-cycle-operation-order - yarnpkg/yarn#1334 (comment) - https://github.com/yarnpkg/yarn/blob/785cda8020aa5f513d6f60b8349bca8dab9dd79b/src/cli/commands/install.js#L1198-L1213 - https://github.com/yarnpkg/yarn/blob/785cda8020aa5f513d6f60b8349bca8dab9dd79b/src/cli/commands/publish.js#L46-L49
- Add prepare: - Remove node_modules in node_modules/eslint-plugin-filenames-simple: recursive created - Build plugin in node_modules - Fix prepack: - Rename clean to clean:dist See also: - https://docs.npmjs.com/cli/v6/using-npm/scripts#life-cycle-operation-order - yarnpkg/yarn#1334 (comment) - https://github.com/yarnpkg/yarn/blob/785cda8020aa5f513d6f60b8349bca8dab9dd79b/src/cli/commands/install.js#L1198-L1213 - https://github.com/yarnpkg/yarn/blob/785cda8020aa5f513d6f60b8349bca8dab9dd79b/src/cli/commands/publish.js#L46-L49
Found an easy workaround: "scripts": {
"preinstall": "rm -rf node_modules"
}, When developing this package, you still get every deps you need but these will be removed when installing happens in userland. |
WTF. It's ignoring
Indeed, I did. One version in my app, and another version in the package! I suppose the
Note that you need to run |
Still a problem with v.1.22.19. I've used the postinstall script in the parent project, works fine. How do I use a preinstall script on the child project? I can add it, but it doesn't run when doing "yarn add file..." |
1 similar comment
Still a problem with v.1.22.19. I've used the postinstall script in the parent project, works fine. How do I use a preinstall script on the child project? I can add it, but it doesn't run when doing "yarn add file..." |
Do you want to request a feature or report a bug?
Report a bug
What is the current behavior?
yarn add file:/path/to/child_project
copy thenode_modules
directory into thenode_modules
directory of the parent projectIf the current behavior is a bug, please provide the steps to reproduce.
child_project
, add a dependency in this project (sayreact
withyarn add react
)parent_project
, add the child project to the parent project as a local fileyarn add file:/path/to/child_project
node_modules
directory, check thechild_project
directory (ls node_modules/child_project
):you get
What is the expected behavior?
Not sure exactly what should happen but I guess the
node_modules
directory should not be copied. Moreover yarn should probably read.npmignore
(and.yarnignore
?) in order to copy only the necessary files.Please mention your node.js, yarn and operating system version.
node v6.8.1
yarn v0.16.0
macOS Sierra 10.12
The text was updated successfully, but these errors were encountered: