Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Update to Grunt causes "Use of const in strict mode" error

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).

like image 905
Dave Johnson Avatar asked Jan 28 '23 23:01

Dave Johnson


1 Answers

We encountered this issue as well. Turns out our build agents started using [email protected] 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: [email protected] ([email protected], [email protected], [email protected], [email protected])

With [email protected] 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 [email protected] which uses:

[email protected] ([email protected], [email protected], [email protected], [email protected])

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

like image 176
NWS Avatar answered Jan 31 '23 08:01

NWS