Do you want to request a feature or report a bug?
This is a bug.
What is the current behavior?
Inside a workspace, yarn upgrade
fails immediately.
If the current behavior is a bug, please provide the steps to reproduce.
Given the following structure:
stuff $ tree
.
βββ node_modules
β βββ stuff-bar -> ../packages/bar
β βββ stuff-foo -> ../packages/foo
βββ package.json
βββ packages
β βββ bar
β β βββ package.json
β βββ foo
β βββ package.json
βββ yarn.lock
6 directories, 4 files
Running yarn upgrade
does this:
stuff/packages/foo $ yarn upgrade
yarn upgrade v1.0.2
error No lockfile in this directory. Run `yarn install` to generate one.
What is the expected behavior?
Yarn upgrades the packages referenced in the package.json file.
Please mention your node.js, yarn and operating system version.
node.js: 8.4.0 from Nix
Yarn: 1.0.2
OS: macOS 10.12.6
Hi! I think the fixes in #4654 might have solved this. Could you give yarn 1.2.0 a go and see if it still reproduces? :-)
I have a similar issue but with the --latest
option, yarn says it's doing what you expect but none of the dependencies or package.json
are upgraded when within a workspace.
>yarn versions
yarn versions v1.3.2
{ http_parser: '2.7.0',
node: '8.9.1',
v8: '6.1.534.47',
uv: '1.15.0',
zlib: '1.2.11',
ares: '1.10.1-DEV',
modules: '57',
nghttp2: '1.25.0',
openssl: '1.0.2m',
icu: '59.1',
unicode: '9.0',
cldr: '31.0.1',
tz: '2017b' }
Done in 0.07s.
I'm witnessing the same behavior with --latest
. Only way around it seems to be doing a yarn add package@<latest-version>
.
It seems yarn upgrade-interactive --latest
does work
Seems to work well now.
@SamirTalwar For me it does not work with workspaces, I am on version 1.5.1 (latest). Another problem is that this part of the documentation is not respected:
The
package.json
file will be updated to reflect the latest version range.
Happy for this to be reopened until someone can definitely answer this one. I canβt reproduce it any more, but I havenβt tried very hard. Iβm writing very little JavaScript at the moment.
I'm also suffering from the issue. Steps I can reproduce:
yarn outdated
- see outdated packages, let's take bugsnag-js
as an example
yarn upgrade bugsnag-js --latest
- successful ugrade with result:
success Saved lockfile.
success Saved 7 new dependencies.
info Direct dependencies
info All dependencies
ββ @hitask/[email protected]
ββ @hitask/[email protected]
ββ @hitask/[email protected]
ββ @hitask/[email protected]
ββ @hitask/[email protected]
ββ @hitask/[email protected]
ββ @hitask/[email protected]
yarn outdated
- no changes in the list. No changes in any package.json and yarn.lock too
yarn upgrade-interactive --latest
is working ok
Can't get this to work. The last comment since April 10... is it a dead project?
yarn workspace %WORKSPACE% upgrade @babel/cli @babel/core babel-preset-react-native --latest
Reproducing this issue on macos 10.14, yarn 1.15.2, and can confirm the yarn upgrade-interactive --latest
workaround above.
This bug is still around in yarn v1.16.0. Here is a minimal example repo: https://github.com/neodon/yarn-workspace-upgrade-bug
The repo has two workspaces, in packages/a
and packages/b
. Both workspaces and the root have the chai
module installed with the version set to exactly 4.0.0
. The latest is 4.2.0
.
Running yarn upgrade --latest
in the root does what I expect--the chai
module is upgraded to 4.2.0
and both package.json
and yarn.lock
are updated.
root package.json diff:
"dependencies": {
- "chai": "4.0.0"
+ "chai": "4.2.0"
}
Now I switch into the packages/a
directory and run yarn upgrade --latest
. No changes. Same if I run the command in packages/b
.
I expect that when I run yarn upgrade --latest
in a workspace directory, it operates on that workspace the same as the root or a non-workspace project. It should both upgrade all packages to the latest version and update package.json
.
If I run yarn upgrade-interactive --latest
anywhere in the project, it lets me select the workspaces and it updates their package.json
files as expected. I expect yarn upgrade --latest
should do the same thing when run in a workspace directory and I think it's a common and reasonable expectation.
I've tried yarn upgrade-interactive --latest
in the root of the repository, it upgrades packages correctly in the root node_modules, but packages.json files inside packages/*
are not updated to reflect the latest version range.
Same as @pldg , there doesn't seem to be a way to upgrade a dependency of a workspace using yarn upgrade
, or yarn upgrade-interactive
. On yarn 1.16.0 and OSX 10.14.4 if that matters. Unlike for @neodon there's nothing that I'd describe as letting me "select workspaces". I only see the list of root level dependencies, no matter where I run it
MacOS version: 10.15.1
Yarn installed via HomeBrew
Yarn version: 1.19.2
Yarn workspace
package.json
, moreover, this command doesn't update the modules in the node_modules/*
I've encountered the a similar issue, see https://github.com/yarnpkg/yarn/issues/7698 where I have created a reproducible repo.
Any update from the yarn team on this?
Encountering the same issue, yarn upgrade --latest
doesn't touch the workspaces. Running the command from inside the workspace directory also doesn't work, so the only way to upgrade packages inside a workspace is by manually upgrading the packages one by one :(
Wow, 3 year old bug, still not fixed.
I "solved" it in a different way, did not want to mess with interactive mode:
package.json
to an another dir and run thereyarn
firstyarn upgrade --latest
package.json
back to the original dir and run thereyarn
@jazzfog It appears that Yarn v1 is essentially abandoned since they are working on the Yarn v2 rewrite.
Yarn v2 is looking awesome, but their abandoning Yarn v1 really irks me and I'm on the fence about promoting Yarn v2 in my organization.
When will they decide it's time for Yarn v3 and abandon Yarn v2 the same way? I think they need to address the community on this problem.
@parafox0417 You making a good point.
Most helpful comment
yarn upgrade-interactive --latest
is working ok