Issue Setting up Development Environment

Hi all,

I’m experimenting with adding some functionality (see “Feature Request: Download Archive”) and have setup a development environment. I have gotten webui.js to work, am able to connect via a web browser, but after logging in via mineos I receive the following message in the console, and then node quits:

Successful login attempt for username: <username>

I have tried logging in as root, same thing. I should note that I’m using a custom directory, to ease development.

Any ideas out there?

Does /var/log/mineos.log show anything?

Thanks for getting back, below is how I’m calling the server and the log file as requested:

hailthemelody@hostname:~/Applications/mineos-node$ sudo node webui.js
base_directory found in mineos.conf, using: /home/hailthemelody/Applications/mineos-node
MineOS webui listening on HTTPS://0.0.0.0:8443
info: Starting up server, using commit: 59d1e76 made commit logging more searchable

At this point I log into the web browser via https://localhost:8443 . It works and passes me to the MineOS interface, but then webserver stops. The below message is in the console after a single blank line:

Successful login attempt for username: hailthemelody
hailthemelody@hostname:~/Applications/mineos-node$

At this point the node webserver stops responding. Log file:

hailthemelody@hostname:~/Applications/mineos-node$ cat /var/log/mineos.log
{“level”:“info”,“message”:“Starting up server, using commit: 59d1e76 made commit logging more searchable\n”,“timestamp”:“2015-10-21T20:31:41.036Z”}
{“date”:“Wed Oct 21 2015 16:32:28 GMT-0400 (EDT)”,“process”:{“pid”:1794,“uid”:0,“gid”:0,“cwd”:"/home/hailthemelody/Applications/mineos-node",“execPath”:"/usr/bin/nodejs",“version”:“v0.10.29”,“argv”:[“node”,"/home/hailthemelody/Applications/mineos-node/webui.js"],“memoryUsage”:{“rss”:72683520,“heapTotal”:53064192,“heapUsed”:19113272}},“os”:{“loadavg”:[0.18701171875,0.13427734375,0.12744140625],“uptime”:1320.476258995},“trace”:[{“column”:15,“file”:“module.js”,“function”:“Function.Module._resolveFilename”,“line”:338,“method”:“Module._resolveFilename”,“native”:false},{“column”:25,“file”:“module.js”,“function”:“Function.Module._load”,“line”:280,“method”:“Module._load”,“native”:false},{“column”:17,“file”:“module.js”,“function”:“Module.require”,“line”:364,“method”:“require”,“native”:false},{“column”:17,“file”:“module.js”,“function”:“require”,“line”:380,“method”:null,“native”:false},{“column”:18,“file”:"/home/hailthemelody/Applications/mineos-node/server.js",“function”:"",“line”:210,“method”:null,“native”:false},{“column”:17,“file”:“events.js”,“function”:“Namespace.emit”,“line”:95,“method”:“emit”,“native”:false},{“column”:10,“file”:"/home/hailthemelody/Applications/mineos-node/node_modules/socket.io/lib/namespace.js",“function”:“Namespace.emit”,“line”:205,“method”:“emit”,“native”:false},{“column”:14,“file”:"/home/hailthemelody/Applications/mineos-node/node_modules/socket.io/lib/namespace.js",“function”:null,“line”:172,“method”:null,“native”:false},{“column”:13,“file”:“node.js”,“function”:“process._tickCallback”,“line”:419,“method”:"_tickCallback",“native”:false}],“stack”:[“Error: Cannot find module ‘userid’”," at Function.Module._resolveFilename (module.js:338:15)"," at Function.Module._load (module.js:280:25)"," at Module.require (module.js:364:17)"," at require (module.js:380:17)"," at Namespace. (/home/hailthemelody/Applications/mineos-node/server.js:210:18)"," at Namespace.emit (events.js:95:17)"," at Namespace.emit (/home/hailthemelody/Applications/mineos-node/node_modules/socket.io/lib/namespace.js:205:10)"," at /home/hailthemelody/Applications/mineos-node/node_modules/socket.io/lib/namespace.js:172:14"," at process._tickCallback (node.js:419:13)"],“level”:“error”,“message”:“uncaughtException: Cannot find module ‘userid’”,“timestamp”:“2015-10-21T20:32:28.088Z”}

Cannot find module ‘userid’

As root, did you make sure to install the most recent dependencies after updating your git repo?

cd /usr/games/minecraft
npm install

Side note, are you building this on OSX?

If so, check the npm install to see if the userid module is just outright failing to build in your environment–there should be plenty of error messages to indicate that is the case.

Thanks for getting back!

No, I am building on Debian 8.1, though I sometimes use the ~/Applications convention from Mac if that’s why you were asking. More on the npm install error below.

If I’m understanding correctly I’m to run npm install from my the git install route, which in my case is /home/hailthemelody/Applications/mineos-node/sudo npm install (not /usr/games/minecraft as you suggested, just for clarity) . I get the following console output when doing so:

