First up: http://nitrogenproject.com/doc/tutorial.html
I'm working on Fedora 14 with the erlang packages installed.
Fifth screen "Install & Run Nitrogen":
bash-4.1$ bin/nitrogen console
cat: /home/sps/erlang-libs/nitrogen/rel/nitrogen/bin: Is a directory
bin/nitrogen: line 102: /home/sps/erlang-libs/nitrogen/rel/nitrogen/bin: is a directory
Exec: /home/sps/erlang-libs/nitrogen/rel/nitrogen/bin
/home/sps/erlang-libs/nitrogen/rel/nitrogen/erts-5.8.1/bin/erlexec -boot /home/sps/erlang-libs/nitrogen/rel/nitrogen/bin
/home/sps/erlang-libs/nitrogen/rel/nitrogen/releases/2.0.4/nitrogen -embedded -config /home/sps/erlang-libs/nitrogen/rel/nitrogen/etc/app.config -config /home/sps/erlang-libs/nitrogen/rel/nitrogen/etc/inets.config -config /home/sps/erlang-libs/nitrogen/rel/nitrogen/bin: -config dev -config nitrogen -args_file /home/sps/erlang-libs/nitrogen/rel/nitrogen/bin
/home/sps/erlang-libs/nitrogen/rel/nitrogen/etc/vm.args -- console
Root: /home/sps/erlang-libs/nitrogen/rel/nitrogen/bin
/home/sps/erlang-libs/nitrogen/rel/nitrogen
bin/nitrogen: line 128: /home/sps/erlang-libs/nitrogen/rel/nitrogen/bin: is a directory
bin/nitrogen: line 128: exec: /home/sps/erlang-libs/nitrogen/rel/nitrogen/bin: cannot execute: Success
That "Success" at the bottom was difficult to see...
And firefox says "unable to connect"...
And netstat shows nothing listening to port 8000.
Aha! What works is
bash-4.1$ cd bin
/home/sps/erlang-libs/nitrogen/rel/nitrogen/bin
bash-4.1$ ls
dev nitrogen
bash-4.1$ ./nitrogen
Usage: nitrogen {start|stop|restart|reboot|ping|console|attach}
bash-4.1$ ./nitrogen console
Exec: /home/sps/erlang-libs/nitrogen/rel/nitrogen/erts-5.8.1/bin/erlexec -boot /home/sps/erlang-libs/nitrogen/rel/nitrogen/releases/2.0.4/nitrogen -embedded -config /home/sps/erlang-libs/nitrogen/rel/nitrogen/etc/app.config -config /home/sps/erlang-libs/nitrogen/rel/nitrogen/etc/inets.config -args_file /home/sps/erlang-libs/nitrogen/rel/nitrogen/etc/vm.args -- console
Root: /home/sps/erlang-libs/nitrogen/rel/nitrogen
Erlang R14B (erts-5.8.1) [source] [64-bit] [smp:2:2] [rq:2] [async-threads:5] [kernel-poll:true]
Eshell V5.8.1 (abort with ^G)
(nitrogen@127.0.0.1)1>
Slide 10, they don't mention that the "Welcome..." string occurs in two places. Why is that not an expanded variable?
I had aborted out to explore the directory tree from the command line, so I needed to start nitrogen again. Restarting did not automatically reflect the changes, so here we go: sync:go() from the command line:
bash-4.1$ ./nitrogen console
Exec: /home/sps/erlang-libs/nitrogen/rel/nitrogen/erts-5.8.1/bin/erlexec -boot /home/sps/erlang-libs/nitrogen/rel/nitrogen/releases/2.0.4/nitrogen -embedded -config /home/sps/erlang-libs/nitrogen/rel/nitrogen/etc/app.config -config /home/sps/erlang-libs/nitrogen/rel/nitrogen/etc/inets.config -args_file /home/sps/erlang-libs/nitrogen/rel/nitrogen/etc/vm.args -- console
Root: /home/sps/erlang-libs/nitrogen/rel/nitrogen
Erlang R14B (erts-5.8.1) [source] [64-bit] [smp:2:2] [rq:2] [async-threads:5] [kernel-poll:true]
Eshell V5.8.1 (abort with ^G)
(nitrogen@127.0.0.1)1> sync:go().
:: MAKE - site
Recompile: ./src/index
:: MAKE - ./site
:: Done!
ok
That worked.
Slide 11: again, invoking
bin/dev compilefrom its parent directory failed.
But invoking from within the bin directory succeeds:
bash-4.1$ bin/dev compile
cat: /home/sps/erlang-libs/nitrogen/rel/nitrogen/bin: Is a directory
bin/dev: line 60: /home/sps/erlang-libs/nitrogen/rel/nitrogen/bin: is a directory
Node is not running!
bash-4.1$ pwd
/home/sps/erlang-libs/nitrogen/rel/nitrogen
bash-4.1$ cd bin
/home/sps/erlang-libs/nitrogen/rel/nitrogen/bin
bash-4.1$ ./dev compile
:: MAKE - site
Recompile: ./src/index
:: MAKE - ./site
:: Done!
Slide 12: doesn't say where in the file to add those lines; I'm going to guess that
?DEBUG
is on its own line immediately after the -include_libs on the fourth line.Bad guess:
bash-4.1$ cd bin
/home/sps/erlang-libs/nitrogen/rel/nitrogen/bin
bash-4.1$ ./dev compile
:: MAKE - site
Recompile: ./src/index
./src/index.erl:5: syntax error before: ':'
:: Errors!
That looks like a macro expansion. Let's google for an example in other code...
No specific example, but let's try adding this line instead:
-define(DEBUG, 1)
Nope:
bash-4.1$ ./dev compile
:: MAKE - site
Recompile: ./src/index
./src/index.erl:5: redefining macro 'DEBUG'
:: Errors!
Next, I'll try adding
?DEBUG
to the inner_body()
list.
bash-4.1$ ./dev compile
:: MAKE - site
Recompile: ./src/index
:: MAKE - ./site
:: Done!
Promising...
But this is all that came back from a browser refresh:
Internal Server Error
This is what is on the console:
=INFO REPORT==== 13-Jan-2011::16:19:53 ===
DEBUG: index:29
=INFO REPORT==== 13-Jan-2011::16:19:53 ===
{error,throw,
{unanticipated_case_in_render_elements,ok},
[{wf_render_elements,render_elements,2},
{lists,foldl,3},
{wf_render_elements,render_elements,2},
{lists,foldl,3},
{wf_render_elements,render_elements,2},
{wf_render_elements,call_element_render,2},
{wf_render_elements,render_element,1},
{wf_render_elements,render_elements,2}]}
Maybe that was supposed to happen. Try restarting the server...
Same result.
Instead of
?DEBUG
try "?DEBUG"
: renders the page with the literal string ?DEBUG
on it. I suppose ?DEBUG
should be when the analog to an assert fails?Trying
?PRINT(node())
instead of "?DEBUG"
:
=INFO REPORT==== 13-Jan-2011::16:30:29 ===
DEBUG: index:30
"node ( )"
'nitrogen@127.0.0.1'
=INFO REPORT==== 13-Jan-2011::16:30:29 ===
{error,throw,
{unanticipated_case_in_render_elements,ok},
[{wf_render_elements,render_elements,2},
{lists,foldl,3},
{wf_render_elements,render_elements,2},
{lists,foldl,3},
{wf_render_elements,render_elements,2},
{wf_render_elements,call_element_render,2},
{wf_render_elements,render_element,1},
{wf_render_elements,render_elements,2}]}
inner_body()
doesn't seem to like these macros as part of its list argument; how about as an result-ignored function at the beginning of its definition?Much better! Page renders, and console simply says:
DEBUG: index:16
"node ( )"
'nitrogen@127.0.0.1'
Slide 13: first attempt at .emacs config generates
Symbol's function definition is void: erlang-mode
on attempting M-x nitrogen-mode. Try to add erlang mode...Hmmm. Fedora didn't include the emacs erlang mode in the erlang super-package. So:
sudo yum -y install emacs-erlang-el.noarch emacs-erlang.noarch
OK, now its working.
Thanks !
ReplyDeleteI found this page looking for a way to make ./bin/dev works (i had this message about node is not running...). Actually my problem had an other cause (my erl command was printing some stuff (header) before any result so that i had to modify my .erlang to make it work properly)
Anyway, this helps me a lot later with the ?DEBUG point. Erlang is wonderful... such as its lack of documentation for beginners like me ^^
Enjoy