postcss / postcss-cli

CLI for postcss
Other
836 stars 93 forks source link

Command no found after upgrade to 11 #473

Closed openmindculture closed 7 months ago

openmindculture commented 7 months ago

After upgrading to postcss-cli ^11.0.0, the binary can no longer be found. This issue seems similar to Command no found #291 which has been closed without follow-up or solution.

According to the documentation, we should write postcss as a command. That does not work.

What used to work in previous versions: node_modules/postcss-cli/bin/postcss, e.g. in a package.json build target: "build:en": "node_modules/postcss-cli/bin/postcss src/*.css --dir dist_en.

    "devDependencies": {
        "postcss": "^8.4.35",
        "postcss-cli": "^11.0.0",
        "postcss-custom-properties": "^13.3.0",
        "postcss-custom-selectors": "^7.1.0",
        "postcss-import": "^16.0.0",
        "precss": "^4.0.0",

How to fix this problem without downgrading? How to use postcss-cli properly?

RyanZim commented 7 months ago

When you're inside npm scripts, you should be able to just use postcss, so for example: "build:en": "postcss src/*.css --dir dist_en. Is this not working for you?

Also, can you post your Node.js & npm versions?

openmindculture commented 7 months ago

Yes, my node and npm had been outdated. Node v19.2.0 + npm 8.19.3 + postcss-cli 8.3.1 worked with the long path to node_modules/postcss-cli/bin/postcss (that I must have put after only postcss did not work), node v19.2.0 + npm 8.19.3 + postcss-cli 11.0.0 did not work with that long path anymore, and so did the latest node v20.11.1 (LTS) + npm 10.4.0. But they work with just postcss, so I think that we can close this issue.

Thanks for you help!