hailthemelody@hostname:~/Applications/mineos-node$ sudo npm install
npm WARN package.json daemonize2@0.4.2 No repository field.
/
posix@4.0.0 install /home/hailthemelody/Applications/mineos-node/node_modules/posix
node-gyp rebuild

make: Entering directory ‘/home/hailthemelody/Applications/mineos-node/node_modules/posix/build’
CXX(target) Release/obj.target/posix/src/posix.o
In file included from …/src/posix.cc:1:0:
…/node_modules/nan/nan.h:316:47: error: ‘REPLACE_INVALID_UTF8’ is not a member of ‘v8::String’
static const unsigned kReplaceInvalidUtf8 = v8::String::REPLACE_INVALID_UTF8;
^
posix.target.mk:84: recipe for target ‘Release/obj.target/posix/src/posix.o’ failed
make: *** [Release/obj.target/posix/src/posix.o] Error 1
make: Leaving directory ‘/home/hailthemelody/Applications/mineos-node/node_modules/posix/build’
gyp ERR! build error
gyp ERR! stack Error: make failed with exit code: 2
gyp ERR! stack at ChildProcess.onExit (/usr/share/node-gyp/lib/build.js:267:23)
gyp ERR! stack at ChildProcess.emit (events.js:98:17)
gyp ERR! stack at Process.ChildProcess._handle.onexit (child_process.js:809:12)
gyp ERR! System Linux 3.16.0-4-amd64
gyp ERR! command “nodejs” “/usr/bin/node-gyp” “rebuild”
gyp ERR! cwd /home/hailthemelody/Applications/mineos-node/node_modules/posix
gyp ERR! node -v v0.10.29
gyp ERR! node-gyp -v v0.12.2
gyp ERR! not ok
npm WARN This failure might be due to the use of legacy binary “node”
npm WARN For further explanations, please read
/usr/share/doc/nodejs/README.Debian

npm ERR! posix@4.0.0 install: node-gyp rebuild
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the posix@4.0.0 install script.
npm ERR! This is most likely a problem with the posix package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR! node-gyp rebuild
npm ERR! You can get their info via:
npm ERR! npm owner ls posix
npm ERR! There is likely additional logging output above.

npm ERR! System Linux 3.16.0-4-amd64
npm ERR! command “/usr/bin/nodejs” “/usr/bin/npm” “install”
npm ERR! cwd /home/hailthemelody/Applications/mineos-node
npm ERR! node -v v0.10.29
npm ERR! npm -v 1.4.21
npm ERR! code ELIFECYCLE

userid@0.2.0 install /home/hailthemelody/Applications/mineos-node/node_modules/userid
node-gyp rebuild

make: Entering directory ‘/home/hailthemelody/Applications/mineos-node/node_modules/userid/build’
CXX(target) Release/obj.target/userid/src/userid.o
In file included from …/src/userid.cc:10:0:
…/node_modules/nan/nan.h:328:47: error: ‘REPLACE_INVALID_UTF8’ is not a member of ‘v8::String’
static const unsigned kReplaceInvalidUtf8 = v8::String::REPLACE_INVALID_UTF8;
^
userid.target.mk:84: recipe for target ‘Release/obj.target/userid/src/userid.o’ failed
make: *** [Release/obj.target/userid/src/userid.o] Error 1
make: Leaving directory ‘/home/hailthemelody/Applications/mineos-node/node_modules/userid/build’
gyp ERR! build error
gyp ERR! stack Error: make failed with exit code: 2
gyp ERR! stack at ChildProcess.onExit (/usr/share/node-gyp/lib/build.js:267:23)
gyp ERR! stack at ChildProcess.emit (events.js:98:17)
gyp ERR! stack at Process.ChildProcess._handle.onexit (child_process.js:809:12)
gyp ERR! System Linux 3.16.0-4-amd64
gyp ERR! command “nodejs” “/usr/bin/node-gyp” “rebuild”
gyp ERR! cwd /home/hailthemelody/Applications/mineos-node/node_modules/userid
gyp ERR! node -v v0.10.29
gyp ERR! node-gyp -v v0.12.2
gyp ERR! not ok
npm WARN This failure might be due to the use of legacy binary “node”
npm WARN For further explanations, please read
/usr/share/doc/nodejs/README.Debian

npm ERR!
npm ERR! Additional logging details can be found in:
npm ERR! /home/hailthemelody/Applications/mineos-node/npm-debug.log
npm ERR! not ok code 0
hailthemelody@hostname:~/Applications/mineos-node$

You’re using an old node. Are you able to use a newer one? All the dependencies that are in the current commits are all based off stable node v4.0

You genius! I updated to node v0.12.7 (frmo v0.10.x) and it’s working fine! Thank you :slight_smile:

Note to those out there that at present, Jessie only updates node to version 0.10, so you need to run the following from the below to enable it:

hailthemelody edit: link redacted - please see hexparrot’s more robust solution below

Nodesource offers an easy way to update your Debian repos to download and install the actual stable 4.0 via apt-get.