Error: Cannot find module 'cheerio' apigee

Dear Team

For the following package json including cheerio dependency:

"dependencies": { "cheerio": "latest", "express": "latest", "nodemailer": "^4.6.7", "request": "latest" }

in App logs error is thrown:

* Error: Cannot find module 'cheerio' Error: Cannot find module 'cheerio' at module.js:340:0 at module.js:280:0 at module.js:364:0 at require (module.js:380:0) at /organization/environment/api/server.js:4:0 at module.js:456:0 at module.js:474:0 at module.js:356:0 at module.js:312:0 at module.js:497:0 at startup (trireme.js:142:0) at trireme.js:923:0

on application invocation and not during deployment.

Deployment done using apigee tool:

apigeetool deploynodeapp -n xxx-project -d . -m server.js -o ...

I can find any results on the topic thus I am raising this question to the community.

Thank you,

Slobodanka

0 3 1,090
3 REPLIES 3

Hi @Slobodanka Vlaskovic, Apigee's Nodejs is based on an old version & it doesnt support all the modules. Moreover some modules are restricted.

Maybe cheerio is not supported.

You can try the new Hosted Target feature available in Edge New UI.

https://docs.apigee.com/api-platform/hosted-targets/hosted-targets-overview

https://docs.apigee.com/api-platform/hosted-targets/hosted-targets-tutorials#deploy-nodejs-from-your...

Hi @Siddharth Barahalikar

Thank you for your prompt response.

I am unable to deploy an app using Hosted Target not my node js neither that one from the tutorial sample:

Error in deployment for environment test.
The revision is deployed and traffic can flow, but flow may be impaired. Unexpected error occurred while processing the updates

Unfortunately, I don't have either build nor runtime logs in order to debug.

I have trial Apigee Edge account -eval organisation.

Thank you,

Slobodanka

Furthermore,

If I deploy via apigee tool rather then the Edge UI deployment goes well:

C:\Users\xxx\...>apigeetool deployhostedtarget -o xyz-eval -e test -n little-project -b /little-project -u user -p password "zzz-project" Revision 1 deployed environment = test base path = / URI = http://xyz-eval-test.apigee.netz/zzz-project URI = https://xyz-eval-test.apigee.net/zzz-project

but on API access App not found :

{
  • fault: {
    • faultstring: "APIProxy revision 1 of little-project does not exist in environment test of organization xyz-eval",
    • detail: {
      • errorcode: "messaging.runtime.ApplicationNotFound"

      }

    }

}