optipng-bin icon indicating copy to clipboard operation
optipng-bin copied to clipboard

enable non strict-ssl install option

Open p2227 opened this issue 8 years ago • 8 comments

os:win7 x64 cmd: npm i optipng-bin

error info:

> [email protected] postinstall D:\xxxxx\node_modules\optipng-bin
> node lib/install.js

  ‼ unable to verify the first certificate
  ‼ optipng pre-build test failed
  i compiling from source

i know that the error unable to verify the first certificate cause by an https download over proxy but use strict ssl.

we can config strict-ssl:false in npm config. (npm config set strict-ssl false)

how can i enable non strict-ssl download via some envionment variables or function arguments ?

I fount that the error may be cause by bin-build download caw or got

p2227 avatar May 11 '16 07:05 p2227

https://docs.npmjs.com/misc/config#environment-variables

NPM_CONFIG_STRICT_SSL=false should work.

shinnn avatar May 11 '16 07:05 shinnn

@shinnn

would you mean set NPM_CONFIG_STRICT_SSL=false&&npm i optipng-bin?

it still get the error.

p2227 avatar May 11 '16 09:05 p2227

"How to set npm config via environment variables?" is not an issue with optipng-bin. Go to https://stackoverflow.com/ or https://github.com/npm/npm/issues instead.

shinnn avatar May 11 '16 09:05 shinnn

@shinnn
there may be a misunderstanding. you mean download from http://registry.npmjs.org/optipng-bin width non strict-ssl mode.

my issue is about the code: https://github.com/imagemin/optipng-bin/blob/d54b2c3805877d2af70380ccad3c32d6bcecf3c4/lib/install.js#L14

it need to download from http://downloads.sourceforge.net/project/optipng/OptiPNG/optipng-0.7.6/optipng-0.7.6.tar.gz this url will redirct to an https url . the error unable to verify the first certificate occur during that

p2227 avatar May 11 '16 10:05 p2227

Yes, I misunderstood. Sorry.

Currently this module doesn't refer strict-ssl option. Instead, you can use HTTPS_PROXY enviroment variable or http-proxy npm config. Does HTTPS_PROXY work for you?

shinnn avatar May 11 '16 10:05 shinnn

I alrealy set HTTPS_PROXY .but it still get the error.

p2227 avatar May 11 '16 14:05 p2227

i had solve the same problem .

https://github.com/electron-userland/electron-prebuilt/issues/91

https://github.com/mramato/electron-prebuilt/blob/6ade629a73df6222bda245c980a16542336ab1e2/install.js#L39

we should specifies strictSSL parameter to download.

but electron-download is base on nugget. I think it's the cause of the problem.

p2227 avatar May 12 '16 01:05 p2227

I'm sorry. the error code is https://github.com/imagemin/optipng-bin/blob/b2bcc638a46005b25b5d4e548669cb07941b55ff/lib/index.js#L6 and when the BinWrapper run method is called.

but it doesn't matter. we all think that't it should make a PR to download

p2227 avatar May 12 '16 12:05 p2227