-
Notifications
You must be signed in to change notification settings - Fork 2.7k
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 install --production
doesn't install correct dependencies
#761
Comments
@Daniel15 I guess this is because of nodemon is having latest version of minimatch. The linker function currently takes in both deps and dev deps into it. For argument production, this should be prevented. Even on normal yarn install with out production argument. Only latest version is installed in the actual path. This has to checked too. |
I'm getting a similar problem when running
and if I recall correctly, previous attempts showed similar errors with another package (not only |
I'm getting very similar as well...
|
Can reproduce a similar issue with:
This will install
It seems to "forget" the EDIT: Smaller example:
Also confirmed that removing |
My software team ran into this issue, specifically with the package |
FWIW: I can work around the issue by deleting |
as @gihrig said running |
Yarn's main advantage over npm is a deterministic My current workaround is to just install |
@tanx |
This is precisely the "works on my machine" mentality described in the Yarn blog post. The problem is you're letting npm change the state of |
Hopefully the workarounds discussed will be rendered moot soon by an yarn update to respect dev vs production deps. In the meantime, indeed there is much to groan about with the "npm prune" post-processing hack. |
The |
Tried to find a nice way of doing this without adding an additional pass to propagate the visibility after the graph was walked once. Not sure if it would be acceptable to just split out the visibility into a separate step..? |
There's some interesting edge cases as well, it's not just about properly resolving visibility:
In that case the optional flag of C depends on dev vs. prod. In dev it would be non-optional, in prod it would be optional. Just inheriting the optional flag from one of the parents (or always inheriting it from the prod parent) could lead to weirdness. |
This is still not fixed in 0.17.2 😢 Repro: https://gist.github.com/SimenB/2b179f3b6bca73ba824e1273ea38aed3 yarn
node index.js # works
yarn --prod
node index.js # explodes /cc @jkrems |
Doesn't seem fixed for me either in 0.17.2 (HearthSim/Joust#169). |
It is related. Probably the same cause. Just a different symptom. I would put that as a different issue since it's not exactly the same as what the title says. |
@SimenB, thanks, I'll have a look |
Ok will do guys. |
@bestander Making a package wth just those 3 in the output that fails makes it reproducible on master for me with just public deps. It's not a minimal reproduce, but still {
"name": "app",
"version": "1.0.0",
"dependencies": {
"brakes": "^2.5.1",
"compression": "^1.6.2",
"envalid": "^2.4.0",
"express": "^4.14.0",
"object.entries": "^1.0.4",
"prom-client": "^7.0.0",
"response-time": "^2.3.2",
"spaden": "^7.13.1",
"yarn-issue-repro-package": "^1.0.0"
},
"devDependencies": {
"babel-preset-es2015": "^6.18.0",
"browserify": "^13.1.1",
"browserify-middleware": "^7.1.0",
"cheerio": "^0.22.0",
"codeceptjs": "^0.4.13",
"del-cli": "^0.2.1",
"eslint": "^3.12.2",
"eslint-config-finn": "^1.0.1",
"espower-loader": "^1.0.1",
"hashmark": "^4.1.0",
"interfake": "^1.19.0",
"mocha": "^3.2.0",
"nightmare": "^2.9.0",
"nightmare-upload": "^0.1.1",
"nock": "^9.0.2",
"nodemon": "^1.11.0",
"nyc": "^10.0.0",
"power-assert": "^1.4.1",
"sinon": "^1.17.6",
"supertest": "^2.0.1",
"uglify-js": "^2.7.5",
"uglifyify": "^3.0.4"
}
}
{
"name": "yarn-issue-repro-package",
"version": "1.0.0",
"main": "index.js",
"license": "MIT",
"dependencies": {
"nunjucks": "^2.5.2",
"pretty-error": "^2.0.2",
"unleash-client": "^1.0.0-beta.7"
}
} Interestingly, it produces 4 errors instead of 3... $ yarn check v0.20.0-0 │├─ strip-ansi@3.0.1
error "yarn-issue-repro-package#nunjucks#chokidar#anymatch" not installed │└─ utila@0.4.0
error "yarn-issue-repro-package#unleash-client#request#json-stringify-safe" not installed │✨ Done in 2.65s.
error "yarn-issue-repro-package#nunjucks#yargs#string-width#code-point-at" not installed │ ~/repos/yarn-issue-repro-package vim package.json
error "yarn-issue-repro-package#pretty-error#renderkid#css-select#domutils#dom-serializer#entities" not installed │ ~/repos/yarn-issue-repro-package npm publish
error Found 4 errors. |
I'm not sure is this the same issue or not, but here is the output (tested with 0.19.1) |
I think I have found the root cause for the installation issue.
And then the commands
In this configuration,
When deduping
Because both records are ignored at the time, the ignore function isn't adjusted as it was supposed to - because And indeed, the installation problem goes away when we replace those lines with
|
@blexrob, great find! |
@bestander, just tested it, and this fix causes a stack overflow in the test you mentioned, so it can't be applied. The following cycle pops up:
So, the naive recursive call approach is out... |
Yeah, I believe it needs a bit tweaking but the idea seems correct |
…2468, yarnpkg#2263 (yarnpkg#2537) * Explicitly mark ignored deps of non-ignored packages as non-ignored (yarnpkg#761, yarnpkg#2468, yarnpkg#2263) * Fix style nits
I have such a problem with |
I regret to say that this still seems to be a problem in Yarn 1.3.2. |
@adamreisnz, this thread is too big to track all issues. |
@bestander done, thanks. |
For someone who still can't get it work and doesn't want to install jq can use
|
i am on yarn |
I can confirm it too. Yarn version: 1.22.0
@hannadrehman is the project in question a package of your monorepo? |
Same problem as @TAnas0 |
define the following yarn script
run after building your app when you no longer need build dependencies
|
When running
yarn install --production
it does not install the required dependencies offorever
. This seem to be related to havingnodemon
indevDependencies
.Error response:
I've created a test application here:
https://github.com/donovan-graham/yarn-example-app
The text was updated successfully, but these errors were encountered: