How to install node package to API proxy behind a http_proxy

Not applicable

I'm trying to install request, response and http-proxy package to my API proxy.

but when I ran command, it returned

npm ERR! Trireme Trireme
npm ERR! argv "./node" "/opt/apigee/edge-management-server-4.17.01-0.0.967/lib/node_modules/npm/cli.js" "install" "--loglevel" "error" "--registry" "https://registry.npmjs.org/" "--cache" "/opt/apigee/var/log/edge-management-server/work/npm-cache" "--ignore-scripts" "true" "--bin-links" "false" "--json"
npm ERR! node v0.10.32
npm ERR! npm  v2.14.1
npm ERR! code ECONNREFUSED
npm ERR! errno ECONNREFUSED
npm ERR! syscall connect
npm ERR! { [Error: connect ECONNREFUSED]
npm ERR!   message: 'connect ECONNREFUSED',
npm ERR!   code: 'ECONNREFUSED',
npm ERR!   errno: 'ECONNREFUSED',
npm ERR!   syscall: 'connect',
npm ERR!   parent: 'test' }
npm ERR! 
npm ERR! If you are behind a proxy, please make sure that the
npm ERR! 'proxy' config is set properly.  See: 'npm help config'
npm ERR! Please include the following file with any support request:

And I found this

https://community.apigee.com/articles/32317/nodejs-npm-install-using-management-api-on-opdk-15.html

This help told me to change something in nodejs.properties as below:

npm.registry.uri=https://registry.npmjs.org //

max.class.cache.entries=0

After do this, I have to restart management server but it change my properties back:

[ChangeDelta, position: 57, lines: [max.class.cache.entries=0] to [max.class.cache.entries=2000]]

But I'm not sure, the file I changed was right.

So, my questions are:

1. Path of nodejs.properties is /opt/apigee/edge-management-server-4.17.01-0.0.967/conf/?

2. How to edit config and restart without changing my properties?

3. My Server is behind proxy. When I install package, how to pass the proxy?

- I used command npm to set proxy but it returned -bash: npm: command not found.

0 6 5,222
6 REPLIES 6

let me see if I can find someone to answer this for you.

I do another way to solve my real problems. I didn't try to install node package to my API proxy anymore. I just use the 'request' package that APIGEE provided and change some config (in default.properties) in server to solve about firewall proxy.

By the way, thank you so much.

@Panicha H., I am also facing the same issue while installing the npm dependent module using management API (OPDK). Could you pls elaborate your changes to fix this issue?

Actually, I just wanted to update 'request' modules. But I cannot update it. So I used the version which APIGEE provided to solve my real solution. (My real solution is I didn't know how to send request with firewall proxy through version APIGEE provided.)

rmishra
Participant V

If you can't change firewall rules , an easier workaround may be to build the package (including module dependencies) on a build server outside Apigee and upload the full bundle

Checkout Apigeetool deploynodeapp command and the --upload-modules flag

https://github.com/apigee/apigeetool-node#deploynodeapp

@rmishra, I am facing the same issue where I am not able to download the required npm modules due to corporate firewall. Is there a way to resolve the issue.