Missing `@babel/cli`, `@babel/core`, `@babel/runtime`, `next` dependencies
rtritto opened this issue · comments
Summary
After I install next-plugin-preact
with yarn
(berry version), I get dependency not found warnings in yarn log.
Respectively peerDeependencies:
next
andwebpack
are of@prefresh/next
react
andreact-dom
are ofnext
@prefresh/babel-plugin
andwebpack
are of@prefresh/webpack
They should be added in package.json
Versions
next-plugin-preact
: 3.0.6
Steps Reproduce
yarn init -y
yarn set version berry
yarn add preact preact-render-to-string preact-ssr-prepass next-plugin-preact
- See yarn log
Results
Actual
yarn log:
➤ YN0000: ┌ Resolution step
➤ YN0002: │ next-plugin-preact@npm:3.0.6 [99790] doesn't provide @prefresh/babel-plugin (p48563), requested by @prefresh/webpack
➤ YN0002: │ next-plugin-preact@npm:3.0.6 [99790] doesn't provide next (p7b6b4), requested by @prefresh/next
➤ YN0002: │ next-plugin-preact@npm:3.0.6 [99790] doesn't provide webpack (p67555), requested by @prefresh/next
➤ YN0002: │ next-plugin-preact@npm:3.0.6 [99790] doesn't provide webpack (p99d5e), requested by @prefresh/webpack
➤ YN0000: │ Some peer dependencies are incorrectly met; run yarn explain peer-requirements <hash> for details, where <hash> is the six-letter p-prefixed code
➤ YN0000: └ Completed
➤ YN0000: ┌ Fetch step
➤ YN0013: │ next-plugin-preact@npm:3.0.6 can't be found in the cache and will be fetched from the remote registry
➤ YN0013: │ preact-render-to-string@npm:5.1.19 can't be found in the cache and will be fetched from the remote registry
➤ YN0013: │ preact-ssr-prepass@npm:1.2.0 can't be found in the cache and will be fetched from the remote registry
➤ YN0013: │ preact@npm:10.5.14 can't be found in the cache and will be fetched from the remote registry
➤ YN0013: │ pretty-format@npm:3.8.0 can't be found in the cache and will be fetched from the remote registry
➤ YN0000: └ Completed
➤ YN0000: ┌ Link step
➤ YN0007: │ next-plugin-preact@npm:3.0.6 [99790] must be built because it never has been before or the last one failed
➤ YN0000: └ Completed
➤ YN0000: Done with warnings
Expect
No warning in yarn log.
Workaround
Add in .yarnrc.yml
:
packageExtensions:
"@prefresh/next@*":
dependencies:
next: "*"
react: "*"
react-dom: "*"
webpack: "*"
"@prefresh/webpack@*":
dependencies:
"@prefresh/babel-plugin": "*"
webpack: "*"
...
Most of these seem to be because you did not copy the full install command. Yes, if you strip out next
, you're going to get warnings. Same goes for the aliased react
& react-dom
.
Any reason why you're using
yarn add preact preact-render-to-string preact-ssr-prepass next-plugin-preact
instead of the install command that's listed in the ReadMe? Please use the one provided and try again.
yarn add next next-plugin-preact preact react@npm:@preact/compat react-dom@npm:@preact/compat react-ssr-prepass@npm:preact-ssr-prepass preact-render-to-string
@rschristian thanks for answer.
Any reason why you're using
yarn add preact preact-render-to-string preact-ssr-prepass next-plugin-preact
I tried to create minimal steps to reproduce warnings.
Command:
yarn add next next-plugin-preact preact preact-render-to-string react@npm:@preact/compat@* react-dom@npm:@preact/compat@* react-ssr-prepass@npm:preact-ssr-prepass@*
yarn log:
➤ YN0000: ┌ Resolution step
➤ YN0032: │ evp_bytestokey@npm:1.0.3: Implicit dependencies on node-gyp are discouraged
➤ YN0061: │ querystring@npm:0.2.0 is deprecated: The querystring API is considered Legacy. new code should use the URLSearchParams API instead.
➤ YN0061: │ querystring@npm:0.2.1 is deprecated: The querystring API is considered Legacy. new code should use the URLSearchParams API instead.
➤ YN0032: │ fsevents@npm:2.3.2: Implicit dependencies on node-gyp are discouraged
➤ YN0032: │ fsevents@npm:2.3.2: Implicit dependencies on node-gyp are discouraged
➤ YN0002: │ next-plugin-preact@npm:3.0.6 [99790] doesn't provide @prefresh/babel-plugin (p48563), requested by @prefresh/webpack
➤ YN0002: │ next-plugin-preact@npm:3.0.6 [99790] doesn't provide next (p7b6b4), requested by @prefresh/next
➤ YN0002: │ next-plugin-preact@npm:3.0.6 [99790] doesn't provide webpack (p67555), requested by @prefresh/next
➤ YN0002: │ next-plugin-preact@npm:3.0.6 [99790] doesn't provide webpack (p99d5e), requested by @prefresh/webpack
➤ YN0002: │ yarnpreact@workspace:. doesn't provide preact-ssr-prepass (p28444), requested by next-plugin-preact
➤ YN0000: │ Some peer dependencies are incorrectly met; run yarn explain peer-requirements <hash> for details, where <hash> is the six-letter p-prefixed code
➤ YN0000: └ Completed
➤ YN0000: ┌ Fetch step
➤ YN0013: │ wide-align@npm:1.1.3 can't be found in the cache and will be fetched from the re
➤ YN0013: │ wrappy@npm:1.0.2 can't be found in the cache and will be fetched from the remote
➤ YN0013: │ xtend@npm:4.0.2 can't be found in the cache and will be fetched from the remote
➤ YN0013: │ yallist@npm:4.0.0 can't be found in the cache and will be fetched from the remot
➤ YN0013: │ yocto-queue@npm:0.1.0 can't be found in the cache and will be fetched from the r
➤ YN0000: └ Completed
➤ YN0000: ┌ Link step
➤ YN0007: │ next-plugin-preact@npm:3.0.6 [99790] must be built because it never has been before or the last one failed
➤ YN0000: └ Completed
➤ YN0000: Done with warnings
Sounds like wonky resolution with Yarn 2 if it thinks next
isn't provided when you've already installed it.
I'm using latest yarn berry version (currently 3.0.2) with a clean project:
yarn init -y
yarn set version berry
yarn add next next-plugin-preact preact preact-render-to-string react@npm:@preact/compat@* react-dom@npm:@preact/compat@* react-ssr-prepass@npm:preact-ssr-prepass@*
This seems to be another one of Yarn 2's infamous problems. You'll either need to ignore the warnings (as they're, at least mostly, wrong) or move to a tool that doesn't have these sorts of issues.
This seems to be another one of Yarn 2's infamous problems. You'll either need to ignore the warnings (as they're, at least mostly, wrong) or move to a tool that doesn't have these sorts of issues.
Ouch, the warnings are correct though and Yarn 1.x gives the same complaints, next-plugin-preact@3.0.6
doesn't declare any of them as neither dependencies
nor peerDependencies
so under strict dependency rules they aren't available and under node_modules
it will rely on hoisting to be in its favour.
@arcanis wrote an article on the subject https://dev.to/arcanis/implicit-transitive-peer-dependencies-ed0
@merceyz Yarn 1 does not give the same complaints, at least not fully. The warning against next
being provided certainly doesn't show up, beyond that, I didn't look too closely, as that's clearly an error in Yarn 2.
I didn't look too closely, as that's clearly an error in Yarn 2.
No, this is entirely intended. It's not an "infamous problem", it's a documented behaviour. Transitive peer dependencies must be declared all the way for both technical and semantic reasons.
No, this is entirely intended.
Something can be intentional and still an error to the larger community.
It's not an "infamous problem", it's a documented behaviour.
Behavior being documented doesn't mean it's not a problem. It's not hard to find hundreds of issues across popular projects with Yarn 2. A tool that has little use (compared to NPM & Yarn 1) that goes a different direction behaviorally, documented or not, is a problem. Combine that with other differences and you an infamous tool that creates problems wherever it goes.
Transitive peer dependencies must be declared all the way for both technical and semantic reasons.
I don't see the use in fixing warnings that pop up only in a single tool. Those "technical and semantic reasons" need to adhere to the larger ecosystem of standards and practices.
I'll certainly take a look myself if someone creates a PR (as any other maintainer could do) but I can't say I see the point in resolving Yarn 2+ issues after years of this.
Thanks to all for answers.
Same warnings log with yarn v1.22.11:
yarn init -y
yarn add next next-plugin-preact preact preact-render-to-string react@npm:@preact/compat@* react-dom@npm:@preact/compat@* react-ssr-prepass@npm:preact-ssr-prepass@*
log
info No lockfile found.
[1/4] Resolving packages...
warning next > native-url > querystring@0.2.1: The querystring API is considered Legacy. new code should use the URLSearchParams API instead.
warning next > node-libs-browser > url > querystring@0.2.0: The querystring API is considered Legacy. new code should use the URLSearchParams API instead.
[2/4] Fetching packages...
info @next/swc-darwin-arm64@11.1.2: The platform "win32" is incompatible with this module.
info "@next/swc-darwin-arm64@11.1.2" is an optional dependency and failed compatibility check. Excluding it from installation.
info @next/swc-darwin-arm64@11.1.2: The CPU architecture "x64" is incompatible with this module.
info @next/swc-darwin-x64@11.1.2: The platform "win32" is incompatible with this module.
info "@next/swc-darwin-x64@11.1.2" is an optional dependency and failed compatibility check. Excluding it from installation.
info @next/swc-linux-x64-gnu@11.1.2: The platform "win32" is incompatible with this module.
info "@next/swc-linux-x64-gnu@11.1.2" is an optional dependency and failed compatibility check. Excluding it from installation.
info fsevents@2.3.2: The platform "win32" is incompatible with this module.
info "fsevents@2.3.2" is an optional dependency and failed compatibility check. Excluding it from installation.
[3/4] Linking dependencies...
warning "next > styled-jsx > @babel/plugin-syntax-jsx@7.14.5" has unmet peer dependency "@babel/core@^7.0.0-0".
warning "next-plugin-preact > @prefresh/webpack@3.3.2" has unmet peer dependency "@prefresh/babel-plugin@^0.4.0".
warning "next-plugin-preact > @prefresh/webpack@3.3.2" has unmet peer dependency "webpack@^4.0.0 || ^5.0.0".
warning "next-plugin-preact > @prefresh/next@1.4.7" has unmet peer dependency "webpack@^4.0.0 || ^5.0.0".
warning " > next-plugin-preact@3.0.6" has unmet peer dependency "preact-ssr-prepass@>=1".
[4/4] Building fresh packages...
success Saved lockfile.
success Saved 207 new dependencies.
info Direct dependencies
├─ next-plugin-preact@3.0.6
├─ next@11.1.2
├─ preact-render-to-string@5.1.19
├─ preact@10.5.14
├─ react-dom@17.0.2
├─ react-ssr-prepass@1.2.0
└─ react@17.0.2
info All dependencies
├─ @babel/code-frame@7.12.11
├─ @babel/helper-plugin-utils@7.14.5
├─ @babel/helper-validator-identifier@7.14.9
├─ @babel/highlight@7.14.5
├─ @babel/plugin-syntax-jsx@7.14.5
├─ @babel/runtime@7.15.3
├─ @babel/types@7.15.0
├─ @hapi/accept@5.0.2
├─ @hapi/boom@9.1.4
├─ @napi-rs/triples@1.0.3
├─ @next/env@11.1.2
├─ @next/polyfill-module@11.1.2
├─ @next/react-dev-overlay@11.1.2
├─ @next/react-refresh-utils@11.1.2
├─ @next/swc-win32-x64-msvc@11.1.2
├─ @node-rs/helper@1.2.1
├─ @prefresh/babel-plugin@0.4.1
├─ @prefresh/next@1.4.7
├─ @prefresh/utils@1.1.1
├─ @prefresh/webpack@3.3.2
├─ @types/node@16.7.11
├─ anser@1.4.9
├─ ansi-regex@5.0.0
├─ ansi-styles@3.2.1
├─ anymatch@3.1.2
├─ asn1.js@5.4.1
├─ assert@2.0.0
├─ ast-types@0.13.2
├─ big.js@5.2.2
├─ binary-extensions@2.2.0
├─ braces@3.0.2
├─ brorand@1.1.0
├─ browserify-aes@1.2.0
├─ browserify-cipher@1.0.1
├─ browserify-des@1.0.2
├─ browserify-rsa@4.1.0
├─ browserify-sign@4.2.1
├─ browserify-zlib@0.2.0
├─ browserslist@4.16.6
├─ buffer-xor@1.0.3
├─ buffer@5.6.0
├─ bytes@3.1.0
├─ caniuse-lite@1.0.30001255
├─ chalk@2.4.2
├─ chokidar@3.5.1
├─ classnames@2.2.6
├─ color-convert@1.9.3
├─ color-name@1.1.3
├─ commondir@1.0.1
├─ console-browserify@1.2.0
├─ constants-browserify@1.0.0
├─ convert-source-map@1.7.0
├─ core-util-is@1.0.3
├─ create-ecdh@4.0.4
├─ create-hmac@1.1.7
├─ crypto-browserify@3.12.0
├─ css.escape@1.5.1
├─ cssnano-preset-simple@3.0.0
├─ cssnano-simple@3.0.0
├─ data-uri-to-buffer@3.0.1
├─ debug@2.6.9
├─ depd@1.1.2
├─ des.js@1.0.1
├─ diffie-hellman@5.0.3
├─ domain-browser@4.19.0
├─ electron-to-chromium@1.3.830
├─ emojis-list@2.1.0
├─ encoding@0.1.13
├─ es-to-primitive@1.2.1
├─ es6-object-assign@1.1.0
├─ escalade@3.1.1
├─ escape-string-regexp@1.0.5
├─ etag@1.8.1
├─ events@3.3.0
├─ fill-range@7.0.1
├─ find-cache-dir@3.3.1
├─ find-up@4.1.0
├─ get-orientation@1.1.2
├─ glob-parent@5.1.2
├─ glob-to-regexp@0.4.1
├─ graceful-fs@4.2.8
├─ hash.js@1.1.7
├─ he@1.2.0
├─ hmac-drbg@1.0.1
├─ http-errors@1.7.3
├─ https-browserify@1.0.0
├─ iconv-lite@0.4.24
├─ image-size@1.0.0
├─ internal-slot@1.0.3
├─ is-arguments@1.1.1
├─ is-bigint@1.0.4
├─ is-binary-path@2.1.0
├─ is-boolean-object@1.1.2
├─ is-callable@1.2.4
├─ is-date-object@1.0.5
├─ is-extglob@2.1.1
├─ is-generator-function@1.0.10
├─ is-glob@4.0.1
├─ is-nan@1.3.2
├─ is-negative-zero@2.0.1
├─ is-number-object@1.0.6
├─ is-number@7.0.0
├─ is-regex@1.1.4
├─ is-string@1.0.7
├─ is-symbol@1.0.4
├─ is-typed-array@1.1.8
├─ isarray@1.0.0
├─ jest-worker@27.0.0-next.5
├─ js-tokens@4.0.0
├─ json5@1.0.1
├─ loader-utils@1.2.3
├─ locate-path@5.0.0
├─ lodash.sortby@4.7.0
├─ make-dir@3.1.0
├─ merge-stream@2.0.0
├─ miller-rabin@4.0.1
├─ minimist@1.2.5
├─ module-alias@2.2.2
├─ ms@2.0.0
├─ nanoid@3.1.25
├─ native-url@0.3.4
├─ next-plugin-preact@3.0.6
├─ next@11.1.2
├─ node-fetch@2.6.1
├─ node-html-parser@1.4.9
├─ node-libs-browser@2.2.1
├─ node-releases@1.1.75
├─ normalize-path@3.0.0
├─ object-inspect@1.11.0
├─ object-is@1.1.5
├─ object.assign@4.1.2
├─ os-browserify@0.3.0
├─ p-limit@3.1.0
├─ p-locate@4.1.0
├─ p-try@2.2.0
├─ pako@1.0.11
├─ parse-asn1@5.1.6
├─ path-browserify@1.0.1
├─ path-exists@4.0.0
├─ picomatch@2.3.0
├─ pkg-dir@4.2.0
├─ platform@1.3.6
├─ pnp-webpack-plugin@1.6.4
├─ postcss@8.2.15
├─ preact-render-to-string@5.1.19
├─ preact@10.5.14
├─ pretty-format@3.8.0
├─ process-nextick-args@2.0.1
├─ process@0.11.10
├─ public-encrypt@4.0.3
├─ punycode@1.4.1
├─ querystring-es3@0.2.1
├─ querystring@0.2.1
├─ queue@6.0.2
├─ randomfill@1.0.4
├─ raw-body@2.4.1
├─ react-dom@17.0.2
├─ react-is@17.0.2
├─ react-refresh@0.8.3
├─ react-ssr-prepass@1.2.0
├─ react@17.0.2
├─ readdirp@3.5.0
├─ regenerator-runtime@0.13.9
├─ safer-buffer@2.1.2
├─ semver@6.3.0
├─ setimmediate@1.0.5
├─ setprototypeof@1.1.1
├─ shell-quote@1.7.2
├─ side-channel@1.0.4
├─ source-map@0.7.3
├─ stacktrace-parser@0.1.10
├─ statuses@1.5.0
├─ stream-browserify@3.0.0
├─ stream-http@3.1.1
├─ stream-parser@0.3.1
├─ string_decoder@1.3.0
├─ string-hash@1.1.3
├─ string.prototype.trimend@1.0.4
├─ string.prototype.trimstart@1.0.4
├─ strip-ansi@6.0.0
├─ styled-jsx@4.0.1
├─ stylis-rule-sheet@0.0.10
├─ stylis@3.5.4
├─ supports-color@5.5.0
├─ timers-browserify@2.0.12
├─ to-arraybuffer@1.0.1
├─ to-fast-properties@2.0.0
├─ to-regex-range@5.0.1
├─ toidentifier@1.0.0
├─ tr46@1.0.1
├─ ts-pnp@1.2.0
├─ tty-browserify@0.0.1
├─ type-fest@0.7.1
├─ unbox-primitive@1.0.1
├─ unpipe@1.0.0
├─ url@0.11.0
├─ use-subscription@1.5.1
├─ util-deprecate@1.0.2
├─ util@0.12.4
├─ vm-browserify@1.1.2
├─ watchpack@2.1.1
├─ webidl-conversions@4.0.2
├─ whatwg-url@7.1.0
├─ which-boxed-primitive@1.0.2
├─ which-typed-array@1.1.7
├─ xtend@4.0.2
└─ yocto-queue@0.1.0
Done in 138.92s.
So package.json should be updated as follow:
{
...
"dependencies": {
...
"@prefresh/babel-plugin": "<min_version>",
"webpack": "<min_version>"
},
"peerDependencies": {
...
"next": "<min_version>",
"react": "<min_version>",
"react-dom": "<min_version>"
}
}
@arcanis can exists a protocol (maybe a feature) to inherit peerDependencies and all (recursively) its peerDependency (transitive dependencies)?
Example for this use case:
Inherit all peerDependency of @prefresh/next
(next
and all its peerDependencies (react
and react-dom
)).
peerDependency tree:
@prefresh/next
next
react
react-dom
Change from:
{
...
"peerDependencies": {
"next": "<min_version>",
"react": "<min_version>",
"react-dom": "<min_version>"
}
}
to:
{
...
"peerDependencies": {
"@prefresh/next": "<inherit_protocol_for_all_peerDependencies_of_@prefresh/next>"
}
}
I don't see the use in fixing warnings that pop up only in a single tool. Those "technical and semantic reasons" need to adhere to the larger ecosystem of standards and practices.
I'll certainly take a look myself if someone creates a PR (as any other maintainer could do) but I can't say I see the point in resolving Yarn 2+ issues after years of this.
@rschristian npm also doesn't see it as provided and will install a separate version if they can't be deduped to the same version without issuing a warning
{
"dependencies": {
"next": "11.1.3-canary.7",
"next-plugin-preact": "3.0.6",
"preact": "10.5.14",
"preact-render-to-string": "5.1.19",
"react": "npm:@preact/compat@17.0.2",
"react-dom": "npm:@preact/compat@17.0.2",
"react-ssr-prepass": "npm:preact-ssr-prepass@1.2.0"
}
}
$ npm --version && npm i && find node_modules/**/next/ -maxdepth 1 -type d
7.21.1
[...]
node_modules/next-plugin-preact/node_modules/next/
[...]
node_modules/next/
[...]