LoginSignup
1
1

More than 3 years have passed since last update.

Atomのterminal-plusパッケージを動くようにする

Posted at

事象

Atomのterminal-plusパッケージをインストール後、terminalを起動しようとしても、真っ暗なままでうんともすんとも言わない。
これをどうにかしたい。

(結論から言うと、たぶん terminusパッケージとか使ったほうが早いと思いますが、備忘として残しておきます)

環境

$ sw_vers                                                                                                      
ProductName:    macOS
ProductVersion: 11.2.3
BuildVersion:   20D91
$ node -v
v14.16.0
$ npm -v
6.14.11

% atom --version
Atom    : 1.55.0
Electron: 6.1.12
Chrome  : 76.0.3809.146
Node    : 12.4.0

% apm show terminal-plus
 terminal-plus
├── 0.14.5
├── https://github.com/jeremyramin/terminal-plus
├── A terminal package for Atom, complete with themes and more.
├── 999044 downloads
└── 709 stars

やったこと

~/.atom/packages/terminal-plusでの作業

  • package.json書き換え
package.json
  "dependencies": {
    "atom-space-pen-views": "^2.1.0",
 // "pty.js": "git+https://github.com/jeremyramin/pty.js.git#28f2667", // この行はを削除
    "node-pty": ">= 0.1.0",                                           // この行を追加
    "term.js": "git+https://github.com/jeremyramin/term.js.git",
    "underscore": "^1.8.3"
  },
  • requireするパッケージを変更
lib/process.coffee
 # pty = require 'pty.js' # こっちはコメントアウトor削除
 pty = require 'node-pty' #読み込むパッケージ名を変更したものを追加
 path = require 'path'
 fs = require 'fs'
 _ = require 'underscore'
 child = require 'child_process'
# (略)

$ npm install $ apm rebuild で事象が解消する。

何をしたか

  • pty.jsはterminal-plusで参照されるパッケージ。その名の通り擬似端末をforkしてくれるもの。
  • こちらはあまりメンテされておらず、最近のnode.jsではビルド1が(少なくとも手元の環境では)上手くいかない。
    • pty.jsが更に参照しているnanのバージョンが古いままで、node10系以降では対応できていなかったり、pty.js自体のコードも古かったり。
  • これを、pty.jsのフォークである node-pty に置き換えてしまう。
    • node-ptyは割とアクティブにメンテされているようにみえるので、こちらを使うのがよさそう。

参考


  1. npm rebuildのこと。 そもそも、apm install terminal-plusの時点でエラーにならずインストール成功したり、terminal-plus起動時に明示的にエラーが出てこないのは何故かは理解できていない。。 

1
1
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
1