yarn install forgets some peer dependencies

Created on 16 Oct 2016  路  9Comments  路  Source: yarnpkg/yarn

Do you want to request a _feature_ or report a _bug_?
Bug: Some dependencies might not be installed when running yarn install.

What is the current behavior?
It loads every package from package.json but seems to not load all peer dependencies. After an install via yarn, when trying a gulp build, the following error yields:

module.js:471
    throw err;
    ^

Error: Cannot find module 'imagemin-gifsicle'

I can fix it by running npm i and everything gets loaded. I already tried deleting the lockfile and letting it recreate. Same error happens.

If the current behavior is a bug, please provide the steps to reproduce.
Run yarn install with the following devDependencies

    "del": "^2.2.2",
    "gulp": "^3.9.1",
    "gulp-autoprefixer": "^3.1.1",
    "gulp-clean-css": "^2.0.13",
    "gulp-concat": "^2.6.0",
    "gulp-connect": "^5.0.0",
    "gulp-imagemin": "^3.0.3",
    "gulp-sass": "^2.3.2",
    "gulp-sourcemaps": "^1.6.0",
    "gulp-uglify": "^2.0.0",
    "run-sequence": "^1.2.2",
    "vue": "^2.0.3",
    "vue-resource": "^1.0.3"

and try to build it via gulp. The respective gulpfile.js can be found here, the full package.json here.

What is the expected behavior?
yarn installs every needed depenency.

Please mention your node.js, yarn and operating system version.
node v6.8.0, yarn 0.15.1, Windows 10 x64 and macOS 10.12

gif

Most helpful comment

All 9 comments

I think this should be filed at gulp-imagemin, as it lists imagemin-gifsicle under optionalDependencies. (See here)

As explained by npm, the package then is responsible by its own to catch the failed installation.

As you can see here optionalDependencies seem to be covered by yarn.

I have the same issue, and is pretty clear why they (gulp-imagemin) use optional dependencies #224 comment

Can we install optional dependencies through yarn?

Actually sindresorhus acknowledges there, that it's a problem with his lib and gives hints in how to implement. According to https://github.com/sindresorhus/gulp-imagemin/issues/221 it's happening as well when using npm.

The PR for gulp-imagemin shouldn't be too hard.

I have the same issue, any quick fix?

@hustcer I ended up pulling @zcei's PR for gulp-imagemin and then using yarn link to use that instead of grabbing it from sindresorhus's repo.

I couldn't figure out the correct syntax to pull it from the package.json, I thought it would be something like:

"dependencies" : {
  "gulp-imagemin" : "git://github.com/zcei/gulp-imagemin.git#a5466b4af5a0296cd9b3aeac29588e7bb1e587ee"
}

But that doesn't seem to want to work.

"gulp-imagemin": "zcei/gulp-imagemin#a5466b4af5a0296cd9b3aeac29588e7bb1e587ee"

That should do the trick.

@joemidi @rbnlffl Thanks all. The issue seems to be disappeared after I upgrade to yarn v0.16. I'm not quite sure, though.

Huh, you're right. Updating to 0.16.1 fixed it for me as well. Nice!

Was this page helpful?
0 / 5 - 0 ratings