angularjs errors

# error (e.g. in project named projectx)
Running "imagemin:dist" (imagemin) task
Fatal error: Cannot read property 'contents' of undefined
# solution 1
remove node_modules/grunt-contrib-imagemin from projectx
copy node_modules/grunt-contrib-imagemin to projectx from another working project
run again grunt build
# solution 2
comment imagemin in Gruntfile.js:
dist: [
//    'imagemin',

# error
Images are optimized and renamed to something like 8c5d3fdb.logout-16x16.png but not in html too (they are still referenced as e.g. logout-16x16.png).
# solution 1
Patch node_modules\grunt-usemin\lib\htmlprocessor.js:
if (srcfile !== file) {
  self.log(match + ' changed to ' + res);
while(res.indexOf('../images/') > -1){	
	res = res.replace("../","");
return res
# solution 2 (srcFile might be srcfile)
Patch node_modules\grunt-usemin\lib\fileprocessor.js:
var srcFile = filterIn(src);	-> already exisnting line
debug('Let\'s replace ' + src);
while(srcFile.indexOf('../images/') > -1){	
	srcFile = srcFile.replace("../","");
debug('Looking for revved version of ' + srcFile + ' in ', assetSearchPath);

# error (when running "npm install" in project dir)
npm ERR! Error: EACCES, mkdir '/********/.npm/minimatch/1.0.0'
npm ERR!     at Error (native)
npm ERR!  { [Error: EACCES, mkdir '/********/.npm/minimatch/1.0.0']
npm ERR!   errno: -13,
# solution
Run as administrator:
sudo npm install

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.