在ansi-term中安装npm包时搞砸了进度条

时间:2014-02-14 17:38:40

标签: emacs npm

我使用ansi-term来满足我的所有npm和yeoman需求,因为它有时会显示shell模式无法处理的对话框。它工作得很好,直到我安装了一个包,它出现了一个混乱的下载进度条。请原谅丑陋的输出,但看起来像这样:

  

pngquant-bin@0.1.6 postinstall / Users / avendael / tmp / yo-angular / node_modules / pngquant-bin   node lib / check.js

     

pngquant:下载[] 3%0.0s pngquant:   下载[] 3%0.2s pngquant:下载[
  ] 6%6.7s pngquant:下载[] 6%6.2s
  pngquant:下载[=] 9%8.2s pngquant:   下载[=] 10%7.6s pngquant:下载[=   ] 12%7.6s pngquant:下载[==
           ] 13%8.2s pngquant:下载[==] 15%7.0s pngquant:下载[==] 16%6.9s pngquant:下载[===] 19%6.8s pngquant:   下载[===] 19%7.1s pngquant:下载   [===] 22%6.5s pngquant:下载[====
  ] 23%6.2s pngquant:下载[====] 25%6.4s
  pngquant:下载[====] 26%6.3s pngquant:   下载[=====] 28%5.9s pngquant:下载   [=====] 29%6.3s pngquant:下载[=====
  ] 31%6.0 pngquant:下载[=====] 32%5.9s
  pngquant:下载[======] 34%5.7s pngquant:   下载[======] 36%5.6s pngquant:下载   [=======] 38%5.5s pngquant:下载[=======
  ] 39%5.3s pngquant:下载[=======] 41%5.2s
  pngquant:下载[=======] 42%5.1s pngquant:   下载[=======   =] 44%4.9s pngquant:下载[========] 45%4.7s pngquant:下载[========] 47%4.6s
  pngquant:下载[=========] 49%4.5s pngquant:   下载[=========] 50%4.3s pngquant:下载   [=========] 52%4.1s pngquant:下载[==========
  ] 53%4.0s pngquant:下载[==========] 55%3.8s
  pngqua nt:下载[==========] 57%3.7s pngquant:   下载[===========] 58%3.5s pngquant:下载   [===========] 60%3.4s pngquant:下载[===========
  ] 62%3 .2s pngquant:下载[============] 63%3.1s
  pngquant:下载[============] 65%2.9s pngquant:   下载[============] 66%2.8s pngquant:下载   [=============        ] 68%2.6s pngquant:下载[=============] 69%2.5s pngquant:下载[=============] 71%2.3s pngquant :   下载[==============] 73%2.2s pngquant:下载[==   ============] 75%2.0s pngquant:下载[==============] 76%1.9s pngquant:下载[====== =========] 78%1.7s
  pngquant:下载[===============] 79%1.6s pngquant:dow   nloading [===============] 81%1.4s pngquant:下载   [===============] 82%1.3s pngquant:下载   [================] 84%1.2s pngquant:下载   [================] 85%1.1s p ngquant:下载   [=================] 92%0.6s pngquant:下载   [===================] 98%0.1s pngquant:下载   [===================] 100%0.0s

     

✓预构建测试成功通过pngquant-bin@0.1.6   node_modules / pngquant槽

我在一个终端上尝试了它,它看起来像一个正常的进度条,当下载继续时,条形图向右移动。

我也试过在shell模式下安装相同的包,输出(再次,原谅丑陋)看起来像这样:

  

pngquant-bin@0.1.6 postinstall / Users / avendael / tmp / yo-angular / node_modules / pngquant-bin   node lib / check.js

     

