Node.js install module

Not applicable

I'm having some trouble installing the 'googleapis' module in my node.js app. I have defined two dependencies in the package.json (express and googleapis). Uploading the app via apigeetools and using the management api to install the modules. This works well for 'express' but not for 'googleapis'. List modules from the management api comes back ok. Both zip files appear in the proxy so that seems to be working as well.

Does anyone have any ideas where the problem is?

1 3 276
3 REPLIES 3

What is the error you see? This should help us solve the issue.

Here is the first part of a very long error.

*** syntax error syntax error at module.js:439 at module.js:474 at module.js:356 at module.js:312 at module.js:364 at require (module.js:380) at /organization/environment/api/node_modules/google-p12-pem/build/src/index.js:5 at module.js:456 at module.js:474 at module.js:356 at module.js:312 at module.js:364 at require (module.js:380) at /organization/environment/api/node_modules/gtoken/build/src/index.js:50 at module.js:456 at module.js:474 at module.js:356 at module.js:312 at module.js:364 at require (module.js:380) at /organization/environment/api/node_modules/googleapis/node_modules/google-auth-library/build/src/auth/jwtclient.js:63 at module.js:456 at module.js:474 at module.js:356 at module.js:312 at module.js:364...

When I remove require('googleapis') the errors disappear.

Hi Kristian

Sorry about the trouble you're having. I know this is an old problem, and maybe you've moved on. but I wanted to reply in case you're still wondering, and in case someone else has a similar problem.

The problem is likely that the googleapis is using a version of Javascript, EcmaScript v6, that is not compatible with Rhino + Trireme, the nodejs hosting engine within Apigee Edge.

As modules like the googleapis module get updated, they often migrate to a more current version of javascript. Unfortunately, this means those modules cannot be used in apps that run on Trireme. Another example of this is the current request module. You can read about that here: https://community.apigee.com/answers/51554/view.html

We're looking at a better solution for allowing arbitrary modules to be used in hosted logic within Apigee Edge. @Mukundha Madhavan may be able to tell you more about that.