Error when running cssmin:generated #1320

clement-escolano opened this Issue May 15, 2016 · 20 comments


None yet
clement-escolano commented May 15, 2016 edited

Hello !

I created a new app (with yo angular) and then tried to build it with grunt. After installing the test related packages as mentioned here #1218 I encountered an other error which prevents the app from building :

Running "cssmin:generated" (cssmin) task
Warning: Path must be a string. Received undefined Use --force to continue.

I am not sure what I need to do (I am very new to grunt and yo) in order to fix the issue.

Here is my configuration :

Thank you !

PS : sorry if this is not a generator-angular related issue


I have the same problem.
Running "cssmin:generated" (cssmin) task Warning: Path must be a string. Received undefined Use --force to continue. TypeError: Path must be a string. Received undefined


Have you tried running npm update?

clement-escolano commented May 19, 2016 edited

Yes, did it again.
Updated npm, node, yo and generator-angular to latest available version.
I ran yo angular then npm install grunt-karma karma karma-phantomjs-launcher karma-jasmine jasmine-core phantomjs-prebuilt --save-dev then npm update (with no output) then grunt and got the same error.


did you change anything in the generated code before grunt or just ran it like that?


I am also having the same error, with a new install.

clement-escolano commented May 19, 2016 edited

I didn't change anything (neither the grunt file or any other file).
The commands in my message above are the only thing I did when in a new empty directory.
Also tried (after trying to run grunt on the untouched files) to add the cssmin command manually in the grunt file.
Although it works by running grunt cssmin:generated the error still remains when running grunt.

dpointk commented May 23, 2016

Also have the same issue


Ok guys, I was finally able to run it without error. The problem for me was the node version. I was trying to run it using Node version 6.0.0. I installed a node version manager and started using v0.10.45 and grunt ran just fine.

Hopefully someone who understands this better will shed light on which version of node we should be using.


@jangeador Thank you for the solution, it works indeed :)
What is very strange though, is that when I take the files generated with the node v0.10.45 and copy them in my regular computer, it still doesn't work ! This is crazy...


Thanks! The solution worked for me, too.


This worked for me too ... although I'm a little frustrated by that the solution is to downgrade the version of Node.


Is this generator still being supported? It's been so long.


The error is actually on grunt-contrib-cssmin dependency.
You can refer to Link
Go to node_modules/grunt-contrib-cssmin/tasks/cssmin.js and change as what the link states.
It works for me.

kumarneb commented Jul 6, 2016

Thanks @peterkwidjaja ! That fixed it without downgrading node. Hope that change is merged in soon.


Cool, @peterkwidjaja advice also made it work for me on my node version v6.2.2, thanks for the note.


Thanks for this!, the update has fixed it


I fixed this to my project simply updating grunt-contrib-cssmin dependency version on package.json:

From: "grunt-contrib-cssmin": `"^0.12.0"

To: "grunt-contrib-cssmin": "^1.0.2"

Probably good to have this updated on the generator too ;)


THANKS @peterblazejewicz after hours of reading and trying to find a fix that worked.

@aniknafs aniknafs added a commit to aniknafs/generator-angular that referenced this issue Oct 20, 2016
@aniknafs aniknafs fix(deps): update grunt-contrib-cssmin to 1.0.2
Fixes: #1320
@zhx828 zhx828 added a commit to zhx828/iViz that referenced this issue Nov 1, 2016
@zhx828 zhx828 Upgrade grunt-contrib-cssmin
Old version may cause issue
@SBoudrias SBoudrias closed this in #1371 Nov 23, 2016
@andresvia andresvia referenced this issue in udistrital/generator-oas Jan 13, 2017

Hacer que "grunt build" vuelva a funcionar #8


Update the package.json works for me too

"grunt-contrib-cssmin": "^1.0.0",


@peterkwidjaja thnks for the solution

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment