0
votes

In My Gulpfile.js faulty part:

gulp.task('webpack', gulp.series(async () => {
    const option = yargs.argv.release ? "-p" : "-d";
    execSync(`node_modules/webpack-cli/bin/cli.js ${option}`, {
        stdio: [null, process.stdout, process.stderr]
    });
}));

My package.json:

{
  "scripts": {
    "postinstall": "npm run package-dev",
    "package-dev": "node ./node_modules/gulp/bin/gulp.js",
    "package-release": "node ./node_modules/gulp/bin/gulp.js --release"
  },
  "Dependencies": {
    "@types/applicationinsights-js": "^1.0.5",
    "@types/jquery": "^2.0.41",
    "@types/knockout": "^3.4.40",
    "@types/react": "^16.0.40",
    "@types/react-dom": "^16.9.1",
    "@types/requirejs": "^2.1.28",
    "del": "^3.0.0",
    "gulp": "^4.0.2",
    "gulp-inline-source": "^4.0.0",
    "gulp-sass": "^4.0.2",
    "gulp-tslint": "^8.1.1",
    "office-ui-fabric-react": "^4.5.0",
    "promise-polyfill": "^8.1.0",
    "requirejs": "^2.3.2",
    "ts-loader": "^4.1.0",
    "tslint": "^5.4.3",
    "typescript": "^3.1.6",
    "vss-web-extension-sdk": "^5.141.0",
    "webpack": "^4.26.1",
    "webpack-cli": "^3.1.2"
  },
  "name": "task-group",
  "private": true,
  "version": "0.7.0",
  "dependencies": {
    "@uifabric/utilities": "^7.2.0",
    "react": "^16.9.0"
  },
  "main": "gulpfile.js",
  "keywords": [],
  "author": "",
  "license": "ISC",
  "description": ""
}

I running npm install and get the following error.

In Terminal Screen:

gulp.task('webpack', gulp.series(async () => { ^ SyntaxError: Unexpected token ( at Object.exports.runInThisContext (vm.js:76:16) at Module._compile (module.js:542:28) at Object.Module._extensions..js (module.js:579:10) at Module.load (module.js:487:32) at tryModuleLoad (module.js:446:12) at Function.Module._load (module.js:438:3) at Module.require (module.js:497:17) at require (internal/module.js:20:19) at execute (C:\Users\Ece\Documents\Projects\Links-Group\node_modules\gulp\node_modules\gulp-cli\lib\versioned\^4.0.0\index .js:36:18) at Liftoff.handleArguments (C:\Users\Ece\Documents\Projects\Links-Group\node_modules\gulp\node_modules\gulp-cli\index.js:2 01:24)

1
What about double tilda `` chars in the end of the line starting with const option... ?Hero Qu

1 Answers

0
votes

I have run the following commands respectively solved the problem.

npm rm -rf node_modules

npm install