yarnpkg / yarn

The 1.x line is frozen - features and bugfixes now happen on https://github.com/yarnpkg/berry
https://classic.yarnpkg.com
Other
41.45k stars 2.73k forks source link

git+ssh module installation fails to detect available versions in sub-dependencies #1358

Open pospi opened 8 years ago

pospi commented 8 years ago

This may be related #513 but is a more specific issue. I've managed to resolve most of the git-uri installation problems by using the form git+ssh://git@bitbucket.org/everledger/koa-middleware.git#1.1.0, and that works great in Yarn 0.16.

However- it only seems to work if the dependency is being loaded by the toplevel module you're running yarn in. I have the following dependency hierarchy:

@everledger/koa-static-server
 │
 └── @everledger/koa-base-server
      │
      └── @everledger/koa-middleware

When running yarn from koa-base-server, I get:

yarn install v0.16.1
[1/4] Resolving packages...
[2/4] Fetching packages...
[3/4] Linking dependencies...
[4/4] Building fresh packages...
success Saved lockfile.
Done in 11.58s.

But when running in koa-static-server, the output is:

yarn install v0.16.1
info No lockfile found.
[1/4] Resolving packages...
error Couldn't find any versions for @everledger/koa-middleware that matches git@bitbucket.org:everledger/koa-middleware.git#1.1.0. Possible versions: 1.0.0
info Visit https://yarnpkg.com/en/docs/cli/install for documentation about this command.

It seems like the dependency specified in koa-base-server (git+ssh://git@bitbucket.org/everledger/koa-middleware.git#1.1.0) is being coerced into an SSH form (git@bitbucket.org:everledger/koa-middleware.git#1.1.0) as the installer walks down the dependency graph.

pospi commented 8 years ago

Actually, things might be more complex than that. Different module hierarchy, similar issue:

@everledger/express-base-server
 │
 └── @everledger/express-middleware
      │
      └── @everledger/logger

From express-middleware:

yarn install v0.16.1
[1/4] Resolving packages...
[2/4] Fetching packages...
[3/4] Linking dependencies...
[4/4] Building fresh packages...
success Saved lockfile.
Done in 11.62s.

From express-base-server:

yarn install v0.16.1
[1/4] Resolving packages...
error An unexpected error occured, please open a bug report with the information provided in "/home/pospi/projects/everledger/express-base-server/yarn-error.log".
info Visit https://yarnpkg.com/en/docs/cli/install for documentation about this command.

The relevant line from the error log says Error: https://registry.npmjs.org/@everledger%2flogger: Not found. In this case it appears that the sub-dependency URI is being ignored and Yarn is using the package name to resolve the module instead of the git URI- the dependency is specified as "@everledger/logger": "git+ssh://git@bitbucket.org/everledger/logger.git#1.0.0".

pospi commented 8 years ago

It does seem that the second error is the real underlying symptom- I still have @everledger/koa-middleware published privately to the NPM registry as I was unable to delete it, but only v1.0.0.