Kamrul Khan
Kamrul Khan

Reputation: 3350

yargs.parse error from webpack.js

I am trying to install and use webpack for the first time. After installation I made a small webpack.config.js file:

  module.exports = {
      context: __dirname + "/assets/js",

      entry: "./react/index.js",

      output: {
      filename: "app.js",
      path: __dirname + "/public/assets/js"
  }
};

Then to run webpack I do:

node ./node_modules/webpack/bin/webpack.js

This gives me the following error:

/var/www/html/node_modules/webpack/bin/webpack.js:152
yargs.parse(process.argv.slice(2), (err, argv, output) => {
                                                    ^
SyntaxError: Unexpected token >
    at Module._compile (module.js:439:25)
    at Object.Module._extensions..js (module.js:474:10)
    at Module.load (module.js:356:32)
    at Function.Module._load (module.js:312:12)
    at Function.Module.runMain (module.js:497:10)
    at startup (node.js:119:16)
    at node.js:945:3

How to fix it?

Upvotes: 0

Views: 1416

Answers (1)

GANG LU
GANG LU

Reputation: 26

I had the same problem on Redhat Enterprise Linux. I discovered that if you use the node and npm versions downloaded from https://nodejs.org, this fixes the problem. Don't use yum or apt-get to install nodejs.

Upvotes: 1

Related Questions