【问题标题】:APM doesn't work behind a corporate proxyAPM 在公司代理后面不起作用
【发布时间】:2015-04-23 10:05:18
【问题描述】:

我在运行 (sudo) apm install minimap(或任何其他软件包)时遇到的错误:

gyp info it worked if it ends with ok
gyp info using node-gyp@1.0.2
gyp info using node@0.10.35 | linux | x64
gyp http GET https://atom.io/download/atom-shell/v0.21.0/node-v0.21.0.tar.gz
gyp WARN install got an error, rolling back install
gyp ERR! install error 
gyp ERR! stack Error: tunneling socket could not be established, cause=Parse Error
gyp ERR! stack     at ClientRequest.onError (/usr/share/atom/resources/app/apm/node_modules/npm/node_modules/request/node_modules/tunnel-agent/index.js:168:17)
gyp ERR! stack     at ClientRequest.g (events.js:180:16)
gyp ERR! stack     at ClientRequest.emit (events.js:95:17)
gyp ERR! stack     at Socket.socketOnData (http.js:1593:9)
gyp ERR! stack     at TCP.onread (net.js:528:27)
gyp ERR! System Linux 3.13.0-45-generic
gyp ERR! command "/usr/share/atom/resources/app/apm/bin/node" "/usr/share/atom/resources/app/apm/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "install" "--target=0.21.0" "--dist-url=https://atom.io/download/atom-shell" "--arch=x64" "--ensure" "--proxy=http://172.31.1.4:8080/"
gyp ERR! cwd /home/anmol/.atom
gyp ERR! node -v v0.10.35
gyp ERR! node-gyp -v v1.0.2
gyp ERR! not ok 

【问题讨论】:

  • 您是否尝试将节点更新到最新版本?您仍在使用0.10.35,最新的(在撰写本文时)是0.12.0。一些基于节点的工具对节点的版本高度敏感。
  • 看起来该问题已在 request 节点模块的新版本(版本 2.66.0)中得到解决,请参阅 this comment on github 了解解决方法

标签: node.js linux ubuntu atom-editor


【解决方案1】:

你不能运行apm install [INSERT PACKAGE NAME]。您必须按照文档运行apm install .https://github.com/atom/atom-shell/blob/master/docs/tutorial/using-native-node-modules.md

另外,我不确定您是否可以从 https://atom.io/download/atom-shell 后面的 http 代理下载。

【讨论】:

  • 我在公司 HTTP Proxy 后面,所以我希望有一个解决方法。我仍然可以手动下载包,然后从源代码构建它们,但更自动化的方法将是首选解决方案。无论如何感谢您的输入。
  • 可能不推荐,但你肯定可以运行 apm 命令来安装包,就像我上面说的那样,如果你没有!搞砸你的代理设置。
  • 可以,但是你的npm安装和apm安装会有冲突;如前所述,不推荐
【解决方案2】:

在运行命令之前使用: 导出 ATOM_NODE_URL=http://gh-contractor-zcbenz.s3.amazonaws.com/atom-shell/dist

【讨论】:

  • 链接返回拒绝访问。你能把它贴在我有权查看文件内容的地方吗?
【解决方案3】:

尝试使用apm CLI 工具设置您的代理设置。

用途:

apm config set http-proxy https://userid:pwd@host:port

如果不需要 uid 和密码,则使用以下一种:

apm config set http-proxy https://host:port

要查看配置的值,请​​使用以下命令:

use apm config get http-proxy

如果您的设置中有!(爆炸)符号,那么您使用apm config 会很不走运。解析 ! 时出现问题。

【讨论】:

    【解决方案4】:

    您可以通过在终端中输入来为 Atom 设置代理:

    $ apm config set proxy "http://user:pass@host:port"
    $ apm config set https_proxy "http://user:pass@host:port"
    

    之后,您可以打开 Atom 并看到快速结果;)

    【讨论】:

      【解决方案5】:

      这在公司代理背后对我有用:
      Win7 / apm 版本 2.4.3 / Atom 1.40.1 x64

      => 打开或创建文件 C:\Users\.atom\.apmrc

      => 添加

      http-proxy="http://user:pwd@proxy:port"<br>
      https-proxy="http://user:pwd@proxy:port"<br>
      strict-ssl=false<br>
      

      => 从命令行运行

      apm install your-package --verbose
      

      => 重启 Atom 并享受

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 1970-01-01
        • 2020-10-04
        • 1970-01-01
        • 2014-10-28
        • 1970-01-01
        • 1970-01-01
        • 2023-03-06
        • 2019-06-30
        相关资源
        最近更新 更多