简体   繁体   English

纳米错误:打开终端时出错:xterm-256color

[英]nano error: Error opening terminal: xterm-256color

After the installation of OSX Lion, I tried to:安装 OSX Lion 后,我尝试:

nano /etc/apt/sources.list

But I get this error:但我得到这个错误:

Error opening terminal: xterm-256color

If I try to switch terminal.app preferences to open terminal windows in "xterm color" instead of xterm-256color everything works fine.如果我尝试切换 terminal.app 首选项以在“xterm color”而不是xterm-256color中打开终端 windows 一切正常。

What's happening?发生了什么?

On Red Hat this worked for me: 在Red Hat上,这对我有用:

export TERM=xterm

further info here: http://www.cloudfarm.it/fix-error-opening-terminal-xterm-256color-unknown-terminal-type/ 进一步的信息: http//www.cloudfarm.it/fix-error-opening-terminal-xterm-256color-unknown-terminal-type/

After upgrading to OSX Lion, I started getting this error on certain (Debian/Ubuntu) servers. 升级到OSX Lion后,我开始在某些(Debian / Ubuntu)服务器上收到此错误。 The fix is simply to install the “ncurses-term” package which provides the file /usr/share/terminfo/x/xterm-256color. 修复只是安装“ncurses-term”包,它提供文件/ usr / share / terminfo / x / xterm-256color。

This worked for me on a Ubuntu server, via Erik Osterman . 这通过Erik Osterman在Ubuntu服务器上为我工作。

I can confirm this is a terminfo issue. 我可以确认这是一个终结问题。 This is what worked for me. 这对我有用。 SSH in to the remote machine and run SSH进入远程计算机并运行

 sudo apt-get install ncurses-term

Boom. 繁荣。 Problem solved. 问题解决了。

I had this problem connecting to http://sdf.org through Mac OS X Lion. 我有这个问题通过Mac OS X Lion连接到http://sdf.org I changed under Terminal Preferences ( + , ) > Advanced pane, Declare Terminal as to VT-100 . 我在Terminal Preferences + > Advanced窗格下更改了,将Terminal Preferences Declare Terminal as VT-100

I also marked Delete Sends Ctrl-H because this Mac connection was confusing zsh . 我还标记了Delete Sends Ctrl-H因为这个Mac连接让zsh感到困惑。

It appears to be working for my use case. 它似乎适用于我的用例。

I, too, have this problem on an older Mac that I upgraded to Lion. 我也在我升级到Lion的旧Mac上遇到此问题。

Before reading the terminfo tip, I was able to get vi and less working by doing "export TERM=xterm". 在阅读terminfo提示之前,通过执行“export TERM = xterm”,我能够获得vi并减少工作量。

After reading the tip, I grabbed /usr/share/terminfo from a newer Mac that has fresh install of Lion and does not exhibit this problem. 阅读完提示后,我从一台新安装了Lion的Mac上抓取了/usr/share/terminfo ,并没有出现这个问题。

Now, even though echo $TERM still yields xterm-256color , vi and less now work fine. 现在,即使echo $TERM仍然产生xterm-256color ,vi和更少现在工作正常。

somehow and sometimes "terminfo" folder comes corrupted after a fresh installation. 不知何故,有时“terminfo”文件夹在全新安装后损坏。 i don't know why, but the problem can be solved in this way: 我不知道为什么,但问题可以通过这种方式解决:

1. Download Lion Installer from the App Store
2. Download unpkg: http://www.macupdate.com/app/mac/16357/unpkg
3. Open Lion Installer app in Finder (Right click -> Show Package
Contents)
4. Open InstallESD.dmg (under SharedSupport)
5. Unpack BSD.pkg with unpkg (Located under Packages)   Term info
will be located in the new BSD folder in /usr/share/terminfo

hope it helps. 希望能帮助到你。

您可以在.bashrc中添加以下内容

if [ "$TERM" = xterm ]; then TERM=xterm-256color; fi
  1. edit your .bash_profile file 编辑.bash_profile文件

    vim .bash_profile

  2. commnet 的CommNet

    #export TERM=xterm-256color

  3. add this 加上这个

    export TERMINFO=/usr/share/terminfo

    export TERM=xterm-basic

    to your .bash_profile 你的.bash_profile

  4. finally 最后

    run: 跑:

    source .bash_profile

Mine was quite a unique case but this could help someone. 我是一个非常独特的案例,但这可以帮助某人。 On Android I tried to copy nano from my termux binary folder to /system/xbin. 在Android上,我尝试将nano从termux二进制文件夹复制到/ system / xbin。 Placed all the library dependencies in /system/lib and got this error. 将所有库依赖项放在/ system / lib中并得到此错误。 The libncurses.so.6 file I copied from termux had it's TERMINFO file still pointed to /data/data/com.termux/files/usr/share/terminfo 我从termux复制的libncurses.so.6文件让它的TERMINFO文件仍然指向/data/data/com.termux/files/usr/share/terminfo

View pointed path with command 用命令查看指向的路径

strings path-to-libncurses.so | strings path-to-libncurses.so | grep /terminfo grep / terminfo

To fix either make the termux terminfo dir and subdirs readable and executable by the nano user or copy the terminfo folder somewhere else and use a hexeditor to modify the plain text path in the shared library file. 要修复使termux terminfo目录和子目录可由nano用户读取和执行,或者将terminfo文件夹复制到其他位置,并使用hexeditor修改共享库文件中的纯文本路径。

Link to zipped terminfo folder https://drive.google.com/file/d/1m1tfHgkGRehBGh1jPMK4EaTgQb9EyCG7/view?usp=drivesdk 链接到压缩的terminfo文件夹https://drive.google.com/file/d/1m1tfHgkGRehBGh1jPMK4EaTgQb9EyCG7/view?usp=drivesdk

I hear that this can be fixed by overwriting your /usr/share/terminfo with one from the computer of somebody with a working install of Lion. 我听说这可以通过覆盖你的/usr/share/terminfo ,其中一个来自有人安装Lion的计算机。 I can't confirm whether this works or not, and unfortunately I haven't upgraded yet, so I can't provide you with that file. 我无法确认这是否有效,不幸的是我尚未升级,所以我无法为您提供该文件。

This worked for me on linux mint, based on the link provided by @Meetai.com.根据@Meetai.com 提供的链接,这在 linux 薄荷上对我有用。
Put this in .bashrc and restart the terminal:将其放入.bashrc并重新启动终端:

TERM="xterm"期限="xterm"
export TERM出口期限

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM