Skip to content

yarn installs unpublished npm packages #3274

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

Closed
jharris4 opened this issue Apr 28, 2017 · 10 comments
Closed

yarn installs unpublished npm packages #3274

jharris4 opened this issue Apr 28, 2017 · 10 comments

Comments

@jharris4
Copy link

jharris4 commented Apr 28, 2017

Do you want to request a feature or report a bug?
Bug

What is the current behavior?
Yarn installs packages that were unpublished on npm.

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

I use the node-sass package in one of my projects, and it has a dependency on a package called sass-graph (version ^2.1.1).

The author of sass-graph published version 2.2.0 on npm, but it broke a bunch of things, so he unpublished the package.

Now, if I open an empty repo, and do yarn add sass-graph it correctly goes and gets the latest published package (2.1.2).

But if I then do yarn add node-sass, yarn incorrectly retrieves the unpublished sass-graph version 2.2.0, which is incorrect.

Looking at my yarn.lock files, I see the following when I add the node-sass package:

node-sass@^4.5.2:
  version "4.5.2"
  resolved "https://registry.yarnpkg.com/node-sass/-/node-sass-4.5.2.tgz#4012fa2bd129b1d6365117e88d9da0500d99da64"
  dependencies:
    async-foreach "^0.1.3"
    chalk "^1.1.1"
    cross-spawn "^3.0.0"
    gaze "^1.0.0"
    get-stdin "^4.0.1"
    glob "^7.0.3"
    in-publish "^2.0.0"
    lodash.assign "^4.2.0"
    lodash.clonedeep "^4.3.2"
    lodash.mergewith "^4.6.0"
    meow "^3.7.0"
    mkdirp "^0.5.1"
    nan "^2.3.2"
    node-gyp "^3.3.1"
    npmlog "^4.0.0"
    request "^2.79.0"
    sass-graph "^2.1.1"
    stdout-stream "^1.4.0"

sass-graph@^2.1.1:
  version "2.2.0"
  resolved "https://registry.yarnpkg.com/sass-graph/-/sass-graph-2.2.0.tgz#d59b85d27cab14eacd9946420c6aec617b8da42e"
  dependencies:
    glob "^7.0.0"
    lodash "^4.0.0"
    scss-tokenizer "^0.1.2"
    yargs "^6.6.0"

But when I just add sass-graph by itself, I see:

sass-graph@^2.1.2:
  version "2.1.2"
  resolved "https://registry.yarnpkg.com/sass-graph/-/sass-graph-2.1.2.tgz#965104be23e8103cb7e5f710df65935b317da57b"
  dependencies:
    glob "^7.0.0"
    lodash "^4.0.0"
    yargs "^4.7.1"

I have tried clearing my yarn cache (yarn cache clean) but this didn't help resolve the issue.

Also, running npm install --save node-sass correctly installs sass-graph version 2.1.2, so this bug seems to be specific to yarn, and not npm.

What is the expected behavior?

Unpublished npm packages should not be installed.

Please mention your node.js, yarn and operating system version.
Node 7.9.0
Yarn 0.23.2
MacOS 10.12.4

@jharris4 jharris4 changed the title yarn still installs unpublishe npm packages yarn still installs unpublished npm packages Apr 28, 2017
@jharris4 jharris4 changed the title yarn still installs unpublished npm packages yarn installs unpublished npm packages Apr 28, 2017
@bestander
Copy link
Member

npm does not remove packages from npm if they are unpublished, they are still available for download.
Anyone has a reliable repro step?

@xzyfer
Copy link

xzyfer commented May 23, 2017 via email

@bestander
Copy link
Member

Yes, CDN can have a delay

@jharris4
Copy link
Author

Thanks for looking into this issue. The issue persisted for at least 24 hours until the author published a newer version of the sass-graph package, which resolved the problem since yarn then picked up the newer version.

The problem seems to be specific to when yarn installs packages as sub-dependencies vs top-level dependencies. Installing the package directly worked fine, so I doubt it was as simple as a caching issue.

@bestander
Copy link
Member

bestander commented May 23, 2017 via email

@xzyfer
Copy link

xzyfer commented May 23, 2017 via email

@bestander
Copy link
Member

If anyone has some knowledge of how node-sass is installed and wants to help Yarn team to debug the issues with it, that would be awesome!

@xzyfer
Copy link

xzyfer commented May 24, 2017 via email

@bestander
Copy link
Member

That is awesome, @xzyfer, I've linked you in another issue.
Could you help out with the repro step?

@BYK
Copy link
Member

BYK commented Oct 26, 2017

Closing due to inactivity.

@BYK BYK closed this as completed Oct 26, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants