Skip to content
This repository has been archived by the owner on Jul 24, 2024. It is now read-only.

Post Install fails inside a proxy #1458

Closed
toninofox opened this issue Apr 21, 2016 · 20 comments
Closed

Post Install fails inside a proxy #1458

toninofox opened this issue Apr 21, 2016 · 20 comments

Comments

@toninofox
Copy link

Dear all,
I am trying to install node-sass inside a proxy properly configured in node npm via
npm config set proxy http://myproxy.com:8080

all dependencies works but the post install of node-sass fails

npm info lifecycle node-sass@3.5.1~install: node-sass@3.5.1

  node-sass@3.5.1 install D:\...\node_modules\node-sass
  node scripts/install.js

 Cannot download "https://github.com/sass/node-sass/releases/download/v3.5.1/win32-ia32-47_binding.node": 

 getaddrinfo ENOTFOUND github.com github.com:443

 Hint: If github.com is not accessible in your location
       try setting a proxy via HTTP_PROXY, e.g. 
    export HTTP_PROXY=http://example.com:1234

 or configure npm proxy via
npm config set proxy http://example.com:8080


In the install.js script of the node-sass module, there is the proxy configuration reported below:

function applyProxy(options, cb) {
  var env = process.env;

  options.proxy = env.npm_config_https_proxy ||
                  env.npm_config_proxy ||
                  env.npm_config_http_proxy ||
                  env.HTTPS_PROXY ||
                  env.https_proxy ||
                  env.HTTP_PROXY ||
                  env.http_proxy;

  cb(options);
}

the older versions (that work inside the proxy) are configured with the function as below

function applyProxy(options, cb) {
  npmconf.load({}, function (er, conf) {
    var proxyUrl;

    if (!er) {
      proxyUrl = conf.get('https-proxy') ||
                 conf.get('proxy') ||
                 conf.get('http-proxy');
    }

    var env = process.env;

    options.proxy = proxyUrl ||
                    env.HTTPS_PROXY ||
                    env.https_proxy ||
                    env.HTTP_PROXY ||
                    env.http_proxy;

    cb(options);
  });
}

Thank You!

@thedarkdestructor
Copy link

We are experiencig the same exact issue!

shouldn't the search for a proxy rely on npm config properties instead of env variables?

A clarification will be highly appreciated.

@basvandenheuvel
Copy link

basvandenheuvel commented Apr 21, 2016

Same issue here. We didn't change our node-sass version. Did they change the code of a released version instead of creating a new version?

@catchamonkey
Copy link

catchamonkey commented Apr 21, 2016

It worked before, just by using the env vars (which is nicer IMO).
We are setting env vars for http_proxy, but ran a build today and it no longer works,

@basvandenheuvel
Copy link

@xzyfer version 3.5.1 introduced proxy problems. Solution?

@xzyfer
Copy link
Contributor

xzyfer commented Apr 21, 2016

Unfortunately the library we used to get proxy configuration was
deprecated. We believed this to be equivalent behaviour.

I'm out at the moment but welcome a PR.
On 21 Apr 2016 8:04 PM, "Bas van den Heuvel" notifications@github.com
wrote:

@xzyfer https://github.com/xzyfer version 3.5.1 introduced proxy
problems. Solution?


You are receiving this because you were mentioned.
Reply to this email directly or view it on GitHub
#1458 (comment)

@basvandenheuvel
Copy link

@xzyfer Im wondering. We use the gulp-sass package which uses the node-sass package as a dependency. We DIDN'T change the version of our gulp-sass but still get this error?

How can it be that some one changes dependencies in a live package instead of doing that in a new version?

@xzyfer
Copy link
Contributor

xzyfer commented Apr 21, 2016

Please provide the output of env | grep proxy
On 21 Apr 2016 8:16 PM, "Bas van den Heuvel" notifications@github.com
wrote:

@xzyfer https://github.com/xzyfer Im wondering. We use the gulp-sass
package which uses the node-sass package as a dependency. We DIDN'T change
the version of our gulp-sass but still get this error?

