My project is a pretty basic yo/angular project. I have the following cssmin config.
useminPrepare: {
html: '<%= yeoman.app %>/index.html',
options: {
dest: '<%= yeoman.dist %>',
flow: {
html: {
steps: {
js: ['concat', 'uglifyjs'],
css: ['cssmin']
},
post: {}
}
}
}
},
...
cssmin: {
dist: {
files: {
'<%= yeoman.dist %>/styles/main.css': [
'.tmp/styles/{,*/}*.css'
]
}
}
},
...
grunt.registerTask('build', [
'clean:dist',
'wiredep',
'useminPrepare',
'concurrent:dist',
'autoprefixer',
'concat',
'ngAnnotate',
'copy:dist',
'cdnify',
'cssmin',
'uglify',
'filerev',
'usemin',
'htmlmin'
]);
when I run grunt build i get the following error:
Running "cssmin:generated" (cssmin) task
Warning: Path must be a string. Received undefined Use --force to continue.
Aborted due to warnings.
Execution Time (2016-05-26 00:57:04 UTC)
concurrent:dist 15s
autoprefixer:server 3.3s
ngAnnotate:dist 3.6s
cdnify:dist 10.7s
cssmin:dist 888ms
Total 34.6s
I have seen this error on other posts, but not with cssmin. I have upgraded my libraries in package.json to the latest, which could be the cause.
This project was building fine at one time. I can't determine what path is missing. Does anyone know what path I'm missing?
Actually that problem is fixed, please update your version for the v1.0.2 link here
The answer referred to in the above replies worked for me.
So in node_modules/grunt-contrib-cssmin/tasks/cssmin.js, on line 41, add an or empty string to the parameter:
//before
options.relativeTo = path.dirname(availableFiles[0]);
//after
options.relativeTo = path.dirname(availableFiles[0] || '');
From: https://github.com/gruntjs/grunt-contrib-cssmin/pull/271/commits/11e655873dfa58b6edcda0113cee612f7a6b2ab9?diff=split
EDIT: Answer is now obsolete, see https://stackoverflow.com/a/39482214/1215723 below
More info running the verbose option:
youri$ grunt -v
Running "cssmin:generated" (cssmin) task
Verifying property cssmin.generated exists in config...OK
Files: [no src] -> dist/styles/vendor.css
Files: .tmp/styles/main.css -> dist/styles/main.css
Options: rebase=false, report="min", sourceMap=false
Warning: Path must be a string. Received undefined Use --force to continue.
Looks like we are not alone. By following the issue breadcrumbs, I found:
The suggested workaround is to downgrade to node v5, and indeed, it works (for me). You can also install a node version manager if you find it more convenient.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With