DroneShareをビルドしてみる。

###[DroneShareとDroneKit-Cloudサービスが2016/3/31でクローズ](https://github.com/dronekit/droneshare/issues/167)されましたが、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
http://liberty-technology.biz/PublicItems/npm/package.json.html

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


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

この動画が解りやすいです。
[![IMAGE ALT TEXT HERE](http://img.youtube.com/vi/rT2ngZ_idf0/0.jpg)](https://www.youtube.com/watch?v=rT2ngZ_idf0)  

###bowerとは




###AngularJSのインストール
    $sudo npm install -g angular
     + angular@1.7.2
     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 coffee-script@1.12.7: 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
    + coffee-script@1.12.7
    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
    + grunt@1.0.3
    updated 1 package in 2.651s


bowerが入っていなかったのでインストールする。  
`sudo npm install -g bower`

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

    $npm install -g karma grunt-karma
     npm WARN deprecated nodemailer@2.7.2: All versions below 4.0.1 of Nodemailer are deprecated. See 
     https://nodemailer.com/status/
     npm WARN deprecated node-uuid@1.4.8: Use uuid module instead
     npm WARN deprecated socks@1.1.10: 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 socks@1.1.9: 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 mailcomposer@4.0.1: This project is unmaintained
     npm WARN deprecated buildmail@4.0.1: This project is unmaintained
     npm WARN deprecated uws@9.14.0: stop using this version
     /usr/local/bin/karma -> /usr/local/lib/node_modules/karma/bin/karma
     
     > uws@9.14.0 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 grunt-karma@2.0.0 requires a peer of grunt@>=0.4.x but none is installed. You must install 
     peer dependencies yourself.
     npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.2.4 
    (node_modules/karma/node_modules/fsevents):
    npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.2.4: wanted 
    {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})

    + grunt-karma@2.0.0
    + karma@2.0.5
    added 423 packages in 14.506s

    $npm install jasmine-core
     + jasmine-core@3.1.0
     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
     
     > jpegtran-bin@0.2.8 postinstall /usr/local/lib/node_modules/jpegtran-bin
     > node index.js
     
     + jpegtran-bin@0.2.8
     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 graceful-fs@3.0.11: please upgrade to graceful-fs 4 for compatibility with 
     current and future versions of Node.js
     npm WARN deprecated find-file@0.1.4: Use the globby package instead
     /usr/local/bin/optipng -> /usr/local/lib/node_modules/optipng-bin/cli.js
     
     > optipng-bin@0.3.11 postinstall /usr/local/lib/node_modules/optipng-bin
     > node index.js
     
     + optipng-bin@0.3.11
     added 103 packages in 2.908s
     




    $git clone https://github.com/diydrones/droneshare.git
    $cd droneshare
    $npm install
    > optipng-bin@0.3.11 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 grunt-karma@0.8.3 requires a peer of karma@~0.12.0 but none is installed. You must install 
    peer dependencies yourself.
    npm WARN karma-coffee-preprocessor@0.2.1 requires a peer of karma@>=0.11.14 but none is installed. 
    You must install peer dependencies yourself.
    npm WARN karma-jasmine@0.2.3 requires a peer of karma@>=0.9 but none is installed. You must install 
    peer dependencies yourself.
    npm WARN karma-junit-reporter@0.2.2 requires a peer of karma@>=0.9 but none is installed. You must 
    install peer dependencies yourself.
    npm WARN karma-phantomjs-launcher@0.1.4 requires a peer of karma@>=0.9 but none is installed. You 
    must install peer dependencies yourself.
    npm WARN karma-requirejs@0.2.6 requires a peer of karma@>=0.9 but none is installed. You must install 
    peer dependencies yourself.
    npm WARN Droneshare@1.0.0 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'