Desktop mock setup nodejs problem and docker

#1

Hi everyone!

we are currently exploring ways to use the openrov 2.8 as an educational tool for projects. As we have more students than physical robots I’m interested in setting up “the desktop version” and run the mock setup so that the student can play around and get to know the code.

As the students use their personal pc and have therefore very different platforms I’m trying to generate a docker image. However I’m having some troubling getting everything to work and my guess is that this is due to the version of node.js / npm (I’ve never used node.js before). The closest I’ve gotten to make this


work is with the Dockerfile (node 7.10.0).

FROM debian:jessie

RUN apt update
RUN apt upgrade -y

Install prerequisites

RUN apt install curl -y
RUN apt install wget -y
RUN apt install xz-utils -y
RUN apt install git -y
RUN apt install make g++ -y
RUN apt install bzip2 -y

The python used in some node.js modules

RUN apt install python2.7 python2.7-dev -y

Make python2.7 available under python

RUN ln -sf /usr/bin/python2.7 /usr/local/bin/python

Necessairy directories

RUN mkdir ~/temp ~/.npm-global /usr/local/lib/nodejs ~/github

Add npm modules to path

RUN echo “PATH=~/.npm-global/bin:$PATH\n” >> /etc/profile

Get openrov

RUN cd ~/github && git clone github /OpenROV/openrov-cockpit.git

Get and install node.js

ARG nodeVersion
ENV nodeVersion=7.10.0

RUN cd ~/temp && wget nodejs /dist/v$nodeVersion/node-v$nodeVersion-linux-x64.tar.xz
RUN cd ~/temp && tar -xJvf node-v$nodeVersion-linux-x64.tar.xz -C /usr/local/lib/nodejs
RUN ln -sf /usr/local/lib/nodejs/node-v$nodeVersion-linux-x64/bin/* /usr/local/bin/

RUN npm config set prefix ‘~/.npm-global’

and “install” the cockpit

RUN cd ~/github/openrov-cockpit && npm run deploy:dev

[I had to drop the https:// and .com/.org due to the maximum number of links restriction]

but when executing

USE_MOCK=true HARDWARE_MOCK=true configfile=’~/tmp/rovconfig.json’ pluginsDownloadDirectory=’~/tmp/plugins’ node src/cockpit.js

I get
root@8cfbc90ef2db:~/github/openrov-cockpit# USE_MOCK=true HARDWARE_MOCK=true configfile=’~/tmp/rovconfig.json’ pluginsDownloadDirectory=’~/tmp/plugins’ node src/cockpit.js
{“pid”:6,“hostname”:“8cfbc90ef2db”,“name”:“main”,“level”:50,“time”:1552949142883,“msg”:“PLATFORM: Failed to load platform details for this system: Failed to load platform name”,“v”:1}
{“pid”:6,“hostname”:“8cfbc90ef2db”,“name”:“main”,“level”:50,“time”:1552949142884,“msg”:"Error starting plugins: ",“type”:“Error”,“stack”:“TypeError: Cannot set property ‘name’ of null\n at Promise.try.then (/root/github/openrov-cockpit/src/lib/PluginLoader.js:62:37)\n at tryCatcher (/root/github/openrov-cockpit/node_modules/bluebird/js/release/util.js:16:23)\n at Promise._settlePromiseFromHandler (/root/github/openrov-cockpit/node_modules/bluebird/js/release/promise.js:512:31)\n at Promise._settlePromise (/root/github/openrov-cockpit/node_modules/bluebird/js/release/promise.js:569:18)\n at Promise._settlePromise0 (/root/github/openrov-cockpit/node_modules/bluebird/js/release/promise.js:614:10)\n at Promise._settlePromises (/root/github/openrov-cockpit/node_modules/bluebird/js/release/promise.js:694:18)\n at Promise._fulfill (/root/github/openrov-cockpit/node_modules/bluebird/js/release/promise.js:638:18)\n at Promise._resolveCallback (/root/github/openrov-cockpit/node_modules/bluebird/js/release/promise.js:432:57)\n at Promise._settlePromiseFromHandler (/root/github/openrov-cockpit/node_modules/bluebird/js/release/promise.js:524:17)\n at Promise._settlePromise (/root/github/openrov-cockpit/node_modules/bluebird/js/release/promise.js:569:18)\n at Promise._settlePromise0 (/root/github/openrov-cockpit/node_modules/bluebird/js/release/promise.js:614:10)\n at Promise._settlePromises (/root/github/openrov-cockpit/node_modules/bluebird/js/release/promise.js:690:18)\n at _drainQueueStep (/root/github/openrov-cockpit/node_modules/bluebird/js/release/async.js:138:12)\n at _drainQueue (/root/github/openrov-cockpit/node_modules/bluebird/js/release/async.js:131:9)\n at Async._drainQueues (/root/github/openrov-cockpit/node_modules/bluebird/js/release/async.js:147:5)\n at Immediate.Async.drainQueues (/root/github/openrov-cockpit/node_modules/bluebird/js/release/async.js:17:14)”,“v”:1}
1: node::Abort() [node]
2: 0x12b82c9 [node]
3: v8::internal::FunctionCallbackArguments::Call(void ()(v8::FunctionCallbackInfov8::Value const&)) [node]
4: 0xb46f2c [node]
5: v8::internal::Builtin_HandleApiCall(int, v8::internal::Object**, v8::internal::Isolate
) [node]
6: 0x34f0e04843a7
Aborted (core dumped)

Can anyone help me out? Any insights on which linux/node/npm to use would be very much appreciated.

Thanks in advance!

Have a nice day,
Philipp

0 Likes