davidguttman / cssify

Simple middleware for Browserify to add css styles to the browser.
122 stars 19 forks source link

Reference Error : Promise is not defined #50

Closed jmfairlie closed 8 years ago

jmfairlie commented 8 years ago

Trying to use cssify in my project. Followed the simple instructions and got this error:

/home/xx/project/node_modules/cssify/lib/process-css.js:71
return Promise.resolve(wrapCss(fileName, source, options))
Reference Error : Promise is not defined

I checked the file and indeed there is no definition of Promise. If I install bluebird in the cssify folder and add this line to process-css.js it suddenly (and obviously) starts working:

Promise = require('bluebird');

I am new to node, browserify, etc so this is maybe an obvious question but can't figure it out on my own:

How is the code supposed to work if there is no definition of Promise?

davidguttman commented 8 years ago

Sorry for the trouble! Promise is globally available since node v0.12 (which is depended on since cssify@1.0.0: https://github.com/davidguttman/cssify/blob/master/package.json#L25).

If using a more recent version of node isn't an option, maybe try cssify@<1.0.0?

jmfairlie commented 8 years ago

Thanks a lot! I would have thought that since I have node v0.10.25 and I installed ccsify via 'npm install' npm would have automatically chosen a compatible cssify version... I wonder if this is a bug in npm install or just the way things work...