E
E
Evgeniy Pishelevsky2021-11-06 00:57:27
gulp.js
Evgeniy Pishelevsky, 2021-11-06 00:57:27

Error while building Gulp SyntaxError: Unexpected token, how to fix?

Good day
After reinstalling the system and trying to run gulp, I encountered this error.
I can't figure out what's wrong, before that everything worked.

Here is the error

/home/pishelevsky/Frontend Devoloper/Practic/1Github/Boosted/node_modules/globby/index.js:28
} catch {
^
SyntaxError: Unexpected token {
at new Script (vm.js:51:7)
at createScript (vm .js:136:10)
at Object.runInThisContext (vm.js:197:10)
at Module._compile (internal/modules/cjs/loader.js:618:28)
at Object.Module._extensions..js (internal /modules/cjs/loader.js:665:10)
at Module.load (internal/modules/cjs/loader.js:566:32)
at tryModuleLoad (internal/modules/cjs/loader.js:506:12)
at Function.Module._load (internal/modules/cjs/loader.js:498:3)
at Module.require (internal/modules/cjs/loader .js:598:17)
at require (internal/modules/cjs/helpers.js:11:18

)

const checkCwdOption = (options = {}) => {
  if (!options.cwd) {
    return;
  }

  let stat;
  try {
    stat = fs.statSync(options.cwd)
  } catch {
    return
  }

  if (!stat.isDirectory()) {
    throw new Error('The `cwd` option must be a path to a directory');
  }
};

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Aetae, 2021-11-06
@Pishelevsky

catch (e) {
  return
}

catchwithout, in fact, catching an error - a newfangled feature, few people know how to do it.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question