Skip to content
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

yarn list shows devDependencies on a production install. #3788

Closed
pixelpax opened this issue Jul 1, 2017 · 6 comments
Closed

yarn list shows devDependencies on a production install. #3788

pixelpax opened this issue Jul 1, 2017 · 6 comments

Comments

@pixelpax
Copy link

pixelpax commented Jul 1, 2017

I boot a production version of my container with a Dockerfile that includes commands

Do you want to request a feature or report a bug?
I believe this is a bug as I receive misleading information.

What is the current behavior?
I have a container built from an image with the following in its Dockerfile

ENV NODE_ENV=production
COPY package.json .
RUN yarn install --quiet

I am expecting it to be building in production and ignoring devDependencies. It does so, and I can confirm this with ls node_modules however, when I do yarn ls I see devDependencies listed alongside.

If the current behavior is a bug, please provide the steps to reproduce.
In your package.json:

  "dependencies": {
    "express": "^4.15.3"
  },
  "devDependencies": {
    "nodemon": "^1.11.0"
  }

then do
NODE_ENV=production; yarn; yarn list | grep nodemon;
and note that nodemon is present in list, but not present in node_modules
What is the expected behavior?
In this way, yarn is showing me a list of packages which I don't actually have stored on my machine. Perhaps this is intentional because I also see a list of packages before executing yarn to install my package.json. I would expect to look in my package.json if I wanted to see what packages should be installed and to use yarn list to see what packages are actually installed. This is also what I'm used to with npm.

Please mention your node.js, yarn and operating system version.
Using yarn v0.24.6 within a docker container (from node:6.11 official)

@gowthamgts
Copy link

gowthamgts commented Jul 8, 2017

@pixelpax Thanks for reporting this, I'm able to reproduce this in my local environment. Happy to work on this. @bestander a little help on this?

@bestander
Copy link
Member

@gowthamgts, that is great.
Go ahead, the list command source is here https://github.com/yarnpkg/yarn/blob/master/src/cli/commands/list.js

@reznord
Copy link

reznord commented Jul 24, 2017

Is this still open for a commit? If so, I'd like to take this and push a PR for this issue.

@gowthamgts
Copy link

Yes @reznord, I'm caught up with work, so would be great if you take this up.

@olingern
Copy link
Contributor

olingern commented Aug 4, 2017

Jumped in on this one, hope that's okay @reznord

@reznord
Copy link

reznord commented Aug 4, 2017

It's fine :)

@BYK BYK closed this as completed in #4092 Aug 18, 2017
BYK pushed a commit that referenced this issue Aug 18, 2017
…uction (#4092)

**Summary**

Fixes: #3788.

This PR loads `devDependencies` from the manifest, re-builds the patterns package structure, and filters packages if the `NODE_ENV` is production.

**Test plan**

Added new tests.
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

5 participants