generator-angular icon indicating copy to clipboard operation
generator-angular copied to clipboard

Huge latency (30+ seconds) from livereload.js?snipver=1 on a brand new app

Open randwa1k opened this issue 12 years ago • 1 comments

I followed Yeoman's guide to set up an Angular.js app. When I did grunt serve, there were no errors. Eventually I do get to see the "'Allo, 'Allo" front page, but only after over 30 seconds of latency from livereload.js?snipver=1, which failed to GET. How can this be fixed?

It's quite puzzling as I literally just followed the steps on http://yeoman.io/ 3 days ago (i.e. everything should be up-to-date) and got this, but I haven't found others with this problem from my web search.

This problem is asked on StackOverflow.

I've copied my project repository to github.

Update: I think the culprit is that yo has been running from /usr/local/lib/node_modules, instead of ~/.node/lib/node_modules, since the yo command can't even be found when I removed the node_modules directory in /usr. I've created a new question.


More details:

In the very beginning, I ran a few sudo npm install -g ... in to the default /usr/local/lib/node_modules

/usr/local/lib/node_modules$ ls -alt
total 44
drwxr-xr-x  6 ubuntu root   4096 Feb 17 23:13 ..
drwxr-xr-x 19 ubuntu ubuntu 4096 Feb 17 22:00 generator-angular
drwxr-xr-x 11 ubuntu ubuntu 4096 Feb 17 21:59 .
drwxr-xr-x  4 ubuntu ubuntu 4096 Feb 17 04:27 generator-mocha
drwxr-xr-x  4 ubuntu ubuntu 4096 Feb 17 04:27 generator-webapp
drwxr-xr-x  6 ubuntu ubuntu 4096 Feb 17 04:20 grunt-cli
drwxr-xr-x  4 ubuntu ubuntu 4096 Feb 17 03:54 generator-karma
drwxr-xr-x  4 ubuntu ubuntu 4096 Feb 17 01:33 yo
drwxr-xr-x  7 ubuntu ubuntu 4096 Feb 16 16:09 bower

Then after getting stuck on yo angular because it required root, I read isaccs' advice on how to make npm and yo work without sudo, but I also modified his steps so that every command ran without errors. In the end, the installations moved to ~/.node/lib/node_modules as expected:

~/.node/lib/node_modules$ ls -alt
total 32
drwxr-xr-x 19 nobody ubuntu 4096 Feb 22 01:19 generator-angular
drwxr-xr-x  8 nobody ubuntu 4096 Feb 22 01:19 .
drwxr-xr-x 10 nobody ubuntu 4096 Feb 17 23:15 npm
drwxr-xr-x  4 nobody ubuntu 4096 Feb 17 22:00 yo
drwxr-xr-x  4 nobody ubuntu 4096 Feb 17 22:00 generator-karma
drwxr-xr-x  7 nobody ubuntu 4096 Feb 17 21:57 bower
drwxr-xr-x  6 nobody ubuntu 4096 Feb 17 21:57 grunt-cli
drwxr-xr-x  3 root   root   4096 Feb 17 21:55 ..

As you can see, I ran sudo npm install -g generator-angular (where sudo now goes to ~/.node) again. Then I ran yo angular on a brand new directory. However, I still get this latency problem. I'm going to start over on a new ~/.node.

Here is my $PATH:

$ echo $PATH
/home/ubuntu/local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games

My ~/.bashrc contains export PATH=$HOME/local/bin:$PATH My ~/.npmrc contains prefix = /home/ubuntu/.node

randwa1k avatar Feb 21 '14 01:02 randwa1k

After thinking about it, I determined that it couldn't have been Yeoman or any of my Ubuntu server's fault, because nothing changed after I wiped the machine clean and started over. It wasn't a blocked IP on the browser either, because both Chrome and Firefox had the same problem. It wasn't a blocked IP on my client machine because the problem persisted on another machine.

The light bulb went off when I actually looked into the exact URL livereload was requesting. It was requesting on port 35729, a port I haven't opened up on my AWS EC2 account!

enter image description here

After I opened up that port, it worked flawlessly!

Not Yeoman's fault at all, my bad!

randwa1k avatar Feb 23 '14 16:02 randwa1k