Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can't install psc-package using npm #155

Open
ghost opened this issue May 10, 2019 · 3 comments
Open

Can't install psc-package using npm #155

ghost opened this issue May 10, 2019 · 3 comments

Comments

@ghost
Copy link

ghost commented May 10, 2019

  • Which platform do you have this bug in?
    GNU/Linux x86_64
  • What is the expected behavior?
    Successful psc-package installation, command tried: npm i -g psc-package
  • What is the actual behavior?
    Installation fails with Error: connect ETIMEDOUT 140.82.118.3:443 (some github server)
    at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1054:14)
  • What would help fix this issue?
    Using npm proxies during installation.

There are no problems with other packages (i.e. pulp) I suspect the root cause is corporate proxy and some script (install.js ?) trying to make connection without using it (proxy).

@justinwoo
Copy link
Collaborator

@ghost
Copy link
Author

ghost commented May 10, 2019

OK, I've managed to install it. My modified install.js, looks like this.


const url = require("url");
const https = require("follow-redirects").https;
const tar = require("tar");
const shell = require("shelljs");
const version = require("./package.json")["psc-package-version"];
const platform = { win32: "win64", darwin: "macos" }[process.platform] || "linux64";

const HttpsProxyAgent = require('https-proxy-agent');
const proxy = process.env.https_proxy;
var agent = new HttpsProxyAgent(proxy);
var options = url.parse('https://github.com/purescript/psc-package/releases/download/${version}/${platform}.tar.gz');
options.agent = agent;


https.get(options,
  res => res.pipe(
      tar.x({"C": 'psc-package', strip: 1}).on("finish", () => {
        if (shell.test("-f", "./psc-package/psc-package")) {
          shell.mv("./psc-package/psc-package", "./psc-package/psc-package.exe")
        }
      })
    )
);

I've followed https://www.npmjs.com/package/https-proxy-agent documentation. Thanks.

@justinwoo
Copy link
Collaborator

Cool, will have to try applying this later.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant