linaria
linaria copied to clipboard
React 17 not in peerDeps (breaks npm v7)
Environment
react>=17
- Linaria version: @linaria/[email protected]
- Bundler (+ version): webpack 5
- Node.js version: v14.13.1
- OS: Ubuntu
- npm: 7.7.5
Description
Warnings in most package installers, npm 7 will outright fail due to this problem. Cannot use with React 17.
npm ERR! Found: [email protected]
npm ERR! node_modules/react
npm ERR! dev react@"latest" from the root project
npm ERR! peer react@">=16" from @linaria/[email protected]
npm ERR! node_modules/@linaria/react
npm ERR! dev @linaria/react@"^3.0.0-beta.1" from the root project
npm ERR! 22 more (@rest-hooks/test, @rest-hooks/core, rest-hooks, ...)
linaria
specifies react >=16
:
https://github.com/callstack/linaria/blob/4ee73ae362ca775999bf71c93279db5268108d13/packages/react/package.json#L51
Maybe it's coming from another dependency ?
Specific to npm
, you may be able to bypass the problem with --legacy-peer-deps
, which I've had to use on multiple occasions in the past year or so.
This isn't blocking me from installing (I used the --legacy-peer-deps
as suggested) but I'm worried about others and the friction it creates.
PS) Updated report with the output of command....I think the new npm has some weird no logic for matching
Trying package.json entry from latest to actual version and get same thing:
npm ERR! Found: [email protected]
npm ERR! node_modules/react
npm ERR! dev react@"^17.0.2" from the root project
npm ERR! peer react@">=16" from @linaria/[email protected]
npm ERR! node_modules/@linaria/react
npm ERR! dev @linaria/react@"^3.0.0-beta.1" from the root project
npm ERR! 22 more (@rest-hooks/test, @rest-hooks/core, rest-hooks, ...)
I believe they expect explicit versions listed with || now. "NPM modules must name specific versions of their peerDependencies"
More here: https://blog.npmjs.org/post/626173315965468672/npm-v7-series-beta-release-and-semver-major
Hi @ntucker!
Could you please provide a repo? I've tried to reproduce the error but everything seems ok:
➜ linaria-743 cat package.json | grep "react"
"@linaria/react": "^3.0.0-beta.1",
"react": "latest"
➜ linaria-743 npm install
added 8 packages, and audited 9 packages in 2s
found 0 vulnerabilities
https://semver.npmjs.com says that there is no difference between >=16
and >=16 || >=17
.
Similar issue, I can't install when preact
is present in the project npm:@preact/compat
, had to use --legacy-peer-deps
. Using npm v7.
npm ERR! While resolving: [email protected]
npm ERR! Found: [email protected]
npm ERR! node_modules/react
npm ERR! react@"npm:@preact/[email protected]" from the root project
npm ERR!
npm ERR! Could not resolve dependency:
npm ERR! peer react@">=16" from @linaria/[email protected]
npm ERR! node_modules/@linaria/react
npm ERR! @linaria/react@"^3.0.0-beta.4" from the root project
Hi @ntucker!
Could you please provide a repo? I've tried to reproduce the error but everything seems ok:
➜ linaria-743 cat package.json | grep "react" "@linaria/react": "^3.0.0-beta.1", "react": "latest" ➜ linaria-743 npm install added 8 packages, and audited 9 packages in 2s found 0 vulnerabilities
https://semver.npmjs.com says that there is no difference between
>=16
and>=16 || >=17
.
The key is using npm 7 - not something normally enforceable in a repo.
The key is using npm 7 - not something normally enforceable in a repo.
➜ npm --version
7.7.5
¯\_(ツ)_/¯
Probably, there is another factor. That's why I asked for a repo.
> npm -v
8.19.4
> npm install react@17
added 4 packages, and audited 5 packages in 858m
> npm install @linaria/react
added 80 packages, and audited 85 packages in 14s
No errors or warnings related to peerDependencies
.