node.jsbashnpmautoprefixer

Autoprefixer command not found


I have a problem using Autoprefixer I tried installing using:

npm install -g autoprefixer

and I tried installing it in my project only:

npm install autoprefixer --save-dev

but nothing seems to help. Every time I get ther error:

-bash: autoprefixer: command not found

I am using OSX Yosemite, node v4.1.1 and npm v3.3.4.

Note that I am not trying to use Autoprefixer for Gulp or Grunt, I am trying to make a setup where it would run as a npm script (as mentioned here).

If you need any additional info just ask, I will provide anything needed. This is just frustrating I spent 2 hours trying to fix it but without any luck.

Thanks for all smart answers!


Solution

  • The cli tool for autoprefixer was deprecated. There's still a seperate package providing it though.

    You can use the postcss-cli to run Autoprefixer from CLI:

    npm install --global postcss-cli autoprefixer
    postcss --use autoprefixer *.css -d build/
    

    See postcss -h for help.