Grunt --force fails with node: bad option

Viewed 5069

I have a Grunt task called eslint:jenkins that runs eslint on the project. In the build pipeline I run it as:

grunt eslint:jenkins --force --verbose

I use --force so the grunt will not fail even if the task fails because there are some eslint issues.

When I run this locally everything is fine. When this runs on Jenkins I get the following error:

<path-to-installation>/Node_10/bin/node: bad option: --force

For both local and Jenkins environments the versions are: Node 10.0 and grunt-cli 1.3.1.

I cannot imagine any reason why in one case the --force flag is propagated to Node. Can anybody give me some pointers on where to look at?

3 Answers

Same issue with node 10 and a gulp task with arguments.

./node_modules/.bin/gulp tasks:my-task --myoption=value
[16:14:24] Node flags detected: --myoption=value
[16:14:24] Respawned to PID: 21231

No issue with node 8. Did not try with node 9. There must have been a breaking change somewhere, but I can find any information on this beside this question and https://github.com/gulpjs/gulp/issues/1564

sudo npm install grunt-cli -g

Should output something like:

/usr/local/bin/grunt -> /usr/local/lib/node_modules/grunt-cli/bin/grunt
+ grunt-cli@1.3.2
updated 2 packages in 3.056s

Then grunt --force should work for you.

(Tested on macOS Mojave)

Try using grunt tasks:my-task -myoption=value, it worked for me.

Related