0

npx eslint This works fine and executes eslint with out the explicit cli install

on the other hand,

npx prettier-eslint This one does not work. //command not found

But if I install prettier-eslint-cli above command works fine

My question is why npx prettier-eslint command does not work without the cli installation

Ankur Marwaha
  • 1,613
  • 2
  • 15
  • 30

1 Answers1

0

That's because npm is a package manager while npx is a package runner. You can read more about the differences here and here.

Raz Chiriac
  • 406
  • 2
  • 7
  • I know that difference, what I don't understand is the difference in behaviour for eslint and prettier-eslint here – Ankur Marwaha Apr 22 '20 at 18:22
  • You need a **cli package** for both `eslint` and `prettier-eslint` in order to run them using `npx`. These packages are `eslint-cli` and `prettier-eslint-cli` specifically. The difference is that `eslint-cli` comes pre-packaged as a dependency of `eslint`, whereas `prettier-eslint-cli` does not come pre-packaged with `prettier-eslint`, so you have to install it manually before you can use it. – Raz Chiriac Apr 22 '20 at 18:43
  • Are you trying to say "eslint" install "eslint-cli" as a dependency. In that case where is eslint-cli installed. package-lock.json does not contain it. – Ankur Marwaha Apr 22 '20 at 19:00