DroneShareをビルドしてみる。


DroneShareとDroneKit-Cloudサービスが2016/3/31でクローズされましたが、DroneShareのソースがgithubに残っていたのでビルドしてみようと思います。

環境 version
OS ubuntu 16.04
Nodejs v8.11.3
npm 5.6.2
grunt-cli v1.2.0
grunt v0.4.5
bower 1.8.4

DroneShare

このアプリケーションは100% javascriptで書かれているということなので、Web屋さんの領域もちょっと勉強しながら進めます。
https://github.com/dronekit/droneshare

まずは、普段何も気にすること無く使っているnpm

次にgrunt-cliこれは初めて見ます。

Mavlinkを使って飛行ログをWebサーバへアップロードしてログの可視化や解析ができるみたいです。
詳しくは、DroneShareをビルドして使ってみてから書きたいと思います。

この動画が解りやすいです。

bowerとは

AngularJSのインストール

$sudo npm install -g angular
 + [email protected]
 added 1 package in 0.501s

gifsicleのインストール

sudo apt-get update
sudo apt-get install gifsicle

coffeescriptのインストール

$sudo npm install -g coffee-script
npm WARN deprecated [email protected]: CoffeeScript on NPM has moved to "coffeescript" (no hyphen)
/usr/local/bin/coffee -> /usr/local/lib/node_modules/coffee-script/bin/coffee
/usr/local/bin/cake -> /usr/local/lib/node_modules/coffee-script/bin/cake
+ [email protected]
added 1 package in 0.425s

phantomjsのインストール

sudo apt install phantomjs

DroneShareのビルド手順

下記のパッケージが必要になるので、インストールされていなかればインストールします。

  • Nodejs
  • npm
  • grunt (Install globaly: npm install -g grunt-cli)
  • bower
  • karma

nodejsのバージョンが6.0.0以上でないとgruntのインストールに失敗します。
こちらのサイトを参考にnpmとnodejsのバージョンアップを行いました。
https://www.trifields.jp/how-to-install-node-js-on-ubuntu1604-2680
その後、gruntの再インストール

$sudo npm install -g grunt
/usr/local/bin/grunt -> /usr/local/lib/node_modules/grunt/bin/grunt
+ [email protected]
updated 1 package in 2.651s

bowerが入っていなかったのでインストールする。

sudo npm install -g bower

karmaが入っていなかったのでインストールする。

$npm install -g karma grunt-karma
 npm WARN deprecated [email protected]: All versions below 4.0.1 of Nodemailer are deprecated. See 
 https://nodemailer.com/status/
 npm WARN deprecated [email protected]: Use uuid module instead
 npm WARN deprecated [email protected]: If using 2.x branch, please upgrade to at least 2.1.6 to avoid a 
 serious bug with socket data flow and an import issue introduced in 2.1.0
 npm WARN deprecated [email protected]: If using 2.x branch, please upgrade to at least 2.1.6 to avoid a 
 serious bug with socket data flow and an import issue introduced in 2.1.0
 npm WARN deprecated [email protected]: This project is unmaintained
 npm WARN deprecated [email protected]: This project is unmaintained
 npm WARN deprecated [email protected]: stop using this version
 /usr/local/bin/karma -> /usr/local/lib/node_modules/karma/bin/karma

 > [email protected] install /usr/local/lib/node_modules/karma/node_modules/uws
 > node-gyp rebuild > build_log.txt 2>&1 || exit 0

 sh: 1: cannot create build_log.txt: Permission denied
 npm WARN [email protected] requires a peer of grunt@>=0.4.x but none is installed. You must install 
 peer dependencies yourself.
 npm WARN optional SKIPPING OPTIONAL DEPENDENCY: [email protected] 
(node_modules/karma/node_modules/fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for [email protected]: wanted 
{"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})

+ [email protected]
+ [email protected]
added 423 packages in 14.506s

$npm install jasmine-core
 + [email protected]
 added 1 package in 0.369s


$git clone -b v0.2.8 https://github.com/imagemin/jpegtran-bin.git
$cd jpegtran-bin
$sudo npm install -g
 /usr/local/bin/jpegtran -> /usr/local/lib/node_modules/jpegtran-bin/cli.js

 > [email protected] postinstall /usr/local/lib/node_modules/jpegtran-bin
 > node index.js

 + [email protected]
 updated 1 package in 0.836s

$git clone -b v0.3.11 https://github.com/imagemin/optipng-bin.git
$cd optipng
$sudo npm install -g 
 npm WARN deprecated [email protected]: please upgrade to graceful-fs 4 for compatibility with 
 current and future versions of Node.js
 npm WARN deprecated [email protected]: Use the globby package instead
 /usr/local/bin/optipng -> /usr/local/lib/node_modules/optipng-bin/cli.js

 > [email protected] postinstall /usr/local/lib/node_modules/optipng-bin
 > node index.js

 + [email protected]
 added 103 packages in 2.908s





$git clone https://github.com/diydrones/droneshare.git
$cd droneshare
$npm install
> [email protected] postinstall /home/miyamoto/git/droneshare/node_modules/optipng-bin
> node index.js
npm notice created a lockfile as package-lock.json. You should commit this file.
npm WARN [email protected] requires a peer of karma@~0.12.0 but none is installed. You must install 
peer dependencies yourself.
npm WARN [email protected] requires a peer of karma@>=0.11.14 but none is installed. 
You must install peer dependencies yourself.
npm WARN [email protected] requires a peer of karma@>=0.9 but none is installed. You must install 
peer dependencies yourself.
npm WARN [email protected] requires a peer of karma@>=0.9 but none is installed. You must 
install peer dependencies yourself.
npm WARN [email protected] requires a peer of karma@>=0.9 but none is installed. You 
must install peer dependencies yourself.
npm WARN [email protected] requires a peer of karma@>=0.9 but none is installed. You must install 
peer dependencies yourself.
npm WARN [email protected] No license field.

added 2 packages in 2.502s

$bower install
$grunt bower:install
 Loading "grunt-karma.js" tasks...ERROR
 >> Error: Cannot find module 'karma'