Skip to content
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

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

Closed
iroy2000 opened this issue Sep 24, 2015 · 35 comments
Closed

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

iroy2000 opened this issue Sep 24, 2015 · 35 comments

Comments

@iroy2000
Copy link

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
Copy link
Contributor

ben-eb commented Sep 24, 2015

Duplicate of #144.

@dev-mraj
Copy link

dev-mraj commented Oct 5, 2015

same
+1

@Aknilam
Copy link

Aknilam commented Oct 6, 2015

+1

1 similar comment
@nazywamsiepawel
Copy link

+1

@Strate
Copy link

Strate commented Oct 14, 2015

Is there any quick workaround?

@nazywamsiepawel
Copy link

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

@wouter-willems
Copy link

+1

@philihp
Copy link

philihp commented Oct 15, 2015

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

@changtimwu
Copy link

+1 @nazywamsiepawel . Your workaround works.

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

Change-Id: I45abfa4236f169277156cb4b453106c10e5bf407
@wouter-willems
Copy link

@nazywamsiepawel thnx, that did the trick

@sean-stanley
Copy link

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 added a commit to pashamesh/videojs-chapter-thumbnails that referenced this issue Oct 20, 2015
Webpack build was failed because of webpack-contrib/css-loader#145
@umarashfaq
Copy link

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.

@anilpai
Copy link

anilpai commented Oct 29, 2015

Thanks @andre-gh .. Works !!

@yangshun
Copy link

yangshun commented Nov 8, 2015

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

@dr-nafanya
Copy link

@andre-gh thanks - the workaround works perfectly!

@rish1690
Copy link

@andre-gh thank you for saving my day

@jackgeek
Copy link

I'm getting this on node v5.3.0

@Kobold
Copy link

Kobold commented Dec 25, 2015

@andre-gh Thanks man!

@keithsun80
Copy link

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

@yanhaijing
Copy link

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

@marcuxyz
Copy link

marcuxyz commented Jan 6, 2016

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
Copy link

I can't upgrade,Too many project dependencies

@FintanK
Copy link

FintanK commented Jan 7, 2016

@nazywamsiepawel thank you

@philihp
Copy link

philihp commented Jan 7, 2016

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

@markdalgleish
Copy link
Contributor

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
Copy link

@philihp thank you

@dopeboy
Copy link

dopeboy commented Jan 17, 2016

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

@scottsword
Copy link

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

@UndergroundLabs
Copy link

Downgrading css-loader worked.

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

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

so that the build works also in va vmware Jenkins
@jcarva
Copy link

jcarva commented Jun 22, 2016

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

@usirin
Copy link

usirin commented Aug 8, 2016

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

if you already have bluebird.

@fhurta
Copy link

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
Copy link

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

marclave added a commit to A3P/VRPrototyping that referenced this issue May 5, 2017
Modify output directory to build, use ExtractTextPlugin's latest example
of consumption of css files.

Polyfill is not needed for the css-loader, because we are not throwing
the Promise not defined Error from
webpack-contrib/css-loader#145
marclave added a commit to A3P/VRPrototyping that referenced this issue May 5, 2017
Modify output directory to build, use ExtractTextPlugin's latest example
of consumption of css files.

Polyfill is not needed for the css-loader, because we are not throwing
the Promise not defined Error from
webpack-contrib/css-loader#145
@ketabi
Copy link

ketabi commented Jan 11, 2018

You can use Promise: 'es6-promise' in your webpack config:

plugins: [
     //tells webpack where to store data about your bundles.
     new BundleTracker({filename: './webpack-stats.json'}),

     //makes jQuery available in every module
     new webpack.ProvidePlugin({
         $: 'jquery',
         jQuery: 'jquery',
         'window.jQuery': 'jquery',
         Promise: 'es6-promise'
     }),

     // Configure path for served CSS files ("desktop_css" will be served as /dist/desktop_css.css)
     new ExtractTextPlugin('[name].css'),
 ],

https://stackoverflow.com/questions/35769777/axios-ie-promise-doesnt-work/48203092#48203092

I had this in Android 4.x browsers and about using axios And Promise there.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests