-
-
Notifications
You must be signed in to change notification settings - Fork 606
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Promise is not defined error in 0.19.0 #144
Comments
The problem might be that they removed Promise polyfill in postcss 5.0. Perhaps we should push this upstream? |
@bebraw PostCSS 5.0 does not support node 0.10, but you can polyfill the Promise API yourself: |
@ben-eb Alright. Thanks for the info. |
Thanks, works after upgrading node to 4.1.1, didn't realise I was so far behind. |
@chrismcband It might be good to resolve, or at least document this, regardless. Great to hear you got it to work, though. |
Thanks, upgrading node to 4.1.1 did help. Note for OS X users: Homebrew does not have the updated formula, so it is pretty useless to run "brew upgrade". I had to download an official package from Node.js website. |
Wow... I thought I was going crazy and it did not cross my mind that I had to update node, but that worked and I'm very happy now :) ps. I updated through Homebrew just fine, just ran "brew update" first and then "brew upgrade node". |
Same here, upgraded node through homebrew just fine. In my case it was still showing the old node version, but that was just a $PATH issue where I had an older version of node installed as part of a boxen installation. |
Same here, upgraded node to latest version 4.1.1 and works as expected |
How exactly do you pollyfill // I added this to the top of my `webpack.config.js`
if (global.Promise == null) {
global.Promise = require('es6-promise')
} |
Thanks @ben-eb |
You rock @gregkbarnes! My app would still not deploy on Azure after upgrading to 4.1.2, your polyfill example fixed the issue. |
@gregkbarnes that worked for me too. seems like that needs to be added. thanks for the help! |
@gregkbarnes Thanks! It's worked. |
saved my day... |
Running the build task under Node 0.10.x fails with the following error: > ERROR in ./~/css-loader!./~/sass-loader!./src/components/widget/style.scss > Module build failed: ReferenceError: Promise is not defined See webpack-contrib/css-loader#144 for details. Node 0.10.x is the latest version available in the Ubuntu package repository, so it's still widely used in dev environments, and should be supported.
I'm getting this on node v5.3.0... |
@sokra are you happy to close this issue and mark as |
If it is an old node version issue it could be solved setting a minimal engine version in the For example, adding the following field to the
You are not supporting old versions but at least it is explicit which ones are. |
@dreyescat Good idea. Would you like to make a PR? |
Setting the minimum version of the node engine will make npm to warn or complain, if node `engine-strict` config is set to true, whenever the installation environment does not meet this requirement. Background: `css-loader` depends on `postcss` that uses native promises. Promises where introduced in node version 0.12.0. So `css-loader` *transitively inherits* this dependency. Related to webpack-contrib#144.
I spent several hours trying to understand what was going on with weird error messages like:
Adding this in
Ensuring this or the node version directly in css-loader would be great. |
i tried to run the build scripts on an ubuntu machine with an old install of node and hit an error due to Promise being undefined. webpack-contrib/css-loader#144
use es6-promise as workaround for webpack-contrib/css-loader#144
Closing given the related PR was merged. |
Thank you, @ben-eb! Add to webpack.config.js and it's now working! |
Latest release is failing builds for me, seeing the error below in 0.19.0. This error is not present in 0.18.0.
Here's the webpack config:
And package.json:
The text was updated successfully, but these errors were encountered: