"Scanning source files..." never seems to end #50

pauldacus opened this Issue Sep 17, 2012 · 7 comments

2 participants


I installed nitrogen, and am following the tutorial (http://nitrogenproject.com/doc/tutorial.html). I get to "Install & run nitrogen" part which instructs to recompile by typing:


at the nitrogen console. This immediately returns, but the changes I make to index.erl do not appear.

I then try the next compile method:

bin/dev compile
(I also try "./bin/dev compile" for completeness)

at the bash shell. Although bash returns immediately (there is no signal from nitrogen), the console I have open in another bash window (running the nitrogen console) shows this:

(nitrogen@> Starting Sync (Automatic Code Compiler / Reloader)
Scanning source files...

It appears that something is happening here, but this status msg never stops. The console hangs on this "Scanning..." message forever. And no compiling of the files takes place; I reload & the changes are not there. I have to Ctrl-C to get out of this hung loop of "Scanning...".

Any ideas? I am a erl noob, so it could be me...

I am using Erlang 5.9 (R15B).

The Nitrogen Web Framework for Erlang member

Hi Paul,

I'm not entirely sure why you might be hitting an infinite loop there.

Are you running the installation from the download on the website, or from the latest HEAD on github?



From github.

The Nitrogen Web Framework for Erlang member

Alrighty. In that case, I'll make a small recommendation, since the github is the latest stuff, but things are changing from the old 2.0.3 or whatever documentation that tutorial was written for.

The sync module has since been changed to be a module that watches for changes, rather than something that has to be initiated externally. Now sync:go() starts the scanner, and when files change it automatically recompiles them.

So inside your nitrogen installation, without nitrogen running, do:

$ make
$ nitrogen console
> sync:go().

That will start nitrogen and the sync engine.

Now, with nitrogen running, go ahead and try the following in another terminal:

$ touch site/src/index.erl

And see if your nitrogen installation notices the change to index.erl and recompiles it. It should look something like this:

=INFO REPORT==== 17-Sep-2012::16:58:40 ===
index: Reloaded! (Beam changed.)

Let me know if this fixes it for you.


Cool... That seemed to solve the infinite loop problem:

Root: /home/paul/erlang-scripts/nitrogen/rel/nitrogen
Erlang R15B (erts-5.9) [source] [async-threads:5] [hipe] [kernel-poll:true]

Eshell V5.9  (abort with ^G)
(nitrogen@> sync:go().
Starting Sync (Automatic Code Compiler / Reloader)
Scanning source files...

It appears that it worked... but a reload of the index page does not show my modifications. I try looking for the places I think will hold the static "index.html" file:

paul@boys-laptop:~/erlang-scripts/nitrogen/rel/nitrogen$ ls site/static/
css  images  nitrogen
paul@boys-laptop:~/erlang-scripts/nitrogen/rel/nitrogen$ ls site/static/nitrogen/
bert.js  jquery.js  jquery-ui  jquery-ui.js  livevalidation.js  nitrogen.css  nitrogen.js  spinner2.gif  spinner.gif  www
paul@boys-laptop:~/erlang-scripts/nitrogen/rel/nitrogen$ ls site/static/nitrogen/www/
bert.js  jquery.js  jquery-ui  jquery-ui.js  livevalidation.js  nitrogen.css  nitrogen.js  spinner2.gif  spinner.gif

... but I can't find one. Maybe there isn't one :-) Is a static hml file compiled? Any ideas on why the compile seems to work, but the page remains unchanged?

The Nitrogen Web Framework for Erlang member

The default index page is not a static html file, but is an erlang module defined at site/src/index.erl. If this is not the file you're modifying, then make sure that's what you're editing.

If it is the file you're modifying, make sure that you're making the changes after you've started sync. The message you're seeing of "Scanning source files..." is just an informative message letting you know that the sync application has begun watching the filesystem for changes. When a file is recompiled by sync, you'll see a big informative message.

If you go to http://localhost:8000, does clicking the button do anything?


YES! Awesome. Thanks so much!

Just an FYI: I tried the "bin/dev compile" method w/o the sync:go() process being active. This does seem to have the effect of starting the infinite loop in the nitrogen console:

(nitrogen@> Starting Sync (Automatic Code Compiler / Reloader)
Scanning source files...

No biggie for me, cuz I will just do "sync:go()." at the console. But thought you might be interested...

Thanks again.

The Nitrogen Web Framework for Erlang member

Excellent! Glad it's working. Feel free to keep hitting me or the mailing list with questions as you encounter them :)

I will have to check that out the infinite loop from dev compile. I'll admit, I haven't spent much time in there since sync:go() was updated to automatically update changes.

I'll also have to look into updating the instructions to be more clear about how things are now. There is a big update almost ready, and this should be some documentation that gets updated - if it was unclear for you, it's certainly unclear for others.

Thank you so much for bringing this to my attention.

BTW, great avatar!


PS: I'm going to go ahead and close this issue then, if it's solved!

@choptastic choptastic closed this Sep 17, 2012
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment