SAP Knowledge Base Article - Preview

3673794 - How to consume a custom file from a script in a CAP Node.js application

Symptom

  • A custom file was created in a CAP project directory and is referenced via require('<filename>'), but the deployed application crashes with the following error:
    Error: Cannot find module '../<filename>'
  • A custom file was created in a CAP project directory and is referenced via await read ('<filename>'), but the deployed application crashes with the following error:
     uncaughtException: ENOENT: no such file or directory, open '/home/vcap/app/<filename>'
  • There are no errors or issues while testing the CAP project locally. The issue happens only with the deployed application.


Read more...

Environment

SAP Cloud Application Programming Model

Product

SAP Cloud Application Programming Model 1.0

Keywords

cap, cloud application programming, cds, custom, file, json, error, cannot find module, uncaughtexception, enoent, no such file or directory, how to , KBA , BC-XS-CDX-NJS , SAP CAP – node.js runtime , How To

About this page

This is a preview of a SAP Knowledge Base Article. Click more to access the full version on SAP for Me (Login required).

Search for additional results

Visit SAP Support Portal's SAP Notes and KBA Search.