4

I did some things on our build server, which resulted in Grunt getting updated (oops), and it is now stuck using a new version of grunt-legacy-log-utils, which produces the following:

K:\_work\4\s\Web\node_modules\grunt\node_modules\grunt-legacy-log\node_modules\grunt-legacy-log-utils\node_modules\chalk\index.js:2
const escapeStringRegexp = require('escape-string-regexp');
^^^^^
SyntaxError: Use of const in strict mode.

I have tried manually pulling in an older version globally, as well as specifically adding grunt-legacy-log-utils to the project's package.json file, but it still pulls down the latest version when running npm install during the build.

Is there any way to get around this? Other similar questions on here say I need a new version of Node, but if I do that my build breaks elsewhere (see this question).

Dave Johnson
  • 825
  • 16
  • 27

1 Answers1

8

We encountered this issue as well. Turns out our build agents started using grunt@1.0.3 node_modules/grunt (not sure how or why, it looks like this update to grunt happened 16 days ago, but it just changed on our agents today)

Which appears to rely on: grunt-legacy-log@2.0.0 (hooker@0.2.3, colors@1.1.2, grunt-legacy-log-utils@2.0.1, lodash@4.17.10)

With grunt-legacy-log-utils@2.0.1 which appears to rely on chalk, which appears to rely on: escape-string-regexp (https://www.npmjs.com/package/grunt-legacy-log-utils/v/2.0.1)

We resolved the build issue by specifying grunt@1.0.2 which uses:

grunt-legacy-log@1.0.2 (hooker@0.2.3, colors@1.1.2, grunt-legacy-log-utils@1.0.0, lodash@4.17.10)

After setting the build back to using grunt <1.0.3 the build started working. Hope it helps!

NWS
  • 96
  • 1