Grunt is insanely slow on a clean yeoman angular-generate setup - angularjs

I'm a grunt newbie. My PC runs Windows 7 x64.
I followed the Yeoman tutorial (on the Yeoman site) and I did not change anything in any of the generated files. Then, I ran
grunt serve
When I change any html file, the grunt process is instantaneous, but when I modify one of the .js or .css files, the process is insanely slow. When I hit save, grunt notices it immediately :
>> File "app\styles\index.css" changed
But there seems to be around 4 long seconds before the next lines appear on the terminal :
Running "newer:copy:styles" (newer) task
Running "copy:styles" (copy) task
Copied 1 files
Running "newer-timestamp:copy:styles:R:\Personnel\Workspaces\web\front\plume\node_modules\grunt-newer\.cache" (newer-timestamp)
task
Running "newer-reconfigure:copy:styles:1" (newer-reconfigure) task
Running "autoprefixer:dist" (autoprefixer) task
Prefixed file ".tmp/styles/index.css" created.
Prefixed file ".tmp/styles/main.css" created.
Done, without errors.
Execution Time (2014-03-21 00:00:19 UTC)
loading tasks 6ms ■■■■■ 9%
newer:copy:styles 9ms ■■■■■■■■ 14%
copy:styles 7ms ■■■■■■ 11%
newer-timestamp:copy:style...odules\grunt-newer\.cache 3ms ■■■ 5%
autoprefixer 1ms ■ 2%
autoprefixer:dist 39ms ■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■ 59%
Total 66ms
... Reload .tmp\styles\index.css ...
... Reload .tmp\styles\main.css ...
Completed in 4.463s at Fri Mar 21 2014 01:00:20 GMT+0100 (Paris, Madrid) -
Waiting...
I'm confused. grunt says it took him 66ms total to run the tasks, but then it says that it took him 4.463s to complete the whole process.
What did I did wrong ? The build is clean, I did nothing else than
yo angular
To scaffold the app... Any idea ?
edit :
spawn: false
Solved my problem. Thanks to the one who brought that up. Even if I use Gulp or webpack nowadays.

There is a spawn option that sometimes make things faster --and also more prone to failing apparently.
From the documentation:
Whether to spawn task runs in a child process. Setting this option to
false speeds up the reaction time of the watch (usually 500ms faster
for most) and allows subsequent task runs to share the same context.
Not spawning task runs can make the watch more prone to failing so
please use as needed.
You would disable the spawn adding a options section inside watch in your Gruntfile.js. Something like this.
watch: {
options: {
spawn: false
},

Related

Zeppelin Disconnect status error

I'm using Zeppelin 0.70. I can build zeppelin from git source. when i trying to start zeppelin on that port 8000 by using below command, it works good.
./zeppelin-daemon start
But It won't work after grunt serve command on the port 9000, but it started good and it shows web socket disconnected error.
[root#sandbox zeppelin-web]# ./grunt serve
Running "serve" task
Running "clean:server" (clean) task
Cleaning .tmp...OK
Running "wiredep:app" (wiredep) task
Running "wiredep:test" (wiredep) task
Running "concurrent:server" (concurrent) task
Running "copy:styles" (copy) task
Copied 16 files
Done, without errors.
Execution Time (2017-02-24 05:51:45 UTC)
loading tasks 277ms ▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇ 91%
copy:styles 28ms ▇▇▇▇▇ 9%
Total 305ms
Running "postcss:dist" (postcss) task
>> 16 processed stylesheets created.
Running "connect:livereload" (connect) task
Started connect web server on http://0.0.0.0:9000
Running "watch" task
Waiting...
I got log in console;
XMLHttpRequest cannot load http://localhost:8080/api/security/ticket. No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://localhost:9000' is therefore not allowed access. The response had HTTP status code 404.
Where do i change 8080 to 8000.
Please tell me how do i resolve this issue.
I think grunt was substituted with npm in 0.7 release, so could you try npm run dev command?
Update: There's ongoing issue under ZEPPELIN-2154 related to it. In order to fix it in your case you could remove 3 lines in here of if statement and substitute it with port = 8000; in your source code. it could be temporary fix until patch is filed to make it configurable.

How to trigger a batch file in Jenkins without waiting for batch execution results and status

I have a Jenkins job which is building /packaging/ deploying .NET project. I use "Clean Before checkout" git property for each build.
Finally, I'm executing a batch file. This batch file scanning sonar Qube MSBuild, c# analysis and update the code quality results. But It is taking a long time and I don't want to increment Jenkins job's total execution time from 1 minute to 5 minutes. Developers are thinking so the deployment is taking a long time and not finished yet.
I want to run this batch file independent from the Jenkins job and don't want to see the console output in Jenkins. How could I do this without creating a new Jenkins job for each Jenkins project (upstream/downstream projects)
you need to use the start cmd command,for example:
start YourBatch.bat
This will open a new CMD window and Jenkins won't wait for result.
Bare in mind that if you get an exit code different than 0, it won't fail the build.

angular fullstack generator grunt serve ERR_CONNECTION_REFUSED

I'm building a project on a yeoman angular-fullstack generator. It's been a quite a while and the landing page was correctly loading after running grunt serve task.
I really don't know what I've done but now when I run grunt serve I see ERR_CONNECTION_REFUSED message in chrome first and then the landing page loads normally(about 5 seconds after ERR_CONNECTION_REFUSED message)
This makes my e2e tests crash.
found some issues on github about grunt-concurrent downgrading and disabling livereload but nothing helps..
This is the log. As you see express server has to start listening before open server and watch tasks( newly created fullstack-generator does that so it works correctly)
Running "serve" task
Running "clean:server" (clean) task
>> 1 path cleaned.
Running "env:all" (env) task
Running "concurrent:pre" (concurrent) task
Running "ngconstant:app" (ngconstant) task
Creating module serviceboxApp.constants at client/app/app.constant.js...OK
Done, without errors.
Execution Time (2016-02-26 00:40:08 UTC)
loading tasks 302ms ▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇ 85%
loading grunt-ng-constant 34ms ▇▇▇▇ 10%
ngconstant:app 19ms ▇▇ 5%
Total 356ms
Running "concurrent:server" (concurrent) task
Running "newer:babel:client" (newer) task
Running "babel:client" (babel) task
Running "newer-postrun:babel:client:1:/Users/apple/Desktop/dev/servicebox/node_modules/grunt-newer/.cache" (newer-postrun) task
Done, without errors.
Execution Time (2016-02-26 00:40:09 UTC)
loading tasks 312ms ▇▇▇▇▇▇▇ 15%
newer:babel:client 36ms ▇ 2%
loading grunt-babel 415ms ▇▇▇▇▇▇▇▇▇ 20%
babel:client 1.2s ▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇ 61%
Total 2s
Running "injector:scripts" (injector) task
Missing option `template`, using `dest` as template instead
Injecting js files (33 files)
Running "injector:css" (injector) task
Missing option `template`, using `dest` as template instead
Injecting css files (9 files)
Running "wiredep:client" (wiredep) task
Running "postcss:dist" (postcss) task
Running "express:dev" (express) task
Starting background Express server
Debugger listening on port 5858
[TypeError: Cannot read property 'Kerberos' of undefined]
Running "wait" task
>> Waiting for server reload...
Done waiting!
Running "open:server" (open) task
Running "watch" task
Waiting...
Express server listening on 9000, in development mode
finished populating users
finished populating quotes
finished populating poviders
You have TypeError that is preventing your code from running properly. [TypeError: Cannot read property 'Kerberos' of undefined]
You don't know JS explains that a TypeError "implies that Scope resolution was successful, but that there was an illegal/impossible action attempted against the result."
So you need to go back to where you are calling Kerberos and resolve the TypeError

Android build fails in codenameone build sever

My android build fails after build and this is the error log i get
Total time: 1 mins 16.631 secs
Stopped 0 compiler daemon(s).
Received result Failure[value=org.gradle.initialization.ReportedException: org.gradle.internal.exceptions.LocationAwareException: Execution failed for task ':dexRelease'.] from daemon DaemonInfo{pid=5907, address=[10331ba5-2501-41cc-aa13-52a0ba46bd51 port:41817, addresses:[/0:0:0:0:0:0:0:1%1, /127.0.0.1]], idle=false, context=DefaultDaemonContext[uid=2862cb6d-50e8-4321-a1fa-590435e89f0f,javaHome=/usr/java/jdk1.7.0_67,daemonRegistryDir=/home/ec2-user/.gradle/daemon,pid=5907,idleTimeout=120000,daemonOpts=-XX:MaxPermSize=512m,-XX:+HeapDumpOnOutOfMemoryError,-Xmx1500m,-Dfile.encoding=UTF-8,-Duser.country=US,-Duser.language=en,-Duser.variant]} (build should be done).
This is probably related to this: https://www.codenameone.com/blog/video-new-defaults-barcode-qrcode-changes.html
You can workaround this by using android.gradle=false in the build hints. However, I'm guessing its related to some cn1lib or build hint you added. But it seems the build error log you provided is partial so I don't see any issue there.

parallel builds in jenkins

I just installed the "Build Flow" plugin ver 0.7 and i seem to have issues getting it to work. I configured 2 simple jobs (JOB1 and JOB2). Then another jenkins job which i named "parallel_build} that basically calls this job to build them in parallel.
In the "Define build flow using flow DS" section i have the following
parallel ( {buildIJOB1)}, {build(JOB2)} )
when i execute "parallel_build" job, the console output print the following msg and return a build faillure
parallel {
}
Notifying upstream projects of job completion
Finished: FAILURE
It does not seem to be executing the jobs i intend to run in parallel. The two jobs (JOB1 and JOB2 are pretty simple. All they do is print hello msg.
I appreciate any help in advance.
Jenny
Never mind folks. Upgrading to the latest jenkins version (1.501) from 1.447 fixed the issue. It's all good now.
try this syntax
parallel(
{build("JOB1")},
{build("JOB2")}
)

Resources