Some NPM packages published in multiple projects are inaccessible
Summary
If a package with the same name (but different versions) are published in two different projects, only packages within one of those projects will be available to download.
Initially reported by a Gold Customer within: https://gitlab.zendesk.com/agent/tickets/178237 (internal use)
Steps to reproduce
-
Create two projects within the same group
-
Publish a package with the same name, but different versions to each group (e.g.
@foo/test-pack
) -
Configure your
.npmrc
accordingly, and attempt to install a package from each project. The packages uploaded to the second project will not be fetch-able.
Example Project
Here's an example group, wherein projects npm_a
and npm_b
each house packages with the same name, but different versions.
For example, packages @gitlab-gold/clw-testpack@1.0.1
and @gitlab-gold/clw-testpack@1.0.0
from project npm_a
can be installed without issue, but attempting to install any packages from npm_b
fail with the errors logged below.
What is the current bug behavior?
Some packages using the same name that are published in multiple projects ( with differing versions) cannot be installed via NPM. Attempting to install packages from the secondary project results in a "No matching version failure".
What is the expected correct behavior?
Packages with the same name across multiple projects can be installed without issue.
Relevant logs and/or screenshots
Output from a failed npm install
command with verbose logging enabled:
npm install --verbose @gitlab-gold/clw-testpack@1.1.0
npm info it worked if it ends with ok
npm verb cli [
npm verb cli '/usr/local/bin/node',
npm verb cli '/usr/local/bin/npm',
npm verb cli 'install',
npm verb cli '--verbose',
npm verb cli '@gitlab-gold/clw-testpack@1.1.0'
npm verb cli ]
npm info using npm@6.14.8
npm info using node@v14.14.0
npm verb npm-session 305dcad50dd15fb5
npm http fetch GET 304 https://gitlab.com/api/v4/packages/npm/@gitlab-gold%2fclw-testpack 363ms (from cache)
npm http fetch GET 304 https://gitlab.com/api/v4/packages/npm/@gitlab-gold%2fclw-testpack 182ms (from cache)
npm timing stage:rollbackFailedOptional Completed in 2ms
npm timing stage:runTopLevelLifecycles Completed in 585ms
npm verb type version
npm verb stack @gitlab-gold/clw-testpack: No matching version found for @gitlab-gold/clw-testpack@1.1.0.
npm verb stack at pickManifest (/usr/local/lib/node_modules/npm/node_modules/npm-pick-manifest/index.js:122:13)
npm verb stack at /usr/local/lib/node_modules/npm/node_modules/pacote/lib/fetchers/registry/manifest.js:43:18
npm verb stack at tryCatcher (/usr/local/lib/node_modules/npm/node_modules/bluebird/js/release/util.js:16:23)
npm verb stack at Promise._settlePromiseFromHandler (/usr/local/lib/node_modules/npm/node_modules/bluebird/js/release/promise.js:517:31)
npm verb stack at Promise._settlePromise (/usr/local/lib/node_modules/npm/node_modules/bluebird/js/release/promise.js:574:18)
npm verb stack at Promise._settlePromise0 (/usr/local/lib/node_modules/npm/node_modules/bluebird/js/release/promise.js:619:10)
npm verb stack at Promise._settlePromises (/usr/local/lib/node_modules/npm/node_modules/bluebird/js/release/promise.js:699:18)
npm verb stack at _drainQueueStep (/usr/local/lib/node_modules/npm/node_modules/bluebird/js/release/async.js:138:12)
npm verb stack at _drainQueue (/usr/local/lib/node_modules/npm/node_modules/bluebird/js/release/async.js:131:9)
npm verb stack at Async._drainQueues (/usr/local/lib/node_modules/npm/node_modules/bluebird/js/release/async.js:147:5)
npm verb stack at Immediate.Async.drainQueues [as _onImmediate] (/usr/local/lib/node_modules/npm/node_modules/bluebird/js/release/async.js:17:14)
npm verb stack at processImmediate (internal/timers.js:461:21)
npm verb cwd /
npm verb Linux 4.15.0-1097-oem
npm verb argv "/usr/local/bin/node" "/usr/local/bin/npm" "install" "--verbose" "@gitlab-gold/clw-testpack@1.1.0"
npm verb node v14.14.0
npm verb npm v6.14.8
npm ERR! code ETARGET
npm ERR! notarget No matching version found for @gitlab-gold/clw-testpack@1.1.0.
npm ERR! notarget In most cases you or one of your dependencies are requesting
npm ERR! notarget a package version that doesn't exist.
npm verb exit [ 1, true ]
npm timing npm Completed in 818ms
npm ERR! A complete log of this run can be found in:
npm ERR! /root/.npm/_logs/2020-10-28T17_26_30_776Z-debug.log
Output of checks
This bug happens on GitLab.com