PNPM doesn't install peerDependencies correctly and consistenly. in this case @typescript-eslint/eslint-plugin

Viewed 13

Based on this issue that i created https://github.com/pnpm/pnpm/issues/5231

Turns out the issue wasn't on vercel. it's pnpm that didn't consistent when installing dependencies.

We can reproduce it with this repo.

note: I have set up auto-install-peers=true in .npmrc

Steps to reproduce.

  • git clone https://github.com/bryantobing12/next-boilerplate
  • cd next-boilerplate
  • pnpm install
  • pnpm lint,
  • the error shows up that tells Failed to load plugin '@typescript-eslint' declared in '.eslintrc.json » eslint-config-airbnb-typescript » C:\Users\bryan\myfiles\sandbox\hzn-workspace\next-boilerplate\node_modules\.pnpm\eslint-config-airbnb-typescript@17.0.0_xo3iu7jah6intte3rsuo37bj74\node_modules\eslint-config-airbnb-typescript\lib\shared.js': Cannot find module '@typescript-eslint/eslint-plugin'
  • at this point if we inspect node_modules. it's indeed @typescript-eslint/eslint-plugin not installed.

image

and it makes sense the errors show up because it is not added to node_modules where it is supposed to be added since it's listed as peerDependencies in eslint-config-airbnb-typescript package

image.

  • next, rm -rf pnpm-lock.yaml && pnpm install
  • pnpm lint the error didn't show up.
  • and if we inspect node_modules

@typescript-eslint/eslint-plugin finally added there image

why is this behavior happen? I don't want to always remove pnpm-lock.yaml before installing dependencies and It will create inconsistencies throughout the team

0 Answers
Related