10
14

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

らずぱいで、VisualStudioCode (ビルドして、実行)

Last updated at Posted at 2016-07-01

rpi_vscode1.png

インストール

wget -O - https://code.headmelted.com/installers/apt.sh | sudo bash

実行 | メニュー Programming > Code - OSS

code-oss



## 環境
- Raspberry Pi 2/3
- `2017-04-10-raspbian-jessie.img`
- <del>`2016-05-27-raspbian-jessie.img`</del>

## 手順
1. いつもの...
    - Raspbianを焼く. (`ssh`ファイル作成?)
    - パッケージ類更新: `sudo apt-get update && sudo apt-get upgrade -y`
2. `sudo apt-get install libx11-dev libxkbfile-dev`<br>必要なパッケージ類取得
3. nodeのインストール (nvm使用して、nodeのLTS版を入れる)

    ```bash
# nvmインストール
wget -qO- https://raw.githubusercontent.com/creationix/nvm/v0.33.2/install.sh | bash && source ~/.bashrc
# node LTS版をインストール. v6.11.0(6月22日現在)
nvm install --lts
  1. vscode
    1. ソース取得

git clone https://github.com/Microsoft/vscode.git
cd vscode


    3. `./scripts/npm.sh install --arch=armhf`<br>必要なnodeパッケージ取得・ビルド

        ```shell-session
pi@raspberrypi:~/vscode $ time ./scripts/npm.sh install
.
.
real    29m11.355s
user    8m9.320s
sys    0m42.300s
4. `./scripts/code.sh` <br>ビルド・実行
  • alias code='$HOME/vscode/.build/electron/electron $HOME/vscode'
    とかエイリアス、はっとくといいかも?

rpi_vscode2.png


以下、(2016年7月くらいの?)古い情報

その他 

  1. 実行時ワーニング => ハテ?

pi@raspberrypi:~/vscode $ LANG=C code
bash: cannot set terminal process group (-1): Inappropriate ioctl for device
bash: no job control in this shell
pi@raspberrypi:~/vscode $ LANG=ja_JP.UTF-8 code
bash: 端末プロセスグループを設定できません (-1): デバイスに対する不適切なioctlです
bash: このシェルではジョブ制御が無効になっています
pi@raspberrypi:~/vscode $

2. 本体接続のディスプレイのみ??
    - VNCとか、Xでほかの端末にウィンドウをとばす(`DISPLAY=hoge:1.0`みたいな)とかできなかった
3. `asar` でアーカイブしたものが、つかえない

    ```shell-session
pi@raspberrypi:~/vscode $ ./scripts/npm.sh isntall asar
asar@0.11.0 node_modules/asar
├── chromium-pickle-js@0.1.0
├── commander@2.9.0 (graceful-readlink@1.0.1)
├── minimatch@3.0.2 (brace-expansion@1.1.5)
├── glob@6.0.4 (once@1.3.3, inflight@1.0.5)
├── cuint@0.2.1
└── mksnapshot@0.3.0 (fs-extra@0.26.7, request@2.55.0, decompress-zip@0.3.0)
pi@raspberrypi:~/vscode $ ./node_modules/.bin/asar . vscode.asar
pi@raspberrypi:~/vscode $ .build/electron/electron ./vscode.asar 
Error opening app
The app provided is not a valid Electron app, please read the docs on how to write one:
https://github.com/electron/electron/tree/v0.37.6/docs

    Error: Cannot find module '/home/pi/vscode/vscode.asar'
pi@raspberrypi:~/vscode $ ls -l ./vscode.asar 
-rw-r--r-- 1 pi pi 410301090  7月  1 14:41 ./vscode.asar
pi@raspberrypi:~/vscode $ 
  1. electron-packagerは、--arch=armhfに対応していない(インテル系のみ)

pi@raspberrypi:~/vscode $ ./scripts/npm.sh isntall electron-packager
electron-packager@7.1.0 node_modules/electron-packager
├── rcedit@0.5.0
├── run-series@1.1.4
├── electron-osx-sign@0.3.1
├── fs-extra@0.28.0 (jsonfile@2.3.1, klaw@1.3.0)
├── resolve@1.1.7
├── get-package-info@0.0.2 (lodash.get@4.3.0, bluebird@3.4.1)
├── extract-zip@1.5.0 (debug@0.7.4, yauzl@2.4.1, concat-stream@1.5.0, mkdirp@0.5.0)
├── electron-download@2.1.2 (path-exists@1.0.0, home-path@1.0.3, rc@1.1.6, mv@2.1.1, nugget@1.6.2)
└── plist@1.2.0 (util-deprecate@1.0.2, base64-js@0.0.8, xmldom@0.1.22, xmlbuilder@4.0.0)
pi@raspberrypi:~/vscode $ ./node_modules/.bin/electron-packager . --platform=linux --arch=armhf
Unsupported arch armhf; must be one of: ia32, x64
pi@raspberrypi:~/vscode $


5. `libx11-dev`が入ってないと、ヘッダがないとおこられる

    ```
make: Entering directory '/home/pi/vscode/node_modules/native-keymap/build'
  CXX(target) Release/obj.target/keymapping/src/string_conversion.o
  CXX(target) Release/obj.target/keymapping/src/keymapping.o
  CXX(target) Release/obj.target/keymapping/deps/chromium/x/keysym_to_unicode.o
../deps/chromium/x/keysym_to_unicode.cc:35:19: fatal error: X11/X.h: そのようなファイルやディレクトリはありません
 #include <X11/X.h>
                   ^
compilation terminated.
  1. (未確認) らずぱいZERO / 1は、node-v4.4.7-linux-armv6l.tar.gz(armv6l)というのを使えばいいかも?

前に記述していた方法

  • nodeのインストール
    • Ver4.4.7を/usr/localにこぴーしてしまう簡単な方法なので、環境がよごされる、とおもうなら、nvmとかを使うほうがいいかと

wget https://nodejs.org/dist/v4.4.7/node-v4.4.7-linux-armv7l.tar.gz
tar xf node-v4.4.7-linux-armv7l.tar.gz
cd node-v4.4.7-linux-armv7l
sudo cp -vR {bin,include,lib,share} /usr/local/

    -  (追記) `nvm`使用時<br>

        ```bash
curl -o - https://raw.githubusercontent.com/creationix/nvm/master/install.sh | bash && source ~/.bashrc
nvm ls-remote ## 使えるnode version表示
nvm install v4.4.7
# nvm install v6.2.2   # とか?
nvm ls # ローカルにあるversion
nvm use v4.4.7  # つかうVer指定.
  • 修正の必要がなくなった
    2. 修正
    vi ./npm-shrinkwrap.json

      ```json:npm-shrinkwrap.json
    

... # 以下を削除
"fsevents": {
"version": "0.3.8",
"from": "fsevents@>=0.3.1 <0.4.0",
"resolved": "https://registry.npmjs.org/fsevents/-/fsevents-0.3.8.tgz"
},
...

10
14
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
10
14

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?