1

So I was following the tutorial on http://webpack.github.io/docs/tutorials/getting-started/ and I was stuck on the css style loader step. Here is my entry.js:

require("!style!css!./style.css");
document.write(require("./content.js"))

this is content.js:

module.exports = "It works from content.js";

this is style.css:

body{
    background: yellow;
}

After this, I am running this command:

webpack ./entry.js bundle.js

I am getting this error:

Version: webpack 1.13.0 Time: 866ms Asset Size Chunks Chunk Names bundle.js 10.1 kB 0 [emitted] main [0] ./entry.js 115 bytes {0} [built] [4] ./content.js 45 bytes {0} [built] + 3 hidden modules

ERROR in ./~/css-loader!./style.css Module build failed: ReferenceError: Promise is not defined at LazyResult.async (/var/www/html/webpack/node_modules/css-loader/node_modules/postcss/lib/lazy-result.js:157:31) at LazyResult.then (/var/www/html/webpack/node_modules/css-loader/node_modules/postcss/lib/lazy-result.js:79:21) at processCss (/var/www/html/webpack/node_modules/css-loader/lib/processCss.js:198:5) at Object.module.exports (/var/www/html/webpack/node_modules/css-loader/lib/loader.js:24:2) @ ./~/style-loader!./~/css-loader!./style.css 4:14-73

How to fix this?

1
  • What version of Node are you using? Commented May 18, 2016 at 9:03

1 Answer 1

0

As mentioned in the comments, your version of Node is very old (in fact, support for v0.10.x is being dropped in October). Support for native JavaScript Promise objects wasn't added until Node v4, and as suggested by the error message you posted, css-loader makes use of these behind the scenes.

So the only real solution to this issue is to update Node. There are two versions that you can choose from at the moment; v4 is the most stable but lacks some newer features, whereas v6 has the latest features but might be more buggy/less well supported.

Sign up to request clarification or add additional context in comments.

1 Comment

@VishnuPaspunoor: No problem, glad I could help. For what it's worth, once you get onto v4 or above you won't have to worry about versions as much - Node have a very consistent schedule when it comes to supported versions these days.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.