Yarn: Running `yarn upgrade package` on local package fails to lookup package from local repo

Created on 25 Oct 2016  路  6Comments  路  Source: yarnpkg/yarn

Do you want to request a _feature_ or report a _bug_?
Bug

What is the current behavior?
Having the following in package.json

{
  "dependencies": {
    "some-local-package": "git+ssh://[email protected]/vendor/some-local-package.git#master"
  }
}

When running yarn upgrade on that specific package, it seems yarn tries to look in NPM instead of at the local repo.

$ yarn upgrade some-local-package
yarn upgrade v0.16.1
[1/4] 馃攳  Resolving packages...
error Couldn't find package "some-local-package" on the "npm" registry.
info Visit https://yarnpkg.com/en/docs/cli/upgrade for documentation about this command.

If the current behavior is a bug, please provide the steps to reproduce.

  • Add a local git repo to your package.json, tracked by #master
  • yarn install and note the git hash installed
  • Add a new commit to the package and push that to the shared git repo
  • Run yarn upgrade some-local-package
  • See that yarn tries to look the package up on NPM, when it should instead look at the local git repo

What is the expected behavior?
yarn upgrade some-local-package should install the latest commit and update yarn.lock to have the the sha1 of that latest commit

Please mention your node.js, yarn and operating system version.
Node 6.3.1, yarn 0.16.1, OSX 10.11.5

cat-bug

Most helpful comment

@bwhitty It's not fixed @ v0.21.3. I'm having the same bug when upgrading a package from github.

// package.json
"dependencies": {
  "package-name": "github:username/package-name",
}
$ yarn upgrade package-name

yarn upgrade v0.21.3
[1/4] 馃攳  Resolving packages...
error Couldn't find package "package-name" on the "npm" registry.
info Visit https://yarnpkg.com/en/docs/cli/upgrade for documentation about this command.

It works fine when upgrading all packages.

npm up package-name works as expected.

All 6 comments

This may be the same as #1413. Could you test on yarn 0.15.1?

@STRML 0.15.1 does not have yarn upgrade [package], it only has yarn upgrade (all packages). The ability to upgrade a single package was fixed in 0.16.1.

I see. Does yarn upgrade without a package name throw the same error for you?

@STRML no, it upgrades that package (but also all packages) just fine. Our use case is to only upgrade a single package, though. Thanks for digging into this a bit more!

This is more than likely a dupe of https://github.com/yarnpkg/yarn/issues/573 and if so it's possible will be fixed by https://github.com/yarnpkg/yarn/pull/1816

@bwhitty It's not fixed @ v0.21.3. I'm having the same bug when upgrading a package from github.

// package.json
"dependencies": {
  "package-name": "github:username/package-name",
}
$ yarn upgrade package-name

yarn upgrade v0.21.3
[1/4] 馃攳  Resolving packages...
error Couldn't find package "package-name" on the "npm" registry.
info Visit https://yarnpkg.com/en/docs/cli/upgrade for documentation about this command.

It works fine when upgrading all packages.

npm up package-name works as expected.

Was this page helpful?
0 / 5 - 0 ratings