gruntjs / grunt-cli

Grunt's command line interface.
http://gruntjs.com/
MIT License
706 stars 248 forks source link

v1.5.0 #157

Closed Krinkle closed 1 month ago

Krinkle commented 1 month ago

I can't publish it myself, but suggesting a next release. \cc @vladikoff

vladikoff commented 1 month ago

Published!

prathje commented 1 month ago

Hi, thanks for the new release. I am using the grunt-cli in an old legacy project. Sadly, I got the following error:

/usr/local/lib/node_modules/grunt-cli/node_modules/v8flags/index.js:84
var flags = Array.from(process.allowedNodeEnvironmentFlags);
                   ^
TypeError: Cannot convert undefined or null to object
  at Function.from (native)
  at getFlags (/usr/local/lib/node_modules/grunt-cli/node_modules/v8flags/index.js:84:21)
  at /usr/local/lib/node_modules/grunt-cli/node_modules/v8flags/index.js:142:5
  at /usr/local/lib/node_modules/grunt-cli/node_modules/v8flags/index.js:47:14
  at /usr/local/lib/node_modules/grunt-cli/node_modules/v8flags/index.js:70:14
  at FSReqWrap.oncomplete (fs.js:135:15)

I could hotfix it by pinning the version to 1.4.3, i.e., npm install grunt-cli@1.4.3. I do not think there is any need for you to address this issue, at least not in my case. Just wanted to drop this here in case other people come across a similar error.

Krinkle commented 1 month ago

@prathje This error comes from the Array.from() function. It does not permit passing undefined.

Array.from(undefined);
// [Firefox] Uncaught TypeError: items is undefined
// [Chrome] TypeError: Cannot convert undefined or null to object
// [Node.js] TypeError: Cannot convert undefined or null to object

In https://github.com/gulpjs/v8flags, this is used to pass process.allowedNodeEnvironmentFlags, which the gulpjs/v8flags package assumes is a Set. Per the Node.js process API this property was introduced in Node.js v10. The latest stable Node.js is v22.

grunt-cli 1.4.0+ requires Node.js 10+ (https://github.com/gruntjs/grunt-cli/blob/main/CHANGELOG.md). I'm glad grunt-cli 1.4.3 works for you, but note that if you are running Node.js 9 or older, this is unsupported even on grunt-cli 1.4.3. You are likely to encounter other errors.