csstools / postcss-normalize

Use the parts of normalize.css (or sanitize.css) you need from your browserslist
Creative Commons Zero v1.0 Universal
816 stars 40 forks source link

Yarn 2 with PnP error #64

Closed herrlegno closed 1 year ago

herrlegno commented 2 years ago

I'm using Next.js with a Custom PostCSS config adding this package as well as installing all with Yarn 2. The problem I'm facing is when i try to run yarn dev it gives me this error:

warn  - SWC minify beta enabled. https://nextjs.org/docs/messages/swc-minify-enabled
Error: postcss-browser-comments tried to access browserslist (a peer dependency) but it isn't provided by your application; this makes the require call ambiguous and unsound.

Required package: browserslist
Required by: postcss-browser-comments@virtual:e68dadf93bc66bf01a9feba2da6a5754dc8f4a54bb6236eb2be70bb5ca41d96f6c6a2fbd7bc879da195ab4b6b7b7dd4437dcec9ededdae5c4bd360875b38b13c#npm:4.0.0 (via /home/herrlegno/personal/website/.yarn/__virtual__/postcss-browser-comments-virtual-d17c7d6d1d/0/cache/postcss-browser-comments-npm-4.0.0-ad08f76065-9b8e709483.zip/node_modules/postcss-browser-comments/)
Ancestor breaking the chain: website@workspace:.

Require stack:
- /home/herrlegno/personal/website/.yarn/__virtual__/postcss-browser-comments-virtual-d17c7d6d1d/0/cache/postcss-browser-comments-npm-4.0.0-ad08f76065-9b8e709483.zip/node_modules/postcss-browser-comments/index.cjs
- /home/herrlegno/personal/website/.yarn/__virtual__/postcss-normalize-virtual-e68dadf93b/0/cache/postcss-normalize-npm-10.0.1-f2f3d55340-af67ade84e.zip/node_modules/postcss-normalize/index.cjs
- /home/herrlegno/personal/website/.yarn/__virtual__/next-virtual-21bdc7957b/0/cache/next-npm-12.0.4-fcbd6e5d3e-b9711e7d42.zip/node_modules/next/dist/build/webpack/config/blocks/css/plugins.js
- /home/herrlegno/personal/website/.yarn/__virtual__/next-virtual-21bdc7957b/0/cache/next-npm-12.0.4-fcbd6e5d3e-b9711e7d42.zip/node_modules/next/dist/build/webpack/config/blocks/css/index.js
- /home/herrlegno/personal/website/.yarn/__virtual__/next-virtual-21bdc7957b/0/cache/next-npm-12.0.4-fcbd6e5d3e-b9711e7d42.zip/node_modules/next/dist/build/webpack/config/index.js
- /home/herrlegno/personal/website/.yarn/__virtual__/next-virtual-21bdc7957b/0/cache/next-npm-12.0.4-fcbd6e5d3e-b9711e7d42.zip/node_modules/next/dist/build/webpack-config.js
- /home/herrlegno/personal/website/.yarn/__virtual__/next-virtual-21bdc7957b/0/cache/next-npm-12.0.4-fcbd6e5d3e-b9711e7d42.zip/node_modules/next/dist/server/dev/hot-reloader.js
- /home/herrlegno/personal/website/.yarn/__virtual__/next-virtual-21bdc7957b/0/cache/next-npm-12.0.4-fcbd6e5d3e-b9711e7d42.zip/node_modules/next/dist/server/dev/next-dev-server.js
- /home/herrlegno/personal/website/.yarn/__virtual__/next-virtual-21bdc7957b/0/cache/next-npm-12.0.4-fcbd6e5d3e-b9711e7d42.zip/node_modules/next/dist/server/next.js
- /home/herrlegno/personal/website/.yarn/__virtual__/next-virtual-21bdc7957b/0/cache/next-npm-12.0.4-fcbd6e5d3e-b9711e7d42.zip/node_modules/next/dist/server/lib/start-server.js
- /home/herrlegno/personal/website/.yarn/__virtual__/next-virtual-21bdc7957b/0/cache/next-npm-12.0.4-fcbd6e5d3e-b9711e7d42.zip/node_modules/next/dist/cli/next-dev.js
- /home/herrlegno/personal/website/.yarn/__virtual__/next-virtual-21bdc7957b/0/cache/next-npm-12.0.4-fcbd6e5d3e-b9711e7d42.zip/node_modules/next/dist/bin/next
    at Function.external_module_.Module._resolveFilename (/home/herrlegno/personal/website/.pnp.cjs:16792:55)
    at Function.mod._resolveFilename (/home/herrlegno/personal/website/.yarn/__virtual__/next-virtual-21bdc7957b/0/cache/next-npm-12.0.4-fcbd6e5d3e-b9711e7d42.zip/node_modules/next/dist/build/webpack/require-hook.js:171:28)
    at Function.external_module_.Module._load (/home/herrlegno/personal/website/.pnp.cjs:16591:48)
    at Module.require (node:internal/modules/cjs/loader:1005:19)
    at require (node:internal/modules/cjs/helpers:102:18)
    at Object.<anonymous> (/home/herrlegno/personal/website/.yarn/__virtual__/postcss-browser-comments-virtual-d17c7d6d1d/0/cache/postcss-browser-comments-npm-4.0.0-ad08f76065-9b8e709483.zip/node_modules/postcss-browser-comments/index.cjs:1:20)
    at Module._compile (node:internal/modules/cjs/loader:1101:14)
    at Object.Module._extensions..js (node:internal/modules/cjs/loader:1153:10)
    at Module.load (node:internal/modules/cjs/loader:981:32)
    at Function.external_module_.Module._load (/home/herrlegno/personal/website/.pnp.cjs:16641:14)

Process finished with exit code 1

I also ran yarn dlx @yarnpkg/doctor and it gave me this:

➤ YN0000: ┌ Resolution step
➤ YN0000: └ Completed in 7s 216ms
➤ YN0000: ┌ Post-resolution validation
➤ YN0068: │ postcss-browser-comments ➤ dependencies ➤ browserslist: No matching package in the dependency tree; you may not need this rule anymore.
➤ YN0000: └ Completed
➤ YN0000: ┌ Fetch step
➤ YN0013: │ toposort@npm:2.0.2 can't be found in the cache and will be fetched from the remote registry
➤ YN0013: │ treeify@npm:1.1.0 can't be found in the cache and will be fetched from the remote registry
➤ YN0013: │ tunnel@npm:0.0.6 can't be found in the cache and will be fetched from the remote registry
➤ YN0013: │ typanion@npm:3.7.1 can't be found in the cache and will be fetched from the remote registry
➤ YN0013: │ yup@npm:0.32.11 can't be found in the cache and will be fetched from the remote registry
➤ YN0000: └ Completed in 2s 734ms
➤ YN0000: ┌ Link step
➤ YN0000: │ ESM support for PnP uses the experimental loader API and is therefore experimental
➤ YN0000: └ Completed
➤ YN0000: Done with warnings in 10s 123ms

➤ YN0000: Found 1 package(s) to process
➤ YN0000: For a grand total of 6 file(s) to validate

➤ YN0000: ┌ /home/herrlegno/personal/website/package.json
➤ YN0000: │ /home/herrlegno/personal/website/package.json:26:26: Unmet transitive peer dependency on browserslist@>= 4, via postcss-normalize@^10.0.1
➤ YN0000: └ Completed in 10s 495ms
➤ YN0000: ⠼ --------------------------------------------------------------------------------

➤ YN0000: Failed with errors in 10s 496ms

I'm new to the Yarn 2 package handling approach, so am I in the right place? Thanks.