-
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 upgrade
breaks dependencies
#3202
Comments
A workaround is to
however this forces you to |
Re-install entire |
See: yarnpkg/yarn#3202 npm v5 is in next, so might as well go back vs trying to fix it.
Can repro on 0.27. |
(note: please disregard my previous - and now deleted - comment, it was about a different issue) I can't reproduce this issue (#3202). Running My repro script is the following: rm -rf foo
(
mkdir -p foo && cd foo
echo '{"dependencies":{"npm":"^3.10.5"}}' > package.json
debug() {
jq .version,.dependencies node_modules/npm/package.json
jq .version,.dependencies node_modules/npm/node_modules/npmlog/package.json
jq .version,.dependencies node_modules/npm/node_modules/npmlog/node_modules/gauge/package.json
}
echo Normal
~/yarn/bin/yarn >& /dev/null
~/yarn/bin/yarn list > a
debug
echo Upgrade
~/yarn/bin/yarn upgrade >& /dev/null
~/yarn/bin/yarn list > b
debug
rm -rf node_modules
echo Rm
~/yarn/bin/yarn >& /dev/null
~/yarn/bin/yarn list > c
debug
) |
@arcanis, this can be reproduced by checking contents of I think the problem is because those deps are bundled and Yarn does not treat them properly at linking phase.
|
I'm not 100% certain that an issue I'm encountering is the same one as described here, but I'm seeing unexpected and breaking behavior when using I have not spent significant time yet attempting to nail down the specifics and extent of the issue, but from my initial tests it appears that I'm happy to report this elsewhere if there's a more relevant existing thread or if it seems unrelated. If this seems like the appropriate location, I'm also happy to do further research towards describing the behavior. |
My temporary solution for this is to run:
after I get this error. I found that the removal of node_modules and yarning again was also only a temporary fix. The update above is less painful. |
I wish they fix this soon. Its so bad to have to reinstall every time I add a new dependency since it automatically does @bunkscene You can do |
**Summary** Actual fix: changed fs.readlink to fs.realpath when checking if a symlink is a linked dependency in package-linker.js This fixes yarn removing linked deps when installing or updating. Fixes #3288, fixes #4770, fixes #4635, fixes #4603. Potential fix for #3202. **Test plan** See #3288 (comment) for repro steps. See #3288 (comment) for my explanation of the problem. With a real world test scenario this works, but I'm unable to have it break from a unit test. I added a test in the integration suite but with the bug added back in it still passes because both generated paths are identical. I would like some help with the unit test.
This may be fixed via #4757. Anyone willing to confirm? |
…#4757) **Summary** Actual fix: changed fs.readlink to fs.realpath when checking if a symlink is a linked dependency in package-linker.js This fixes yarn removing linked deps when installing or updating. Fixes yarnpkg#3288, fixes yarnpkg#4770, fixes yarnpkg#4635, fixes yarnpkg#4603. Potential fix for yarnpkg#3202. **Test plan** See yarnpkg#3288 (comment) for repro steps. See yarnpkg#3288 (comment) for my explanation of the problem. With a real world test scenario this works, but I'm unable to have it break from a unit test. I added a test in the integration suite but with the bug added back in it still passes because both generated paths are identical. I would like some help with the unit test.
Hows that fix coming along? |
@kaylieEB and I took a look at this. @arcanis is on to the issue:
In the So on initial install those are just extracted from the bundle .tgz file. On I can think of 2 ways to potentially fix this:
Actually, thinking about this more, the 2nd option above won't work.
So Anyone want to poke through the NPM source and figure out how they handle this stuff? I wonder if they actually traverse directories of bundleDeps and just look for package.json files to process? Edit: I went back to NPM to see what the result would be, and it seems like NPM just doesn't upgrade anything.
So if NPM doesn't upgrade deps that are also bundled, then I don't think we should either. I propose we implement:
Any volunteers? :) |
Sounds like good digging! Although I don't follow it due to lack of my own background on yarn and npm. Is there a workaround, like adding a direct dependency of a specific version of a package (guage or npmlog?)? Or does this only affect certain combinations of node/npm/yarn versions? My team is getting this error all the time now to the point that I'm completely baffled why there isn't more "us too" 👍s on this issue by now. I'm concluding that it must be something specific to our setup and hopefully avoidable. |
Actually that information did help me. For a reason that is lost to history, we have the npm package itself as a sub-sub- ... devDependency and that version of npm is old and is including an old version of npmlog and and old version of gauge. I'm adding npm@latest as a direct devDependency of the project so that the right bits are installed. I'm hopeful that will solve it. I'm not confident about removing the npm dependency itself. |
Bundle dependencies are transitive, so bundling In npm@2, You probably should be able to update bundled deps (indeed, |
After running Just running |
In my case, I deleted my node_modules folder and my yarn_lock. I then ran |
Do you want to request a feature or report a bug?
Bug.
What is the current behavior?
yarn upgrade
updates the version of npmlog, but does not check its dependencies.If the current behavior is a bug, please provide the steps to reproduce.
Suppose you have a very simple package.json file like following:
Run
yarn
. You will find the folder structure is like:Then
yarn upgrade
.What is the expected behavior?
Not only update the version of npmlog, but also inner dependencies like gauge.
Please mention your node.js, yarn and operating system version.
node v6.9.1, OSX 0.11.6
The text was updated successfully, but these errors were encountered: