66
65

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.

AtomにTerm2を入れた時に若干ハマった話

Posted at

Github製エディタのAtomがちょくちょく流行って来てますね。

Atomはパッケージ追加で機能拡張出来るのでターミナルをエディタ内部で動かすことが出来るterm2というパッケージを入れようとしたときの話です。

参考: Term2

##環境

  • Mac os X 10.9
$ apm --version
apm  0.59.0
npm  1.4.4
node 0.10.26

こんな感じです。

##apmコマンドからinstallした際のエラー

$ apm install term2
✗

> pty.js@0.2.4 install /private/var/folders/p2/m_drpl6s76d21shvl3h4njnh0000gn/T/apm-install-dir-11456-17734-1rq00kf/node_modules/term2/node_modules/pty.js
> node-gyp rebuild

  CXX(target) Release/obj.target/pty/src/unix/pty.o

npm http GET https://registry.npmjs.org/atom-term.js/0.0.55
npm http GET https://registry.npmjs.org/debounce/0.0.3
npm http GET https://registry.npmjs.org/keypather
npm http GET https://registry.npmjs.org/fs-plus
npm http GET https://registry.npmjs.org/pty.js
npm http 304 https://registry.npmjs.org/keypather
npm http 304 https://registry.npmjs.org/fs-plus
npm http 304 https://registry.npmjs.org/pty.js
npm http 304 https://registry.npmjs.org/atom-term.js/0.0.55
npm http 304 https://registry.npmjs.org/debounce/0.0.3
npm http GET https://registry.npmjs.org/async
npm http GET https://registry.npmjs.org/mkdirp
npm http GET https://registry.npmjs.org/rimraf
npm http GET https://registry.npmjs.org/underscore-plus
npm http GET https://registry.npmjs.org/nan/0.7.0
npm http GET https://registry.npmjs.org/extend
npm http 304 https://registry.npmjs.org/mkdirp
npm http 304 https://registry.npmjs.org/underscore-plus
npm http 304 https://registry.npmjs.org/rimraf
npm http 304 https://registry.npmjs.org/nan/0.7.0
npm http 304 https://registry.npmjs.org/extend
../src/unix/pty.cc:37:10: fatal error: '/usr/include/util.h' file not found
#include </usr/include/util.h>
         ^
1 error generated.
make: *** [Release/obj.target/pty/src/unix/pty.o] Error 1
gyp ERR! build error 
gyp ERR! stack Error: `make` failed with exit code: 2
gyp ERR! stack     at ChildProcess.onExit (/Applications/Atom.app/Contents/Resources/app/apm/node_modules/atom-package-manager/node_modules/npm/node_modules/node-gyp/lib/build.js:267:23)
gyp ERR! stack     at ChildProcess.EventEmitter.emit (events.js:98:17)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (child_process.js:797:12)
gyp ERR! System Darwin 13.2.0
gyp ERR! command "node" "/Applications/Atom.app/Contents/Resources/app/apm/node_modules/atom-package-manager/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd /private/var/folders/p2/m_drpl6s76d21shvl3h4njnh0000gn/T/apm-install-dir-11456-17734-1rq00kf/node_modules/term2/node_modules/pty.js
gyp ERR! node -v v0.10.26
gyp ERR! node-gyp -v v0.12.2
gyp ERR! not ok 
npm ERR! pty.js@0.2.4 install: `node-gyp rebuild`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the pty.js@0.2.4 install script.
npm ERR! This is most likely a problem with the pty.js package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR!     node-gyp rebuild
npm ERR! You can get their info via:
npm ERR!     npm owner ls pty.js
npm ERR! There is likely additional logging output above.

npm ERR! System Darwin 13.2.0
npm ERR! command "/Applications/Atom.app/Contents/Resources/app/apm/node_modules/atom-package-manager/bin/node" "/Applications/Atom.app/Contents/Resources/app/apm/node_modules/atom-package-manager/node_modules/npm/bin/npm-cli.js" "--globalconfig" "/Applications/Atom.app/Contents/Resources/app/apm/node_modules/atom-package-manager/.apmrc" "--userconfig" "/Users/ryousuke/.atom/.apmrc" "install" "/Users/ryousuke/.atom/.node-gyp/.atom/.apm/term2/0.9.2/package.tgz" "--target=0.11.10" "--arch=x64"
npm ERR! cwd /private/var/folders/p2/m_drpl6s76d21shvl3h4njnh0000gn/T/apm-install-dir-11456-17734-1rq00kf
npm ERR! node -v v0.10.26
npm ERR! npm -v 1.4.4
npm ERR! code ELIFECYCLE
npm http 304 https://registry.npmjs.org/async
npm http GET https://registry.npmjs.org/underscore
npm http 304 https://registry.npmjs.org/underscore
npm ERR! 
npm ERR! Additional logging details can be found in:
npm ERR!     /private/var/folders/p2/m_drpl6s76d21shvl3h4njnh0000gn/T/apm-install-dir-11456-17734-1rq00kf/npm-debug.log
npm ERR! not ok code 0

##解決法
terminalという別のパッケージのissueで似た様な現象発見

$ sudo npm update -g node-gyp
$ sudo rm -rf ~/.atom/.node-gyp
$ xcode-select --install

ここでインストールしますか?みたいに聞かれるのでインストールしましょう。時間が少し掛かります。


完了したらもう一度apm installしましょう

$ apm install term2
Installing term2 to /Users/ryousuke/.atom/packages ✓

これでインストールが出来ると思います。

##使ってみる
Term2に書いてますが
ショートカットキーでターミナルを起動出来ます。

例えば、
control + alt + right(右矢印キー) でページを分割した右側にターミナルを表示
control + alt + t で新規タブにターミナルを表示
など色々あります。

プロジェクトを開いているとそのプロジェクトをカレントディレクトリにしてターミナル起動が出来るのでいちいち cdとlsを繰り返す手間も省けますね。

以上!

PHPStormがあれば...(ry 笑

66
65
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
66
65

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?