V3 rest-api in errored state

V3 rest-api in errored state

Problem statement: V3 rest-api services in errored state after restart of services or linux patching as shown in the below message as shown below


Error messages in the /opt/infoworks/logs/rest/error-1.log is similar to the messages shown below:

Error: The module '/opt/infoworks/platform/rest-api-service/node_modules/bcrypt/lib/binding/bcrypt_lib.node' was compiled against a different Node.js version using NODE_MODULE_VERSION 79. This version of Node.js requires NODE_MODULE_VERSION 57. Please try re-compiling or re-installing the module (for instance, using `npm rebuild` or `npm install`).

Roo****t cause: This means that there is a conflict in the node version in ${IW_HOME}/platform/rest-api-service/package.json and the node version installed, by default, with the infoworks product. The default version can be found by running the below commands on the edge node.

source /opt/infoworks/bin/env.sh node -v

Solution:

  1. Change Directory to ${IW_HOME}/platform/rest-api-service.

  2. Open the package.json file and remove the “node” line in the “dependencies” key (see below)

"node": "^12.13.0"
  1. Back up and delete the package-lock.json file

  2. Back up and delete the node_modules folder

  3. Run the command

npm install
  1. Run the command

npm start

Applicable Infoworks versions:

v4.2.x