How can it be that some one changes dependencies in a live package instead
of doing that in a new version?


You are receiving this because you were mentioned.
Reply to this email directly or view it on GitHub
#1458 (comment)

@xzyfer xzyfer closed this as completed in 40aeee4 Apr 21, 2016
@xzyfer
Copy link
Contributor

xzyfer commented Apr 21, 2016

I've release v3.5.2 with a fix for this.

@xzyfer
Copy link
Contributor

xzyfer commented Apr 21, 2016

@catchamonkey could you please provide the output of

env | grep -i proxy

@xzyfer
Copy link
Contributor

xzyfer commented Apr 21, 2016

Apologies everyone, these can be hard spot if not picked up by our beta testers.

@thedarkdestructor
Copy link

Thank you for your quick reaction. I'm going to test it and let you know.

@toninofox
Copy link
Author

I am still have the issue using .npmrc file and trying to download the new 3.5.2. Does it work for someone?

@xzyfer
Copy link
Contributor

xzyfer commented Apr 21, 2016

Please provide the output you're seeing and the output from npm ls node-sass
On 21 Apr 2016 9:18 PM, "Antonio La Gamma" notifications@github.com wrote:

I am still have the issue using .npmrc file and trying to download the new
3.5.2. Does it work for someone?


You are receiving this because you modified the open/close state.
Reply to this email directly or view it on GitHub
#1458 (comment)

xzyfer added a commit to xzyfer/node-sass that referenced this issue Apr 21, 2016
This reverts commit 5e21f47.

The solution implemented was not equivalent and resulted in issues
for users with proxies.

Fixes sass#1458
@toninofox
Copy link
Author

toninofox commented Apr 21, 2016

npm info lifecycle node-sass@3.5.2~install: node-sass@3.5.2

> node-sass@3.5.2 install \src\main\webapp\node_modules\node-sass
> node scripts/install.js

Cannot download "https://github.com/sass/node-sass/releases/download/v3.5.2/win32-ia32-47_binding.node": 

getaddrinfo ENOTFOUND github.com github.com:443

Hint: If github.com is not accessible in your location
      try setting a proxy via HTTP_PROXY, e.g. 

      export HTTP_PROXY=http://example.com:1234

or configure npm proxy via

      npm config set proxy http://example.com:8080
npm info lifecycle ansi-regex@2.0.0~postinstall: ansi-regex@2.0.0
npm info lifecycle ansi-styles@2.2.1~postinstall: ansi-styles@2.2.1
npm info lifecycle minimatch@3.0.0~postinstall: minimatch@3.0.0
npm info lifecycle glob@7.0.3~postinstall: glob@7.0.3
npm info lifecycle has-ansi@2.0.0~postinstall: has-ansi@2.0.0
npm info lifecycle lodash@2.4.2~postinstall: lodash@2.4.2
npm info lifecycle lru-cache@2.7.3~postinstall: lru-cache@2.7.3
npm info lifecycle minimatch@0.3.0~postinstall: minimatch@0.3.0
npm info lifecycle glob@3.2.11~postinstall: glob@3.2.11
npm info lifecycle globule@0.2.0~postinstall: globule@0.2.0
npm info lifecycle gaze@1.0.0~postinstall: gaze@1.0.0
npm info lifecycle strip-ansi@3.0.1~postinstall: strip-ansi@3.0.1
npm info lifecycle supports-color@2.0.0~postinstall: supports-color@2.0.0
npm info lifecycle chalk@1.1.3~postinstall: chalk@1.1.3
npm info lifecycle node-sass@3.5.2~postinstall: node-sass@3.5.2

> node-sass@3.5.2 postinstall \src\main\webapp\node_modules\node-sass
> node scripts/build.js

"\src\main\webapp\node_modules\node-sass\vendor\win32-ia32-47\binding.node" exists. 
 testing binary.
Problem with the binary:
Error: %1 is not a valid Win32 application.
\\?\\src\main\webapp\node_modules\node-sass\vendor\win32-ia32-47\binding.node

