-2

I am working on a project where I mainly use CSS (SASS) and just a few js. I found out about Autoprefixer a couple days ago and tried to use it by CLI. But each time I get the same error, "promise is not defined". I tried to fix this problem, but I only found answer for grunt or other things. No solutions for CLI use. Do you have any idea on how can I fix it ?

Thank you !

cimmanon
  • 67,211
  • 17
  • 165
  • 171
Wallow
  • 31
  • 4

2 Answers2

1

After some research, I tried many things then I come with a solution.

npm i -g es6-promise
Then, in lazy-result.js file that gave me the error on promise, I add at the first line:
var Promise = require('es6-promise').Promise;

It seems to work fine for me.

Wallow
  • 31
  • 4
0

Recently Autoprefixer has become a part of PostCSS. To be able to use Autoprefixer as a CLI Tool you will have to use the PostCSS-CLI module.
npm install --global postcss-cli autoprefixer

Here is an example of how to use the module:
postcss --use autoprefixer *.css -d build/

Arnold Stoba
  • 368
  • 1
  • 8
  • Okay. You might want to check your node version and update it. Otherwise checkout a [promise polyfill](https://github.com/taylorhakes/promise-polyfill), which might solve the problem for you. – Arnold Stoba Feb 16 '16 at 15:41
  • I used `node -v`, I get `v0.10.32`, then `npm i -g node`, same version. I'm not sure about your promise polyfill. I did check the link, but it's not for the CLI is it ? – Wallow Feb 17 '16 at 03:53