imagemin / mozjpeg-bin

mozjpeg bin-wrapper that makes it seamlessly available as a local dependency

Home Page:https://github.com/mozilla/mozjpeg

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Trying to install mozjpeg - behind corporate network

lawrenceong001 opened this issue · comments

hello,

i'm trying to install gatsby using a default template, which requires mozjpeg. however, i'm getting this error:

C:\dev>npm i -g mozjpeg
C:\Users\a\AppData\Roaming\npm\mozjpeg -> C:\Users\a\AppData\Roaming\npm\node_modules\mozjpeg\cli.js
`> mozjpeg@6.0.1 postinstall C:\Users\a\AppData\Roaming\npm\node_modules\mozjpeg` `> node lib/install.js`
(node:13428) Warning: Setting the NODE_TLS_REJECT_UNAUTHORIZED environment variable to '0' makes TLS connections and HTTPS requests insecure by disabling certificate verification.
‼ self signed certificate in certificate chain
‼ mozjpeg pre-build test failed
i compiling from source
× RequestError: self signed certificate in certificate chain
at ClientRequest.<anonymous> (C:\Users\a\AppData\Roaming\npm\node_modules\mozjpeg\node_modules\got\index.js:111:21)
at Object.onceWrapper (events.js:284:20)
at ClientRequest.emit (events.js:196:13)
at TLSSocket.socketErrorListener (_http_client.js:402:9)
at TLSSocket.emit (events.js:196:13)
at emitErrorNT (internal/streams/destroy.js:91:8)
at emitErrorAndCloseNT (internal/streams/destroy.js:59:3)
at processTicksAndRejections (internal/process/task_queues.js:84:17)
+ mozjpeg@6.0.1
updated 1 package in 13.251s

I've already set strict-ssl and NODE_TLS_REJECT_UNAUTHORIZED to false, but can't seem to get around this issue.

hopefully someone can help?

tks
Lawrence

I'm behind a corporate proxy and was running into this same issue. In my case, the issue seemed to be due to the fact that mozjpeg's install script was invoking another copy of node, and node didn't have the certs for my corp's proxy. Here's how I fixed it (note that I'm on macOS):

  • Grabbed a copy of the proxy's certificate, threw it into a file called cacert.pem (openssl s_client -connect raw.githubusercontent.com:443 -showcerts >cacert.pem, then Ctrl+D after it spits out its output)
  • Run NODE_EXTRA_CA_CERTS=cacert.pem npm install