Today I played a little bit with Edge.js. I have written new feature to side project that I am working on, run tests locally, all were green - sweeeet. I pushed code to git and… continuous integration process failed. I use Travis for CI with few bash scripts for setting up project. I took a look into logs and I noticed weird error while performing
npm install edge.
make: Entering directory `/home/travis/build/krzkaczor/CobolToCSharpTranslator/node_modules/edge/build' CXX(target) Release/obj.target/edge/src/mono/clractioncontext.o CXX(target) Release/obj.target/edge/src/mono/clrfunc.o CXX(target) Release/obj.target/edge/src/mono/clrfuncinvokecontext.o CXX(target) Release/obj.target/edge/src/mono/edge.o CXX(target) Release/obj.target/edge/src/mono/monoembedding.o ../src/mono/monoembedding.cpp: In static member function ‘static MonoClass* MonoEmbedding::GetIDictionaryStringObjectClass(MonoException**)’: ../src/mono/monoembedding.cpp:108:66: error: ‘mono_reflection_type_get_type’ was not declared in this scope ../src/mono/monoembedding.cpp: In static member function ‘static MonoClass* MonoEmbedding::GetUriClass(MonoException**)’: ../src/mono/monoembedding.cpp:127:66: error: ‘mono_reflection_type_get_type’ was not declared in this scope ../src/mono/monoembedding.cpp: In static member function ‘static MonoClass* MonoEmbedding::GetFuncClass()’: ../src/mono/monoembedding.cpp:173:62: error: ‘mono_reflection_type_get_type’ was not declared in this scope make: *** [Release/obj.target/edge/src/mono/monoembedding.o] Error 1 make: Leaving directory `/home/travis/build/krzkaczor/CobolToCSharpTranslator/node_modules/edge/build'
It was weird mainly because I didn’t find anything helpful about it in Google ;)
I couldn’t reproduce that error on my mac so I have decided to recreate Travis environment. Unfortunately I don’t use yet container based environment and company behind Travis doesn’t provide images of systems that they deploy so I ended up creating my own Ubuntu 12.04 LTS Server Edition 64 bit virtual machine. I ssh’ed to it and started running install scripts. In few minutes I could reproduce that error.
After digging into Edge.js documentation I finally noticed that it requires mono version at least 4 and
apt-get install mono-complete installs version 2.x.x. I guess that error message could be a little bit clearer.
To install newer mono version on Ubuntu 12 I had to add new repositories to apt sources - here’s a little script that does everything:
#!/usr/bin/env bash sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 3FA7E0328081BFF6A14DA29AA6A19B38D3D831EF echo "deb http://download.mono-project.com/repo/debian wheezy main" | sudo tee /etc/apt/sources.list.d/mono-xamarin.list echo "deb http://download.mono-project.com/repo/debian wheezy-libtiff-compat main" | sudo tee -a /etc/apt/sources.list.d/mono-xamarin.list sudo apt-get update sudo apt-get install -y mono-complete
After applying that script
npm install edge should install successfully.