css-loader: Module build failed: ReferenceError: Promise is not defined

Hi all,

I try to update some of my npm packages, and then I’m having this issues.

ERROR in ./~/css-loader!./~/sass-loader!./src/style/components/home.scss
Module build failed: ReferenceError: Promise is not defined
    at LazyResult.async (/Users/roy/development/stash/chaas-web/node_modules/css-loader/node_modules/postcss/lib/lazy-result.js:152:31)
    at LazyResult.then (/Users/roy/development/stash/chaas-web/node_modules/css-loader/node_modules/postcss/lib/lazy-result.js:75:21)
    at processCss (/Users/roy/development/stash/chaas-web/node_modules/css-loader/lib/processCss.js:174:5)
    at Object.module.exports (/Users/roy/development/stash/chaas-web/node_modules/css-loader/lib/loader.js:22:2)
 @ ./src/style/components/home.scss 4:14-127 13:2-17:4 13:2-17:4 14:20-133

And the following is my package.json

  "devDependencies": {
    "assets-webpack-plugin": "2.2.x",
    "babel-jest": "5.3.x",
    "css-loader": "0.19.x",
    "file": "0.2.x",
    "file-loader": "0.8.x",
    "html-webpack-plugin": "1.6.x",
    "image-webpack-loader": "1.6.x",
    "imagemin": "3.2.x",
    "jest-cli": "0.5.x",
    "jsx-loader": "0.13.x",
    "node-sass": "3.3.x",
    "react-hot-loader": "1.3.x",
    "react-proxy-loader": "0.3.x",
    "react-tools": "0.13.x",
    "sass-loader": "2.0.x",
    "style-loader": "0.12.x",
    "webpack": "1.12.x",
    "webpack-dev-server": "1.11.x"
  },

And this is my webpack config for the scss

{ test: /\.scss$/, loader: "style-loader!css-loader!sass-loader" }

Anyone have idea and much appreciated, thanks.

About this issue

  • Original URL
  • State: closed
  • Created 9 years ago
  • Comments: 35 (2 by maintainers)

Commits related to this issue

Most upvoted comments

@Strate I got it to work by downgrading css-loader to “^0.18.0”

@fhurta Same for me. npm install es6-promise --save and then added require('es6-promise').polyfill() at the top of webpack.config.js.

Had the same problem. Realized I had Node v0.10.26 (gosh!) installed. Upgraded to latest stable version (v4.2.1) and the problem was fixed.

I fixed problem by switching to node version 0.12.7 I guess 0.19.0 uses a dependency that breaks on node 0.10?

It’s a bit frustrating as my older projects can’t use 0.12 so I’ll have to switch back to 0.10 when I switch projects.

The same problem here, with node 6.2.1 css-loader 0.23.1

Workaround suggested by @andre-gh

require(‘es6-promise’).polyfill() in your webpack config

works for me too

// first line of webpack.config.js
global.Promise = require('bluebird')

if you already have bluebird.

Upgrading to node 0.12.x works too, in case you can’t make the leap to 4.