I made a tfjs solution for object detection and want to deploy it on server behind corporate proxy.
Problem happens because tensorflow\tfjs-node\scripts\install.js
does not supprot proxy so it tries to fetch the https://storage.googleapis.com/tensorflow/libtensorflow/libtensorflow-cpu-windows-x86_64-1.15.0.zip
directly from server and that isn't possible.'
I've set up my npm config
$npm config list
and console.log is:
; cli configs
metrics-registry = "http://registry.npmjs.org/"
scope = ""
user-agent = "npm/6.14.4 node/v12.18.0 win32 x64"
; userconfig C:\Users\user\.npmrc
https-proxy = "http://182.192.254.44:8080/"
proxy = "http://182.192.254.44:8080/"
python = "="
registry = "http://registry.npmjs.org/"
strict-ssl = false
; builtin config undefined
prefix = "C:\\Users\\user\\AppData\\Roaming\\npm"
; node bin location = C:\Program Files\nodejs\node.exe
; cwd = C:\IPA\beauty\TrackingServerProject
; HOME = C:\Users\usename
; "npm config ls -l" to show all defaults.
As you can see i get next error because of proxy.
$ npm install @tensorflow/tfjs-node
> @tensorflow/[email protected] install C:\IPA\beauty\TrackingServerProject\node_modules\@te
> node scripts/install.js
CPU-windows-2.0.1.zip
* Downloading libtensorflow
events.js:292
throw er; // Unhandled 'error' event
^
Error: connect ETIMEDOUT 64.233.189.128:443
at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1141:16)
Emitted 'error' event on ClientRequest instance at:
at TLSSocket.socketErrorListener (_http_client.js:426:9)
at TLSSocket.emit (events.js:315:20)
at emitErrorNT (internal/streams/destroy.js:92:8)
at emitErrorAndCloseNT (internal/streams/destroy.js:60:3)
at processTicksAndRejections (internal/process/task_queues.js:84:21) {
errno: 'ETIMEDOUT',
code: 'ETIMEDOUT',
syscall: 'connect',
npm ERR! @tensorflow/[email protected] install: `node scripts/install.js`
I think that i maybe need to change tensorflow\tfjs-node\scripts\install.js
to add proxy ?
Please help!
I managed to get it to work after 3 days problem was in definition of PROXY
tensorflow\tfjs-node\scripts\resources.js (https://github.com/tensorflow/tfjs/blob/master/tfjs-node/scripts/resources.js)
line 40 & 41
When define proxy in ways 1) or 2) it doesn't detect
process.env
npm config edit
.npmrc
So you need to pass system variable for PowerShell in form of
$env:HTTP_PROXY="http://182.192.254.44:8080/"
or for CMD
HTTP_PROXY=http://182.192.254.44:8080/
so it will work
just type:
npm install @tensorflow/tfjs-node
and enjoy!