@xzyfer
Copy link
Contributor

xzyfer commented Apr 21, 2016

I believe I've found the issue. We recently our http library and the new open appears to have issues with proxies. I'll revert this change and release v3.5.3 shortly.

@xzyfer xzyfer reopened this Apr 21, 2016
xzyfer added a commit to xzyfer/node-sass that referenced this issue Apr 21, 2016
This reverts commit c2d24c2.

Unfortunately got does not have good [proxy support][1] which
was missed during review.

Fixes sass#1458

[1]: sindresorhus/got#79
@xzyfer xzyfer closed this as completed in 03bd69e Apr 21, 2016
@xzyfer
Copy link
Contributor

xzyfer commented Apr 21, 2016

Hello all, I've released v3.5.3 which should fix the proxy issue for good. My sincere apologies for the disruption this has cause you.

@toninofox
Copy link
Author

Perfect it works! No problem and thank you for your prompt actions :)

xzyfer added a commit to xzyfer/node-sass that referenced this issue Apr 27, 2016
This was previously attempted in sass#1413. Shortly after it's
release proxy users started experiencing installation issues so
this was reverted. It was later determined that sass#1458 was likely
at fault for the proxy issues.

Full credit for this patch goes to @delitescere.

I've also taken the liberty of cleaning the request config generation.

Fixes sass#1333
xzyfer added a commit to xzyfer/node-sass that referenced this issue Apr 27, 2016
This was previously attempted in sass#1413. Shortly after it's
release proxy users started experiencing installation issues so
this was reverted. It was later determined that sass#1458 was likely
at fault for the proxy issues.

Full credit for this patch goes to @delitescere.

I've also taken the liberty of cleaning the request config generation.

Fixes sass#1333
xzyfer added a commit to xzyfer/node-sass that referenced this issue Apr 27, 2016
This was previously attempted in sass#1413. Shortly after it's
release proxy users started experiencing installation issues so
this was reverted. It was later determined that sass#1458 was likely
at fault for the proxy issues.

Full credit for this patch goes to @delitescere.

I've also taken the liberty of cleaning the request config generation.

Fixes sass#1333
xzyfer added a commit to xzyfer/node-sass that referenced this issue Apr 27, 2016
This was previously attempted in sass#1413. Shortly after it's
release proxy users started experiencing installation issues so
this was reverted. It was later determined that sass#1458 was likely
at fault for the proxy issues.

Full credit for this patch goes to @delitescere.

I've also taken the liberty of cleaning the request config generation.

Fixes sass#1333
xzyfer added a commit that referenced this issue Apr 28, 2016
This was previously attempted in #1413. Shortly after it's
release proxy users started experiencing installation issues so
this was reverted. It was later determined that #1458 was likely
at fault for the proxy issues.

Full credit for this patch goes to @delitescere.

I've also taken the liberty of cleaning the request config generation.

Fixes #1333
@blowsie
Copy link

blowsie commented Nov 17, 2016

Anyone that ends up here might be intrested to know that https://github.com/sass/node-sass/releases/download/v3.5.2/win32-ia32-47_binding.node currently resolves to github-cloud.s3.amazonaws.com. So you may have to add exceptions to your corporate proxy accordingly

@nimatrazmjo
Copy link

nimatrazmjo commented Dec 26, 2018

I have got same issue with version 4.11.0 when Installing with docker.

The error.

Downloading binary from https://github.com/sass/node-sass/releases/download/v4.11.0/linux-x64-64_binding.node
Cannot download "https://github.com/sass/node-sass/releases/download/v4.11.0/linux-x64-64_binding.node": 

read ECONNRESET

Hint: If github.com is not accessible in your location
      try setting a proxy via HTTP_PROXY, e.g. 

      export HTTP_PROXY=http://example.com:1234

or configure npm proxy via

      npm config set proxy http://example.com:8080


Dockerfile:

FROM ubuntu:16.04

