Build It With Nitrogen Help

Hi, I am working through the sample chapter and am stuck on the following instructions on page 11:

…$ git clone git://github.com/nitrogen/nitrogen
…$ cd nitrogen
…/nitrogen$ make rel_inets PROJECT=testproj

This is what happens when I attempt to do that:

C:\Users\foobar>e:
E:>cd nitrogen
E:\nitrogen>make rel_inets PROJECT=testproj
make[1]: Entering directory ‘/e/nitrogen’
./rebar get-deps
/usr/bin/env: ‘escript’: No such file or directory
make[1]: *** [Makefile:40: get-deps] Error 127
make[1]: Leaving directory ‘/e/nitrogen’
make: *** [Makefile:104: rel_inets] Error 2

I am brand new to Erlang so I have no idea what it is talking about when it refers to

escript

. any ideas?

6 Likes

Welcome @Ookma-Kyi !

escript is a program that comes with Erlang that allows you to run Erlang scripts.

It might be that the makefile provided by Nitrogen there does not work on Windows. I’m not super familiar with Windows scripting but that path in the error message doesn’t look correct to me.

2 Likes

Firstly, I hope you have erlang installed on your system. Secondly, if erlang is installed, then, it seems the erlang escript is not in the $PATH environment variable. From the snipped you have shared you seem to be using windows and I’m not sure about setting the environment variable but have a look at this please.

2 Likes

I added the escript directory to the path and it seemed to be going well at first, but sadly it failed in the end:

E:\nitrogen>make rel_inets PROJECT=testproj
make[1]: Entering directory ‘/e/nitrogen’
./rebar get-deps
==> rel (get-deps)
==> nitrogen (get-deps)
./rebar compile
==> rel (compile)
==> nitrogen (compile)
make[2]: Entering directory ‘/e/nitrogen’
make[2]: Leaving directory ‘/e/nitrogen’


Creating full release in …/testproj with inets


make[2]: Entering directory ‘/e/nitrogen’
make[3]: Entering directory ‘/e/nitrogen’
==> rel (generate)
Copying e:/Program Files/erl-23.0/lib/erl_interface-4.0
Generating “nitrogen/rebar.config”
make[4]: Entering directory ‘/e/nitrogen/rel/nitrogen’
Using Erlang in /e/nitrogen/rel/nitrogen/erts-11.0/bin/erl
{“init terminating in do_boot”,{‘cannot get bootfile’,‘no_dot_erlang.boot’}}
init terminating in do_boot ({cannot get bootfile,no_dot_erlang.boot})

Crash dump is being written to: erl_crash.dump…done
make[4]: *** [Makefile:15: get-deps] Error 1
make[4]: Leaving directory ‘/e/nitrogen/rel/nitrogen’
make[4]: Entering directory ‘/e/nitrogen/rel/nitrogen’
Generating a default cookie in /etc/vm.args
make[4]: Leaving directory ‘/e/nitrogen/rel/nitrogen’
make[4]: Entering directory ‘/e/nitrogen/rel/nitrogen’
cp: cannot stat ‘lib/nitrogen_core/www/*’: No such file or directory
make[4]: *** [Makefile:28: copy-static] Error 1
make[4]: Leaving directory ‘/e/nitrogen/rel/nitrogen’
make[3]: *** [Makefile:314: rel_inner] Error 2
make[3]: Leaving directory ‘/e/nitrogen’
make[2]: *** [Makefile:325: rel_inner_full] Error 2
make[2]: Leaving directory ‘/e/nitrogen’
make[1]: *** [Makefile:214: rel] Error 2
make[1]: Leaving directory ‘/e/nitrogen’
make: *** [Makefile:104: rel_inets] Error 2

Any ideas, very confused about what all this means…

2 Likes

Please note that Windows support in nitrogen is experimental.

And I do hope you were following this guide. Please try to follow the guide & if things fail again, just download the precompiled/packaged binary for Windows directly from here.

5 Likes

Hi @Ookma-Kyi!

I very much appreciate you going through our book! That’s wonderful to hear. But I’m sorry you’re running into issues here.

Indeed, as @lgmfred pointed out, Windows support in Nitrogen is experimental. That’s not to say it doesn’t work in windows (it does), but the build process is a bit tedious and, in my experience, rather fragile.

Generally speaking, the main takeaway from the windows guide (that @lgmfred so kindly linked) is that building Nitrogen projects initially tends to work better (at all?) when it’s being used in an msys (or git for windows) bash environment.

The latest can be gotten from gitforwindows.org.

Once installed (and you have Erlang installed), the make commands should work.

Then, once the release is built, you can usually get away with starting the dev environment with the provided start.cmd file. Then to enable the dev/hot code reloading, just make sure you run sync:go() in the erlang shell.

This will work for a good long while until you need to add rebar dependencies, then you’ll likely want to run make in your project from your msys environment again.

That said, all the examples in Build it with Nitrogen assume a Linux or Unix environment. We should probably include a line warning the user that running the book from Windows can be a bit more challenging.

If you’re comfortable slinging the msys/git-for-windows environment, then by all means, have at 'er (I find that environment challenging myself), or if you’re comfortable using linux subsystem for windows (or whatever it’s called), that could probably work (never really gave it much a try myself).

But I’d much rather myself spin up a Linux VM in VirtualBox and do everything from that or a remote shell than try wrastlin’ with Windows.

6 Likes

Thanks, I’m hoping to win the book, so I am reading the sample chapters meanwhile. The main takeaway I am getting is, like you said, the book is centered mainly around Linux users with not even a mention of Windows users. However, I am persistent and my willingness to learn so far outweighs the issues I have so far.

We should probably include a line warning the user that running the book from Windows can be a bit more challenging.

I think this is a good idea and a very first step for Windows users like myself. I also highly suggest linking to the guide @lgmfred linked to since I managed to get it working using that or even this thread as it contains some very helpful tips and tricks for getting started on Windows.

Quick question though if I have Git SDK for Windows installed, do I still need Git?

3 Likes

No, Git for Windows should include the git installation.

I will also say that the upcoming version of Nitrogen, updated to use rebar3, does handle Windows development a little better. Still not great, but it’s less of a hack than Nitrogen 2’s Windows support.

3 Likes

Sorry i’m new to this, what is rebar?

2 Likes

No problem. Rebar is the Erlang build tool (think npm but for Erlang, if that helps). The current version of Nitrogen still uses the deprecated rebar2, while rebar3 is the current version and Nitrogen support is mostly done, but hasn’t been released yet, until I have all the little bells and whistles working properly for it (including maintaining backwards compatibility for the rebar2 installations of Nitrogen).

The current state of rebar3 work in Nitrogen is all available in the rebar3 branch of the various Nitrogen repositories (the main one being GitHub - nitrogen/nitrogen at rebar3)

Hope that helps.

5 Likes