MoOx / postcss-cssnext

`postcss-cssnext` has been deprecated in favor of `postcss-preset-env`.
https://moox.io/blog/deprecating-cssnext/
MIT License
5.3k stars 189 forks source link

unmet peer dependency #438

Closed niftylettuce closed 6 years ago

niftylettuce commented 6 years ago

shouldn't this be listed as a dependency instead in package.json?

warning " > postcss-cssnext@3.0.2" has unmet peer dependency "caniuse-lite@^1.0.30000697".
niftylettuce commented 6 years ago

can we please make this a version range instead? https://github.com/MoOx/postcss-cssnext/blob/master/package.json#L57

if not, please put it as a dep in package.json

RyanZim commented 6 years ago

@niftylettuce With a ^, it is a version range.

Also, You should be able to get rid of that warning by deleting node_modules and reinstalling. It's already included as a child dependency of autoprefixer IIRC.

niftylettuce commented 6 years ago

it seems odd to not have other deps such as postcss included in peer deps. can we please just drop peer deps completely?

MoOx commented 6 years ago

postcss plugins actually require postcss as a dep to be able to register their plugins. Everything is fine here. The thing is: we rely on a package (caniuse-api) that can work with any caniuse-lite, but we need a specific version to be sure cssnext is working as expected.

niftylettuce commented 6 years ago

Can we please put this in as a core dependency? I'd hate to keep a separate repo maintained because otherwise end-users (using build systems like gulp or grunt) will always get this warning.

I did the classic rm -rf node_modules && rm yarn.lock && yarn and the warning still came up. The only way it went away was using my fork of this repo that has it listed as a dep and not a peer dep. I think this occurs for anyone using a build system like gulp/grunt.

Can anyone else here test and see if they can reproduce? If it's just on my end then of course we can ignore this all completely haha.

MoOx commented 6 years ago

This change has been made 6 months ago and we only got one or 2 people opening issues fixed with an uninstall + install, so I guess everything is fine in this code. I won't make add caniuse-lite as a dep as it's not a dep, rather a recommendation for our plugin to work correctly with another given dep.

niftylettuce commented 6 years ago

I just tested on a new fresh repo and can't reproduce it anymore. You're right @MoOx this is just a weird edge case. Probably from working with local npm symlinks! Thanks for patience and helping me out here.

niftylettuce commented 6 years ago

Actually I spoke too soon! This is in fact an issue. I tested the wrong plugin, not this one.

@RyanZim @MoOx here is how to reproduce (I made a test repo for you at https://github.com/niftylettuce/postcss-cssnext-test):

git clone https://github.com/niftylettuce/postcss-cssnext-test.git
cd postcss-cssnext-test
yarn
# or you could do `npm install` if you're not using yarn

Example output of running yarn or npm install

λ ~/Projects/postcss-css-next-test/ master* yarn
yarn install v1.3.2
info No lockfile found.
[1/4] 🔍  Resolving packages...
warning gulp > gulp-util@3.0.8: gulp-util is deprecated - replace it, following the guidelines at https://medium.com/gulpjs/gulp-util-ca3b1f9f9ac5
warning gulp > vinyl-fs > graceful-fs@3.0.11: please upgrade to graceful-fs 4 for compatibility with current and future versions of Node.js
warning gulp > vinyl-fs > glob-stream > minimatch@2.0.10: Please update to minimatch 3.0.2 or higher to avoid a RegExp DoS issue
warning gulp > vinyl-fs > glob-watcher > gaze > globule > minimatch@0.2.14: Please update to minimatch 3.0.2 or higher to avoid a RegExp DoS issue
warning gulp > vinyl-fs > glob-watcher > gaze > globule > glob > graceful-fs@1.2.3: please upgrade to graceful-fs 4 for compatibility with current and future versions of Node.js
[2/4] 🚚  Fetching packages...
[3/4] 🔗  Linking dependencies...
warning " > postcss-cssnext@3.0.2" has unmet peer dependency "caniuse-lite@^1.0.30000697".
[4/4] 📃  Building fresh packages...
success Saved lockfile.
✨  Done in 7.75s.

You can see the unmet dependency warning.

Can you please re-open?

MoOx commented 6 years ago

What version of node/yarn are you using? Yarn got a tons of issues with peer deps in the past. Please try with npm.

niftylettuce commented 6 years ago
yarn --version
1.3.2
npm --version
5.6.0
niftylettuce commented 6 years ago

Oh, I don't get this warning on npm install. Though shouldn't we consider that an extremely large percentage of users are using yarn? I just looked around the community and pretty much all the other plugins for postcss aren't using peerdeps.

niftylettuce commented 6 years ago

Thanks again for patience + help here 👍

MoOx commented 6 years ago

The problem I see is more here imo https://github.com/yarnpkg/yarn/issues?utf8=✓&q=is%3Aissue+is%3Aopen+Unmet+peer+dependency

ghost commented 6 years ago

documenting. this looks to still be:

https://github.com/yarnpkg/yarn/issues/4850

with

yarn --version
    1.5.1
yarn info postcss-cssnext | grep version:
    version: '3.1.0',

On any yarn exec

...
warning " > postcss-cssnext@3.1.0" has unmet peer dependency "caniuse-lite@^1.0.30000697".
...

hails from

yarn info postcss-cssnext | grep caniuse-lite -A1 -B1
    peerDependencies:
     { 'caniuse-lite': '^1.0.30000697' },
    devDependencies:

here

yarn info caniuse-lite | grep version:
    version: '1.0.30000813',

yarn info caniuse-lite
    yarn info v1.5.1
    { name: 'caniuse-lite',
      description: 'A smaller version of caniuse-db, with only the essentials!',
      'dist-tags': 
       { latest: '1.0.30000813' },
ghost commented 6 years ago

Same issue.

$ rm -rf node_modules && rm yarn.lock && yarn
yarn install v1.5.1
info No lockfile found.
[1/4] 🔍  Resolving packages...
[2/4] 🚚  Fetching packages...
[3/4] 🔗  Linking dependencies...
warning " > postcss-cssnext@3.1.0" has unmet peer dependency "caniuse-lite@^1.0.30000697".
[4/4] 📃  Building fresh packages...
success Saved lockfile.
✨  Done in 22.26s.
OzzyCzech commented 6 years ago

Same here... yarn v1.5.1 and node v9.8.0

rm -rf node_modules && rm yarn.lock && yarn

produce following warning

warning " > postcss-cssnext@3.1.0" has unmet peer dependency "caniuse-lite@^1.0.30000697".

megganeturner commented 6 years ago

Also getting the same warning. yarn 1.5.1 and node 8.10.1.

rm -rf node_modules && rm yarn.lock && yarn

produces

warning " > postcss-cssnext@3.1.0" has unmet peer dependency "caniuse-lite@^1.0.30000697".

Mayurifag commented 6 years ago

+1 here

RyanZim commented 6 years ago

postcss-cssnext has been deprecated in favor of postcss-preset-env. Read more at https://moox.io/blog/deprecating-cssnext/