How to solve “404-cannot find module” error on Node.js V12

Node.js is an open source, cross-platform runtime environment for server-side and networking applications. Node.js applications are written in JavaScript, and can be run within the Node.js runtime on OSX, Microsoft Windows, Linux.

Node.js on Sage X3:

We come across scenario where x3 require integration with Node.js. It increases the efficiency of the development process as it fills the gap between frontend and backend applications.NodeJS module can be created by copying the JS code to the Syracuse folder that stores the modules.

Node. Js is faster because it is asynchronous and single-threaded. This means that all I/O operations don’t block any other operations.JavaScript code is also executed in the process main thread while all other I/O operations are executed in separate threads which results in almost no delays.

Error:404 cannot find module:

This blog helps in rectifying status code :404 cannot find module ‘syracuse-httpclient/lib/httpClient’ error, while executing Node.js through X3.

Fig 01: 404 Error

Status Code 404:

A 404-error message is a Hypertext Transfer Protocol (HTTP) status code indicating the server could not find the requested website. In other words, web browser can connect with the server, but the specific page we are trying to access can’t be reached.

Or the file or page that the browser is requesting wasn’t found on the server.

Sage x3, Node.js, Gumu file starts with the header as mentioned on below Fig 02

Fig 02: Node.js header

On V11, To identity the httpclient we can declare

var httpClient =require(“syracuse-httpclient/lib/httpClient”);

Solution for above error:

but in V12 we have to declare

var httpClient = require(“@sage/syracuse-lib/src/http-client/httpClient”);

Function calls the web service with httpClient.httpRequest. Then it checks the status code and parses the reply with jsxml. parse. It then extracts the result byBody.

This blog helps us in understanding integration of Node.js with X3 and solving status code: 404-cannot find module on syracuse-httpclient/lib/httpClient’ node.js on V12.

About Us

Greytrix – a globally recognized and one of the oldest Sage Development Partner is a one-stop solution provider for Sage ERP and Sage CRM organizational needs. Being acknowledged and rewarded for multi-man years of experience, we bring complete end-to-end assistance for your technical consultations, product customizations, data migration, system integrations, third-party add-on development and implementation competence. 

Greytrix caters to a wide range of Sage X3, a Sage Business Cloud Solution, offerings. Our unique GUMU™ integrations include Sage X3 for Sage CRMSalesforce.com, Dynamics 365 CRM and Magento eCommerce along with Implementation and Technical Support worldwide for Sage X3. Currently we are Sage X3 Implementation Partner in East Africa, Middle East, Australia, Asia, US, UK. We also offer best-in-class Sage X3 customization and development services, integrated applications such as POS | WMS | Payment Gateway | Shipping System | Business Intelligence | eCommerce and have developed add-ons such as Catch – Weight  and Letter of Credit and India Legislation for Sage X3 to Sage business partners, end users and Sage PSG worldwide. Greytrix Sales Commission App for Sage X3 simplifies commission calculations and postings on sales transactions.

The GUMU™ Cloud framework by Greytrix forms the backbone of cloud integrations that are managed in real-time for processing and execution of application programs at the click of a button.

Greytrix is a recognized Sage champion ISV Partner for GUMU™ Sage X3 – Sage CRM integration also listed on Sage Marketplace; GUMU™ integration for Sage X3 – Salesforce is a 5-star rated app listed on Salesforce AppExchange and GUMU™ integration for Dynamics 365 CRM – Sage ERP listed on Microsoft AppSource.

For more information on Sage X3 Integration and Services, please contact us at x3@greytrix.com, We would like to hear from you.