gulpjs/gulp-cli

Error: potentially unsafe regular expression

Closed this issue ยท 2 comments

It would appear the regex-not is somewhere in your dependency chain and they just released an update to check for whether or not regular expressions are potentially "unsafe" (may take exponential-time to run).

Unfortunately it looks like they have defaulted to now check for safety by default which has caused the following error in my build:

/usr/local/lib/node_modules/gulp-cli/node_modules/regex-not/index.js:62
    throw new Error('potentially unsafe regular expression: ' + res);
    ^

Error: potentially unsafe regular expression: ^(?:(?!(?:[\[!*+?$^"'.\\/]+)).)+
    at Function.toRegex.create (/usr/local/lib/node_modules/gulp-cli/node_modules/regex-not/index.js:62:11)
    at createTextRegex (/usr/local/lib/node_modules/gulp-cli/node_modules/nanomatch/lib/parsers.js:378:22)
    at Object.<anonymous> (/usr/local/lib/node_modules/gulp-cli/node_modules/nanomatch/lib/parsers.js:14:11)
    at Module._compile (module.js:643:30)
    at Object.Module._extensions..js (module.js:654:10)
    at Module.load (module.js:556:32)
    at tryModuleLoad (module.js:499:12)
    at Function.Module._load (module.js:491:3)
    at Module.require (module.js:587:17)
    at require (internal/module.js:11:18)

I am not even sure where the expression is originating from, but since the change was literally made a few minutes ago I figure it will soon start affecting a lot of gulp-cli users so hopefully this report can help to track down the source of the issue and get it resolved.

This was fixed. jonschlinkert/regex-not#3

Apologies to everyone impacted by this, it was (my) human error.

  • delete node_modules
  • reinstall everything and make sure that npm or yarn don't use cached modules

Thanks! Working again for me now ๐Ÿ‘