SyntaxError: неожиданный токен в Gulpfile.js - PullRequest
0 голосов
/ 27 сентября 2019

В My Gulpfile.js неисправная часть:

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]
    });
}));

Мой 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": ""
}

Я работаю npm install и получите следующую ошибку.

В окне терминала:

gulp.task ('webpack', gulp.series (async () => {^ SyntaxError: неожиданный токен (в Object.exports.runInThisContext (vm.js: 76: 16) в Module._compile (module.js: 542: 28) в Object.Module._extensions..js (module.js: 579: 10) в Module.load (module.js: 487: 32) в tryModuleLoad (module.js: 446: 12) в Function.Module._load (module.js: 438: 3) в модуле.require (module.js: 497: 17) при 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) в Liftoff.handleArguments (C: \ Users \ Ece \ Documents \ Projects \ Links-Group \ node_modules \ gulp \ node_modules \ gulp-cli \ index.js: 2 01:24)

...