[1G [0J [1G pngquant:正在下载[] 3%   0.0s [1G [0J [1G pngquant:下载[] 3%0.2s [1G [0J [1G pngquant:下载[] 6%8.7s [1G [0J [1G pngquant:下载[] 6%8.0s [1G [ 0J [1G pngquant:下载[=] 9%6.2s [1G [0J [1G pngquant:下载[=] 10%5.7s [1G [0J [1G pngquant:下载[=] 12%4.9s [1G [0J [ 1G pngquant:下载[==] 13%4.6s [1G [0J [1G pngquant:下载[==] 15%6.2s [1G [0J [1G pngquant:下载[==] 16%5.9s [1G [0J] [1G pngquant:下载[===] 19%5.3s [1G [0J [1G pngquant:下载[===] 19%5.0s [1G [0J [1G pngquant:下载[===] 22%4.6s [1G [0J [1G pngquant:下载[====] 23%4.4s [1G [0J [1G pngquant:下载[====] 25%6.1s [1G [0J [1G pngquant:下载[== ==] 26%5.8s [1G [0J [1G pngquant:下载[===== ] 32%4.4s [1G [0J [1G pngquant:下载[=======] 39%3.3s [1G [0J [1G pngquant:下载[=======] 41%3.2s [ 1G [0J [1G pngquant:下载[=======] 42%3.1s [1G [0J [1G pngquant:下载[========] 44%2.9s [1G [0J [1G] pngquant:下载[========] 45%2.8s [1G [0J [1G pngquant:下载[========] 47%2.7s [1G [0J [1G pngquant:正在下载] =========] 49%2.6s [1G [0J [1G pngquant:下载[=========] 50%2.5s [1G [0J [1G pngquant:下载[== =======] 52%2.5s [1G [0J [1G pngquant:下载[==========] 53%2.4s [1G [0J [1G pngquant:正在下载[=== =======] 55%2.2s [1G [0J [1G pngquant:下载[==========] 57%2.1s [1G [0J [1G pngquant:下载[=== ========] 58%2.0s [1G [0J [1G pngquant:下载[===========] 60%2.0s [1G [0J [1G pngquant:下载[= ==========] 62%1.9s [1G [0J [1G pngq uant:下载[============] 63%1.8s [1G [0J [1G pngquant:下载[============] 65%1.7s [1G] [0J [1G pngquant:下载[============] 66%1.6s [1G [0J [1G pngquant:下载[=============] 68 %1.5s [1G [0J [1G pngquant:下载[=============] 69%1.5s [1G [0J [1G pngquant:下载[========= ====] 71%1.3s [1G [0J [1G pngquant:下载[==============] 73%1.3s [1G [0J [1G pngquant:下载[== ============] 75%1.2s [1G [0J [1G pngquant:下载[==============] 76%1.1s [1G [0J] [1G pngquant:下载[===============] 78%1.0s [1G [0J [1G pngquant:下载[============== =] 79%1.0s [1G [0J [1G pngquant:下载[===============] 81%0.9s [1G [0J [1G pngquant:下载[==== ===========] 82%0.8s [1G [0J [1G pngquant:下载[================] 84%0.7s [1G [ 0J [1G pngquant:下载[================] 85%0.7s [1G [0J [1G pngquant:下载[============ =====] 88%0.6s [1G [0J [1G pngquant:下载[=================] 88%0.5s [1G [0J [1G pngquant:下载[==== =============] 91%0.4s [1G [0J [1G pngquant:下载[=================] 92%0.4s [1G [0J [1G pngquant:下载[==================] 94%0.3s [1G [0J [1G pngquant:下载[======= ===========] 95%0.2s [1G [0J [1G pngquant:下载[==================] 97%0.1s [ 1G [0J [1G pngquant:下载[===================] 98%0.1s [1G [0J [1G pngquant:正在下载[======= ============] 100%0.0s

     

✓预构建测试成功通过

它几乎相同,但这一次,每个栏后都有^[[1G^[[0J ^[[1G。知道是什么导致了这个吗?

以下是ansi-terms stty的样子:

speed 9600 baud;
lflags: echoe echoke echoctl pendin
oflags: -oxtabs
cflags: cs8 -parenb
erase   kill    
<undef> <undef> 

shell-mode看起来像这样:

speed 9600 baud;
lflags: -echo echoe echoke echoctl
oflags: -onlcr -oxtabs
cflags: cs8 -parenb
erase   kill    
<undef> <undef> 

osx terminal&st; sty:

speed 9600 baud;
lflags: -echo echoe echoke echoctl
oflags: -onlcr -oxtabs
cflags: cs8 -parenb
erase   kill    
<undef> <undef> 

1 个答案:

答案 0 :(得分:1)

禁用微调器。最简单的方法是:

$ npm config set spin false

如果颜色有问题:

$ npm config set color false

最后,如果您的JavaScript提示出现问题:

$ export NODE_NO_READLINE=1
$ node
>

希望这有帮助。