postcss / postcss-cli

CLI for postcss
Other
840 stars 93 forks source link

Cannot find module `postcss` #350

Closed aleph-naught2tog closed 4 years ago

aleph-naught2tog commented 4 years ago

The script we have been using for a long time with postcss-cli started failing on multiple, disparate branches this morning.

It fails the exact same way when we try to postcss-cli just to check its version. We see this behavior on 7.1.1; I see that postcss must be installed as a peer dep for version 8, but this error is on a version prior to that.

To reproduce:

  1. Run npx postcss-cli --version

Output:

$ npx postcss-cli --version
npx: installed 87 in 6.138s
Cannot find module 'postcss'
Require stack:
- <home_dir>/.npm/_npx/21791/lib/node_modules/postcss-cli/index.js
- <home_dir>/.npm/_npx/21791/lib/node_modules/postcss-cli/bin/postcss

Current version: 7.1.1

We also tried it this on 8.0.0

RyanZim commented 4 years ago

npx postcss-cli --version is installing the latest version of postcss-cli from the registry, which is v8, which requires postcss as a peerDep. Try npx postcss --version in a project with v7 installed, and it should work fine.

wasimswdev commented 3 years ago

after installing postcss as dep for postcss-cli the problem is fixed, thanks