Now it separates both removing package-lock json and npm install.
In between those it removes the node_modules folder, verifies cache and cleans it and only then moves to install npm
Now the OSX version is also fixed.
To finish with this, grunt test got changed to npm test, as it seemed to be not a Grunfile error, but an error when npm is trying to call the internal command grunt, as it seemed like it wasn't installed, so instead, I changed it to run npm test and it seems to work perfectly.
An update from the previus pull request:
Now it separates both removing package-lock json and npm install. In between those it removes the node_modules folder, verifies cache and cleans it and only then moves to install npm
Now the OSX version is also fixed.
To finish with this, grunt test got changed to npm test, as it seemed to be not a Grunfile error, but an error when npm is trying to call the internal command grunt, as it seemed like it wasn't installed, so instead, I changed it to run npm test and it seems to work perfectly.