Atom 编辑器安装包失败

Atom editor fails installing packages

我试图在 Atom 编辑器中安装包,但它总是失败,就像我无法连接到服务器一样。

例如,apm install split-diff returns Request for package information failed: getaddrinfo ENOTFOUND atom.io atom.io:443 (ENOTFOUND)

我是 运行 Atom 1.32.2 Linux Mint 19。 我不使用代理。

我刚刚安装了 split-diff 并且加载正常。打开 Atom 并在 Atom 菜单项下 select Preferences。这将打开一个新的 window,在窗格的左侧是一行以 Core 开头的操作,然后是 Editor、URI Handling 和其他 5 个操作。单击安装操作。您可以在此处找到并安装扩展。单击“安装”后,窗格会发生变化,顶部会出现一个搜索框。在搜索框中键入 split-diff,您的扩展名称应该会出现。脚本应该有一个蓝色的安装按钮。单击安装,它应该可以工作。

终于找到bug了!

出于个人方便的某些原因,我将 /etc/hosts 替换为符号链接(朝向我的 ~/ 文件夹中的某个位置)。这是 apm 不喜欢的。 (不知道为什么。我很高兴知道...)切换回 /etc/hosts 的真实文件使我能够再次安装软件包。

我在 Ubuntu 16.04 上遇到了这个问题。我有一个名为 /etc/hosts/ 的目录,它是 this repo 的克隆版本。

显然,拥有一个与文件同名的目录并不是明智之举,但我能够通过再次移动目录和 运行 存储库的安装脚本来解决问题。安装脚本调用 刷新 DNS 文件,在 this file here 的第 1193 行找到。

我提取了应该可以解决问题的 script/function;

#!/usr/bin/env python3

# Script by Ben Limmer
# https://github.com/l1m5
#
# This Python script will combine all the host files you provide
# as sources into one, unique host file to keep you internet browsing happy.

import argparse
import fnmatch
import json
import locale
import os
import platform
import re
import shutil
import socket
import subprocess
import sys
import tempfile
import time
from glob import glob

import lxml  # noqa: F401
from bs4 import BeautifulSoup

# Detecting Python 3 for version-dependent implementations
PY3 = sys.version_info >= (3, 0)

if PY3:
    from urllib.request import urlopen
else:
    raise Exception("We do not support Python 2 anymore.")

# Syntactic sugar for "sudo" command in UNIX / Linux
if platform.system() == "OpenBSD":
    SUDO = ["/usr/bin/doas"]
else:
    SUDO = ["/usr/bin/env", "sudo"]


# Project Settings
BASEDIR_PATH = os.path.dirname(os.path.realpath(__file__))

def flush_dns_cache():
    """
    Flush the DNS cache.
    """

    print("Flushing the DNS cache to utilize new hosts file...")
    print(
        "Flushing the DNS cache requires administrative privileges. You might need to enter your password."
    )

    dns_cache_found = False

    if platform.system() == "Darwin":
        if subprocess.call(SUDO + ["killall", "-HUP", "mDNSResponder"]):
            print_failure("Flushing the DNS cache failed.")
    elif os.name == "nt":
        print("Automatically flushing the DNS cache is not yet supported.")
        print(
            "Please copy and paste the command 'ipconfig /flushdns' in "
            "administrator command prompt after running this script."
        )
    else:
        nscd_prefixes = ["/etc", "/etc/rc.d"]
        nscd_msg = "Flushing the DNS cache by restarting nscd {result}"

        for nscd_prefix in nscd_prefixes:
            nscd_cache = nscd_prefix + "/init.d/nscd"

            if os.path.isfile(nscd_cache):
                dns_cache_found = True

                if subprocess.call(SUDO + [nscd_cache, "restart"]):
                    print_failure(nscd_msg.format(result="failed"))
                else:
                    print_success(nscd_msg.format(result="succeeded"))

        centos_file = "/etc/init.d/network"
        centos_msg = "Flushing the DNS cache by restarting network {result}"

        if os.path.isfile(centos_file):
            if subprocess.call(SUDO + [centos_file, "restart"]):
                print_failure(centos_msg.format(result="failed"))
            else:
                print_success(centos_msg.format(result="succeeded"))

        system_prefixes = ["/usr", ""]
        service_types = ["NetworkManager", "wicd", "dnsmasq", "networking"]

        for system_prefix in system_prefixes:
            systemctl = system_prefix + "/bin/systemctl"
            system_dir = system_prefix + "/lib/systemd/system"

            for service_type in service_types:
                service = service_type + ".service"
                service_file = path_join_robust(system_dir, service)
                service_msg = (
                    "Flushing the DNS cache by restarting " + service + " {result}"
                )

                if os.path.isfile(service_file):
                    dns_cache_found = True

                    if subprocess.call(SUDO + [systemctl, "restart", service]):
                        print_failure(service_msg.format(result="failed"))
                    else:
                        print_success(service_msg.format(result="succeeded"))

        dns_clean_file = "/etc/init.d/dns-clean"
        dns_clean_msg = "Flushing the DNS cache via dns-clean executable {result}"

        if os.path.isfile(dns_clean_file):
            dns_cache_found = True

            if subprocess.call(SUDO + [dns_clean_file, "start"]):
                print_failure(dns_clean_msg.format(result="failed"))
            else:
                print_success(dns_clean_msg.format(result="succeeded"))

        if not dns_cache_found:
            print_failure("Unable to determine DNS management tool.")

您需要使用过滤器断路器。我在安装 file_icons 软件包时遇到了同样的问题,并且在连接虹吸过滤器断路器时安装了该软件包。

检查您的 DNS 服务器。

今天下午我 运行 陷入了这个问题 运行,而最初一切都在我的 Mac 上进行。

我可以正常上网。 Github 已启动并且报告没有问题,Atom.io 已启动...

关于etc/hosts 来自其他评论的线索无论如何都指向了我的网络设置。

已检查并为 VPN 访问配置了我的 DNS 服务器,一旦我也添加了 OpenDNS 服务器,Atom 安装又开始工作了。