LoginSignup
1
2

More than 5 years have passed since last update.

Tessel2のCLIコマンドインストールとエラー回避

Last updated at Posted at 2016-03-30

Tessel2がそろそろ日本上陸ですね。今回は、まだ手元にデバイスが無くてもできるt2コマンドインストールについてです。

Tessel2

Tessel2は去年注目を浴びたtesselの最新版です。
https://tessel.io/

TesselについてはWeb制作者にもチャレンジできるIoT入門~Tesselの基礎~という記事を以前書いたので、こちらもご覧下さい。

  • Wifiモジュール付属
  • Node.jsでの開発を想定している
  • 拡張モジュールが抽象化されていて、GPIOなどを使わなくてもセンサーを扱うことが可能

などWeb屋向けのIoTデバイスと言っても過言ではないでしょう。

さっそく開発環境をインストールしよう

$ npm install t2-cli -g

このコマンドでt2コマンドがインストールされるはずなんですけど以下のエラーが

/Users/sugawara_nobisuke/.nodebrew/node/v5.7.1/lib
└── (empty)

npm ERR! Darwin 14.5.0
npm ERR! argv "/Users/sugawara_nobisuke/.nodebrew/node/v5.7.1/bin/node" "/Users/sugawara_nobisuke/.nodebrew/current/bin/npm" "install" "-g" "t2-cli"
npm ERR! node v5.7.1
npm ERR! npm  v3.6.0
npm ERR! path /Users/sugawara_nobisuke/.nodebrew/node/v5.7.1/lib/node_modules/.staging/readable-stream-07a6184f
npm ERR! code ENOENT
npm ERR! errno -2
npm ERR! syscall rename

npm ERR! enoent ENOENT: no such file or directory, rename '/Users/sugawara_nobisuke/.nodebrew/node/v5.7.1/lib/node_modules/.staging/readable-stream-07a6184f' -> '/Users/sugawara_nobisuke/.nodebrew/node/v5.7.1/lib/node_modules/t2-cli/node_modules/usb/node_modules/node-pre-gyp/node_modules/npmlog/node_modules/are-we-there-yet/node_modules/readable-stream'
npm ERR! enoent ENOENT: no such file or directory, rename '/Users/sugawara_nobisuke/.nodebrew/node/v5.7.1/lib/node_modules/.staging/readable-stream-07a6184f' -> '/Users/sugawara_nobisuke/.nodebrew/node/v5.7.1/lib/node_modules/t2-cli/node_modules/usb/node_modules/node-pre-gyp/node_modules/npmlog/node_modules/are-we-there-yet/node_modules/readable-stream'
npm ERR! enoent This is most likely not a problem with npm itself
npm ERR! enoent and is related to npm not being able to find a file.
npm ERR! enoent

npm ERR! Please include the following file with any support request:
npm ERR!     /Users/sugawara_nobisuke/n0bisuke/lab/tessel-code/tessel2/npm-debug.log
npm ERR! code 1

調べてたらstackoverflowのQAに行き着きました。

NPM error when trying to install gulp and bower

どうやらnpmのバージョンが関係してそうです。

僕の環境は

  • node v5.7.1
  • npm v3.6.0

という環境なのですが、 npmを2系にすると動くみたいです。

npm install npm@2.14.12

その後もういちど以下コマンドでインストールしたら無事にインストールできました。

$ npm install t2-cli -g

ちなみにnpmも2系だったnode.js v0.12まで戻したら、Node.jsは4.2以上じゃないと使えない、みたいなエラーがでました...

  • Node.js 4.2以上
  • npm 2系

というあまりみない環境じゃないとインストールがこけるみたい...?

何はともあれインストール成功

t2コマンドが使えます。

$ t2

command argument is required

Usage: t2 <command>

command
  install-drivers     Install drivers
  provision           Authorize your computer to control the USB-connected Tessel
  restart             Restart a previously deployed script in RAM or Flash memory (does not rebundle)
  run                 Deploy a script to Tessel and run it with Node
  push                Pushes the file/dir to Flash memory to be run anytime the Tessel is powered, runs the file immediately once the file is copied over
  erase               Erases files pushed to Flash using the tessel push command
  list                Lists all connected Tessels and their authorization status.
  init                Initialize repository for your Tessel project
  wifi                Configure the wireless connection
  key                 Manage ssh keys for connecting to a Tessel
  rename              Change the name of a Tessel to something new
  update              Update the Tessel firmware and openWRT image
  version             Display Tessel's current firmware version
  ap                  Configure the Tessel as an access point
  root                Gain SSH root access to one of your authorized tessels
1
2
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
1
2