RUN rm /bin/sh && ln -s /bin/bash /bin/sh
# RUN apt-get update && apt-get install locales

# Set environment variables
ENV appDir /var/www/app/jobsaf-website


RUN apt-get update && apt-get upgrade -y \
    && apt-get install -y  --no-install-recommends \
    build-essential \
    ca-certificates \
    gcc \
    git \
    libpq-dev \
    make \
    python-pip \
    python2.7 \
    python2.7-dev \
    apt-transport-https \
    build-essential \
    ca-certificates \
    curl \
    g++ \
    nginx \
    sudo \
    wget \
    bzip2 \
    && apt-get clean \
    && rm -rf /tmp/* /var/lib/apt/lists/* \
    && apt-get -y autoclean

ENV NVM_DIR /usr/local/nvm
ENV NODE_VERSION 10.6.0

# Install nvm with node and npm
RUN curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.29.0/install.sh | bash \
    && source $NVM_DIR/nvm.sh \
    && nvm install $NODE_VERSION \
    && nvm alias default $NODE_VERSION \
    && nvm use default

# Set up our PATH correctly so we don't have to long-reference npm, node, &c.
ENV NODE_PATH $NVM_DIR/versions/node/v$NODE_VERSION/lib/node_modules
ENV PATH $NVM_DIR/versions/node/v$NODE_VERSION/bin:$PATH



# Install mongodb
# RUN apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv 7F0CEB10 && \
#     echo "deb http://repo.mongodb.org/apt/ubuntu xenial/mongodb-org/3.4 multiverse" | tee /etc/apt/sources.list.d/mongodb-org-3.4.list && \
#     apt-get update && \
#     apt-get install -y mongodb-org && \
#     rm -rf /var/lib/apt/lists/* && \
#     mkdir /data && \
#     mkdir /data/db && \
#     /etc/init.d/mongodb start

# install jobsaf-website Prerequisites
RUN npm install -g @angular/cli@6.2.3 pm2@latest snyk node-pre-gyp


# Set the work directory
RUN mkdir -p /var/www/app/jobsaf-website
WORKDIR ${appDir}

# Add our package.json and install *before* adding our application files
ADD package.json ./

# Install pm2 so we can run our application
# RUN npm i -g pm2

# Add application files
ADD . /var/www/app/jobsaf-website


# CMD ["pm2", "start", "processes.json", "--no-daemon"]


# RUN mkdir -p /jobsaf-website
# WORKDIR /jobsaf-website
# COPY . /jobsaf-website

# COPY package*.json ./

RUN npm install --force


# EXPOSE 80 443 3000 35729 8080 4200
EXPOSE 4200 3000

# CMD npm start && npm run ng

docker-compose.yml

version: '3'
services:
  web:
    restart: always
    build: .
    container_name: jobsaf-website
    ports:
     - "3000:3000"
     - "5858:5858"
     - "4200:4200"
     - "35729:35729"
    environment:
     - NODE_ENV=development
     - DB_1_PORT_27017_TCP_ADDR=db
    depends_on:
     - mongo
     - redis
    volumes:
     - ./:/opt/jobsaf-website
     - /opt/jobsaf-website/node_modules
     - /opt/jobsaf-website/public
     - /opt/jobsaf-website/uploads
  mongo:
    image: mongo:latest
    restart: always
    ports:
     - "27017:27017"
    volumes:
      - /data/db
      - /var/lib/mongodb
      - /var/log/mongodb  
    command: mongod --smallfiles --logpath=/dev/null # --quiets  
  redis:
    image: redis:alpine
    deploy:
      resources:
        limits:
          cpus: '0.50'
          memory: 50M
        reservations:
          cpus: '0.25'
          memory: 20M
networks:
  front-tier:
  back-tier:

@xzyfer
Copy link
Contributor

xzyfer commented Dec 26, 2018 via email

jiongle1 pushed a commit to scantist-ossops-m2/node-sass that referenced this issue Apr 7, 2024
rename SIZE to LENGTH to avoid conflict with windows headers
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

8 participants