Module build failed: ReferenceError: Promise is not defined #145

Closed
iroy2000 opened this Issue Sep 24, 2015 · 34 comments

Projects

None yet
@iroy2000

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.

@ben-eb
Contributor
ben-eb commented Sep 24, 2015

Duplicate of #144.

@dev-mraj
dev-mraj commented Oct 5, 2015

same
+1

@Aknilam
Aknilam commented Oct 6, 2015

+1

@Strate
Strate commented Oct 14, 2015

Is there any quick workaround?

@nazywamsiepawel

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

@philihp
philihp commented Oct 15, 2015

+1, @nazywamsiepawel, same. Seems to be exclusive to 0.19.0

@changtimwu

+1 @nazywamsiepawel . Your workaround works.

@jhawthorn jhawthorn added a commit to PorkChopClub/porkchop that referenced this issue Oct 16, 2015
@jhawthorn jhawthorn Downgrade css-loader to ^0.18.0
As per suggestion in webpack/css-loader#145

Change-Id: I45abfa4236f169277156cb4b453106c10e5bf407
e0b7fa2
@wouter-willems

@nazywamsiepawel thnx, that did the trick

@sean-stanley

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.

@pashamesh pashamesh added a commit to pashamesh/videojs-chapter-thumbnails that referenced this issue Oct 20, 2015
@pashamesh pashamesh Fixed webpack build failed
Webpack build was failed because of webpack/css-loader#145
a314441
@pashamesh pashamesh referenced this issue in pashamesh/videojs-chapter-thumbnails Oct 20, 2015
Open

Fixed webpack build failed #1

@umarashfaq

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.

@andre-gh

Fyi for anyone who is unable to update for various project constraint reasons, require('es6-promise').polyfill() in your webpack config should fix the issue.

@anilpai
anilpai commented Oct 29, 2015

Thanks @andre-gh .. Works !!

@yangshun
yangshun commented Nov 8, 2015

I upgraded my node to v0.12.7 and it worked.

@dr-nafanya

@andre-gh thanks - the workaround works perfectly!

@rish1690

@andre-gh thank you for saving my day

@jackgeek

I'm getting this on node v5.3.0

@Kobold
Kobold commented Dec 25, 2015

@andre-gh Thanks man!

@keithsun80

I got this problem on node: '0.10.40'.
To upgrade node version to node: '4.2.4' , solve this problem.

@yanhaijing

Had the same problem. Realized I had Node v0.10.29 (gosh!) installed

@MarcusMann

I'am I did downgrade of nodejs 0.10 to v5.3.0

on ubuntu:

sudo apt-get remove nodejs

Install nodeJS v5.3.0:
curl -sL https://deb.nodesource.com/setup_5.x | sudo -E bash -
sudo apt-get install -y nodejs

@yanhaijing

I can't upgrade,Too many project dependencies

@FintanK
FintanK commented Jan 7, 2016

@nazywamsiepawel thank you

@philihp
philihp commented Jan 7, 2016

@yanhaijing I believe in you! Don't let your dreams be dreams!!

@markdalgleish
Member

Closing as this is a duplicate of #144, as mentioned already by @ben-eb. He also proposed a solution for those stuck on older versions of Node, by polyfilling global.Promise.

@yanhaijing

@philihp thank you

@hzhu hzhu referenced this issue in hzhu/weworkhostels-v2 Jan 15, 2016
Closed

Error with webpack loaders after CSS integration #10

@dopeboy
dopeboy commented Jan 17, 2016

Thanks @nazywamsiepawel - am in the same boat as others where I can't upgrade.

@scottsword

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

@UndergroundLabs

Downgrading css-loader worked.

@jkytomak jkytomak added a commit to Opetushallitus/soresu-form that referenced this issue Apr 1, 2016
@jkytomak jkytomak Have to use css-loader 0.18.0
Because of:
webpack/css-loader#145
and
nodesource/distributions#73

so that the build works also in va vmware Jenkins
44c1142
@jkytomak jkytomak added a commit to Opetushallitus/valtionavustus that referenced this issue Apr 1, 2016
@jkytomak jkytomak Have to use css-loader 0.18.0
Because of:
webpack/css-loader#145
and
nodesource/distributions#73

so that the build works also in va vmware Jenkins
381d52e
@stonexer stonexer referenced this issue in stonexer/wechatBot Jun 7, 2016
Closed

npm install报错 #18

@jcarva
jcarva commented Jun 22, 2016

Thanks guys, I'm had the same problem. Upgrading to Node v6.2.2 works perfectly !!

@thewayiam thewayiam referenced this issue in g0v/itaigi Jul 3, 2016
Merged

加npm的badge #86

@usirin
usirin commented Aug 8, 2016
// first line of webpack.config.js
global.Promise = require('bluebird')

if you already have bluebird.

@fhurta
fhurta commented Aug 12, 2016

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

@martynchamberlin

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

@adamf321 adamf321 added a commit to moxie-lean/patternlab-starterkit-twig that referenced this issue Sep 16, 2016
@adamf321 adamf321 Fix webpack/css-loader#145, which occurs on our server. e5cb854
@kevinSuttle kevinSuttle referenced this issue in webpack/json-loader Oct 7, 2016
Open

Unhandled Promise Rejection Warning #28

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment