Grunt process breaks at certain point generator-angular-fullstack - node.js

Can someone please help me explain what that does. The grunt process produces errors. I need to find out why. What does the "src" do?
imagemin: {
dist: {
files: [{
expand: true,
cwd: '<%= yeoman.client %>/assets/images',
src: '{,*/}*.{png,jpg,jpeg,gif}',
dest: '<%= yeoman.dist %>/public/assets/images'
}]
}
},
///// EDIT ///// Actual Output
Running "svgmin:dist" (svgmin) task
Total saved: 0 B
Done, without errors.
Execution Time (2014-07-12 09:39:26 UTC)
loading tasks 78ms ▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇ 59%
svgmin:dist 54ms ▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇ 41%
Total 132ms
Warning: Running "imagemin:dist" (imagemin) task
Warning: Command failed: Use --force to continue.
Aborted due to warnings.
Execution Time (2014-07-12 09:39:26 UTC)
loading tasks 188ms ▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇ 62%
imagemin:dist 113ms ▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇ 37%
Total 302ms Use --force to continue.
Aborted due to warnings.
///// EDIT 2 //////
With the command "grunt imagemin --verbose --force" I get the following error:
Files: client/assets/images/timeline/jd_small.png -> dist/public/assets/images/timeline/jd_small.png
Options: interlaced, optimizationLevel=3, progressive
Warning: Command failed: Used --force, continuing.
Fatal error: Cannot read property 'contents' of undefined
Not sure what that tells me though.

Ok it turned out that grunt throws an error if the image is corrupt. I opened it in Photoshop saved it and voila grunt worked.
Would be cool if grunt was able to output an error like that....

Related

EPERM during gulp commands

I have a gulpfile that I am using together with Browserify, Babelify and BrowserSync to implement my build workflow. However, I am constantly having problems with EPERM errors in Node.js.
I first had an error in my gulp clean task that used rimraf in order to clean my dist directory. The task would occasionaly throw an error (I was not able to reproduce the error 100% of attempts though). The error was an EPERM that complained about the unlink action for ./dist/app.js. I tried using del instead of rimraf and for some reason it helped.
However, if I run gulp watch and something changes , there is very often this error now:
(node:10740) fs: re-evaluating native module sources is not supported. If you are using the graceful-fs module, please update it to a more recent version.
[22:52:35] Using gulpfile D:\Workspace\milestones\gulpfile.js
[22:52:35] Starting 'clean'...
[22:52:35] Finished 'clean' after 4.2 ms
[22:52:35] Starting 'build-persistent'...
[22:52:37] Finished 'build-persistent' after 1.55 s
[22:52:37] Starting 'watch'...
[22:52:37] Finished 'watch' after 92 ms
[BS] Local URL: http://localhost:3000
[BS] External URL: http://192.168.0.108:3000
[BS] Serving files from: ./
[22:52:48] Starting 'clean'...
[22:52:48] Finished 'clean' after 2.77 ms
[22:52:48] Starting 'build-persistent'...
stream.js:74
throw er; // Unhandled stream error in pipe.
^
Error: EPERM: operation not permitted, open 'D:\Workspace\milestones\dist\app.js'
at Error (native)
The full gulpfile may be seen in the gist here.
I am running Windows 10.
Update: The issue seems to be absent when running gulp build and therefore might be caused by BrowserSync.

Grunt error when running Sails.js app in Amazon ElasticBeanstalk

I am moving a Sails.js app hosted on Heroku to Amazon ElasticBeanstalk. When the application launches, it throws the following Grunt error (pulled from eb logs):
info: Sails <| .-..-.
info: v0.11.5 |\
info: /|.\
info: / || \
info: ,' |' \
info: .-'.-==|/_--'
info: `--'-------'
info: __---___--___---___--___---___--___
info: ____---___--___---___--___---___--___-__
info:
info: Server lifted in `/var/app/current`
info: To see your app, visit http://localhost:8081
info: To shut down Sails, press <CTRL> + C at any time.
debug: --------------------------------------------------------
debug: :: Mon Feb 29 2016 08:21:46 GMT+0000 (UTC)
debug: Environment : development
debug: Port : 8081
debug: --------------------------------------------------------
error: ** Grunt :: An error occurred. **
error:
------------------------------------------------------------------------
>> FileError: '../bower_components/bootstrap/less/grid.less' wasn't found in assets/styles/importer.less on line 9, column 1:
>> 8 // Import Bootstrap
>> 9 #import "../bower_components/bootstrap/less/grid.less";
>> 10 #import "../bower_components/bootstrap/less/mixins.less";
Warning: Error compiling assets/styles/importer.less
Aborted due to warnings.
Running "less:dev" (less) task
------------------------------------------------------------------------
error: Looks like a Grunt error occurred--
error: Please fix it, then **restart Sails** to continue running tasks (e.g. watching for changes in assets)
error: Or if you're stuck, check out the troubleshooting tips below.
error: Troubleshooting tips:
error:
error: *-> Are "grunt" and related grunt task modules installed locally? Run `npm install` if you're not sure.
error:
error: *-> You might have a malformed LESS, SASS, CoffeeScript file, etc.
error:
error: *-> Or maybe you don't have permissions to access the `.tmp` directory?
error: e.g., `/var/app/current/.tmp` ?
error:
error: If you think this might be the case, try running:
error: sudo chown -R 497 /var/app/current/.tmp
The same code runs fine on my local development laptop and on Heroku but not on ElasticBeanstalk. Why is it unable to find the bootstrap files? This being a PaaS, I can't even run the recommended sudo chown command that the log recommended. Also to be clear, I have the following command in my package.json file:
"scripts": {
"postinstall": "bower install; grunt build",
"debug": "node debug app.js",
"start": "node app.js"
}
I have instructed the script to run bower install after the NPM packages are installed in the machine. None of the images in my /assets folder seem to load either. Not sure what's going on. Please help.

Karma test run throwing error on requirejs

I have the below configuration in the karma config file.
frameworks: [
'jasmine',
'requirejs'
],
files: [
//App Bower components
{pattern: 'public/bower_components/**/*', included: false}
.....
// list of files / patterns to exclude
exclude: [
'public/bower_components/**/spec/**/*',
'public/bower_components/**/*spec*.js'
],
with this while running karma, i am getting the below error:
Running "karma:runner" (karma) task
WARN [watcher]: { [Error: EMFILE, readdir '/test-application/public/bower_components/requirejs/tests/commonjs/tests/modules/1.0/absolute/b.js']
errno: 20,
code: 'EMFILE',
path: '/test-application/public/bower_components/requirejs/tests/commonjs/tests/modules/1.0/absolute/b.js' }
Error: EMFILE, readdir '/test-application/public/bower_components/requirejs/tests/commonjs/tests/modules/1.0/absolute/b.js'
Fatal error: Cannot read property 'length' of undefined
I tried to add 'public/bower_components/requirejs/tests//*.js' & 'public/bower_components//tests/**/*.js' in the exclude section but i still get the same error.
Any idea on how to get this working.
The fix for the above seems to be not with karma but with the OSX. I had to do the below
ulimit -n 2560
in my bash_profile to get this to work.

Using Babel option blacklist to exclude es6.classes but getting Fatal error: Bundling failed. undefined during grunt build?

System.config({
defaultJSExtensions: true,
transpiler: "babel",
babelOptions: {
"optional": [
"runtime"
],
"blacklist": ['es6.classes'],
"nonStandard": false
},..................
Added blacklist option but not getting desired result for:
$ grunt build
getting:
Running "bundle" task
Building
Fatal error: Bundling failed. undefined
Is anyone have solution to this problem?

Grunt watch tasks seem to take a very long time

I'm running two simple tasks that run for <100ms each but when run under the watch command the two combined tasks are taking ~8 seconds in total (there seems to be an overhead of 3.5 seconds per task). I'm using it with live-reload for development and I'm finding it very frustrating. I tried setting spawn to false but this seemed to break it and none of the associated tasks were run.
Here's sample output from when a sass file is changed.
>> File "app/styles/main.scss" changed.
File "app/styles/main.css" created.
Done, without errors.
Elapsed time
loading tasks 4ms ▇▇▇▇▇ 9%
sass 1ms ▇▇ 2%
sass:dist 39ms ▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇ 89%
Total 44ms
Completed in 3.862s at Mon Nov 18 2013 17:05:57 GMT+0000 (GMT) - Waiting...
OK
>> File "app/styles/main.css" changed.
Running "copy:styles" (copy) task
Copied 1 files
Done, without errors.
Elapsed time
loading tasks 4ms ▇▇▇▇▇▇▇▇▇▇▇▇ 24%
copy:styles 13ms ▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇ 76%
Total 17ms
Completed in 3.704s at Mon Nov 18 2013 17:06:01 GMT+0000 (GMT) - Waiting...
OK
>> File ".tmp/styles/main.css" changed.
... Reload .tmp/styles/main.css ...
... Reload .tmp/styles/main.css ...
Completed in 0.000s at Mon Nov 18 2013 17:06:01 GMT+0000 (GMT) - Waiting...
Using grunt 0.4.1 (and grunt-cli 0.1.11) on node.js 0.10.20. Running on 2012 Macbook Air (OS X 10.8.5)
After file was changed, watch execute the tasks, but on finished, watch reload the Modules(!) and watched again.
Verbose to see the problem:
grunt tasknamewatch --verbose
I've tried a recursion on the watch task, but no success.
watch: {
...,
tasks: ['sometask', 'watch']
}
An easy solution that worked well, was to use "grunt-este-watch". You can read the required steps here: https://stackoverflow.com/a/33920834/2741005
Yeah, contrib-sass is a lot slower, thought that might have contributed to the problem. The only thing I could suggest is to minimise the amount of watch targets you are running; it looks like you are copying the css from app into tmp and then reloading that? Might be better to save your sass directly into tmp with something like a sass:dev task, that way you only run watch twice. This is how I usually do it:
watch: {
sass: {
files: [
'styles/**/*.scss'
],
tasks: ['sass', 'copy:dev', 'cssmin']
},
css: {
options: {
livereload: true
},
files: [
'dist/css/master.css'
],
tasks: []
}
}
I can't help but think that it is the extra overhead of running copy in a different target altogether, of course you can run as many tasks as you like in that tasks array. :)

Resources