When I add dependency without it's peerDependency in empty project by editing package.json like:
{
"name": "pnpmtest",
"devDependencies": {
"eslint-plugin-jsx-a11y": "^6.6.0"
}
}
and then run
pnpm install
Command will output error ERR_PNPM_PEER_DEP_ISSUES
devDependencies:
+ eslint-plugin-jsx-a11y 6.6.1
ERR_PNPM_PEER_DEP_ISSUES Unmet peer dependencies
.
└─┬ eslint-plugin-jsx-a11y 6.6.1
└── ✕ missing peer eslint@"^3 || ^4 || ^5 || ^6 || ^7 || ^8"
Peer dependencies that should be installed:
eslint@"^3 || ^4 || ^5 || ^6 || ^7 || ^8"
Above command output 1 exit code.
echo $?
1
This error is perfectly fine since my project is missing eslint. This is desired output.
My problem starts in CI environment where I would also like to see this error after pnpm install and break CI pipeline. Currently when I remove node_modules and run above install once again (this is simulation what is happening in CI) I do not see error and command output code 0.
→ rm -rf node_modules
→ pnpm install
Lockfile is up to date, resolution step is skipped
Packages: +56
++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Packages are hard linked from the content-addressable store to the virtual store.
Content-addressable store is at: /Users/mjanaszek/Library/pnpm/store/v3
Virtual store is at: node_modules/.pnpm
Progress: resolved 56, reused 56, downloaded 0, added 56, done
devDependencies:
+ eslint-plugin-jsx-a11y 6.6.1
→ echo $?
0
How to check in CI environment (when "Lockfile is up to date") if my dependencies contains some ERR_PNPM_PEER_DEP_ISSUES?
This command does the trick:
pnpm install --resolution-only
The help for --resolution-only says:
Re-runs resolution: useful for printing out peer dependency issues
Not a very self explanatory name but does what you needed (and what I needed too!)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With