Common issues and solutions

You can find solutions for the following common issues that you might encounter with the Open Enterprise SDK for Node.js runtime.

Node.js fails to run

Encoding issues

Node.js hangs

Node package manager

Native add-ons

Networking

Module CXXRT64 was not found

To resolve this issue, install the Language Environment® PTFs as described in Installing and configuring.

CEE3559S External variable 'variable name' was not found in DLL CXXRT64

To resolve this error, you need to install the Language Environment PTFs as described in Installing and configuring.

If the error persists after all the required PTFs are installed, check whether the STEPLIB environment variable is set. If it is, unset it by running the following command:
$ unset STEPLIB

For details, see CEE3559S External variable variable-name was not found in DLL dll-name.

Not enough storage available to load libnode.*.so

If you encounter a CEE3500S error similar to the following error message:
CEE3500S Not enough storage was available to load libnode.<version>.so.
From compile unit ZOSSYSTEM:../src/node_main.cc/ at entry point main at statement 147 at compile unit offset +000000001FE0AA6C at entry offset +000000000000008C at address 000000001FE0AA6C.

This error indicates that the address space size is not sufficient to load libnode.<version>.so. At least 300 MB of address space is needed to load libnode.<version>.so. You can run /bin/ulimit -A to check the current address space size.

You can increase the address space with the SETOMVS MVS system command SETOMVS MAXASSIZE=2147483647, which sets the address space size to 2 GB.

msgget: EDC5133I No space left on device error when running Node.js

When you run Node.js, you might see an error message that is similar to the following example:
msgget: EDC5133I No space left on device. (errno2=0x07050305)
CEE5207E The signal SIGABRT was received.
Ý1¨ + Done(131) node --version
 83951929      Abort   /ZOWE/node/node-v8.16.0-os390-s390x/bin/node

This error indicates that you have reached the message queue limit, and you need to set the __IPC_CLEANUP=1 environment variable to remove the existing message queues and run node --version to verify. Message queues are left when the previous Node.js processes do not end normally. If the node processes end normally, the message queues are cleaned.

You might need to increase the MAX message queue limit (IPCMSGNIDS). For details, see IPCMSGNIDS and IPCSEMNIDS.

Node.js abnormally exits

If your Node.js application spawns several processes, it might have reached the MAXPROCUSER limit. Check your system limits.

Node.js applications require at least 1 GB of memory above the bar. You can check the limit with the /bin/ulimit -M command and increase the MEMLIMIT.

JavaScript heap out of memory

If you encounter the following error message:
FATAL ERROR: NewSpace::Rebalance Allocation failed - JavaScript heap out of memory
Run the /bin/ulimit -M command to check the memory above the bar limit and increase the limit as needed. For details, see MEMLIMIT parameter.
You can also override the max heap size with the Node.js option:
--max-old-space-size=<newsizeinmb>
It is recommended to set newsizeinmb to 4096 or greater, which requires a minimum MEMLIMIT of 4 GB.

CEE3501S The module CRTEQCXS was not found

To resolve this issue, install the compiler runtime PTFs that are described in Installing and configuring.

Node.js outputs garbled characters followed by SyntaxError

If your file is incorrectly tagged, you might encounter the following error message:
path-to-file.js:1
�������K���M}��}]^
SyntaxError: Invalid or unexpected token
For details on how to resolve the issue, see the help information on the __UNTAGGED_READ_MODE* environment variables by running the following command:
$ node --help

Node.js outputs garbled characters

To make Node.js operate correctly, you need to set certain environment variables. Otherwise unreadable characters might be emitted to STDOUT or STDERR.

Source the .env script that is generated by setup.sh to set the required environment variables in the current shell by using the dot command (.):
$ . <nodejs_dir>/.env
If you still encounter unreadable characters, check the ccsid tag of your STDOUT or STDERR TTY:
$ chtag -p $SSH_TTY
If it is tagged as anything other than 1047 or untagged, you might need to change it back to untagged:
$ chtag -r $SSH_TTY
Alternatively, if you do not want to change the tag of your TTY, you can set the following environment variables before you invoke Node.js.
$ export NODE_STDOUT_CCSID=1047
$ export NODE_STDERR_CCSID=1047

Integrated Cryptographic Service Facility not started - hang

If the Node.js process hangs without any output, you can run the following command to confirm whether /dev/random is functional:
cat /dev/random | od | head

If /dev/random is not available, ensure that Integrated Cryptographic Service Facility (ICSF) is started.

Forceful termination

If the Node.js process needs to be terminated, you can try sending an abort signal by using the following command:
kill -3 <process_id_of_node_process>

The process ID can be obtained by using the ps command.

npm error: FSUM7332 syntax error: got (), expecting Word

When you encounter this error, you need to ensure that lib/node_modules/npm/bin/npm-cli.js is tagged as ISO8859-1.

Note: If the npm is invoked from the shell /bin/sh, the error in this case would be:
npm: line 1: syntax error near unexpected token `)'

FSUM7351 not found

If you encounter the following error when running npm:
node: FSUM7351 not found
Check whether the directory /usr/bin/env exists. If not configured, see the instructions in Verifying the env command path.

Installing npm on a GitHub repository is not successful

Use the following syntax to install npm and make sure you have Git version 2.14.4_zos_b09 installed:
$ npm install <github_repo_url>#branch

clang-14: error: unknown argument: '-qascii'

This error occurs when you build the npm with an older version of Node.js and the compiler options are cached into either the $HOME/.npm directory or the $HOME/.node-gyp directory. To resolve this issue, run the following commands to remove the cached directories:
$ rm -rf $HOME/.npm
$ rm -rf $HOME/.node-gyp

Compiler errors related to header files under /usr/include

If you encounter errors for header files under /usr/include during compilation, the cause might be that the required PTFs are not installed on your system. Check software prerequisites in Installing and configuring.

node_api.h file not found

If you encounter the following error message:
.../node-addon-api/napi.h:4:10: fatal error: 'node_api.h' file not found
#include <node_api.h> ^~~~~~~~~~~~ 1 error generated

Pass --nodedir=<nodejs_dir> to node-gyp [re]build or npm install. <nodejs_dir> contains the directory include/node where the file node_api.h is stored.

make: Unknown option -C

If you use an unsupported version of Make, you might encounter the following error message when running npm or node-gyp to build a C/C++ add-on:

gyp info spawn args [ 'BUILDTYPE=Release', '-C', 'build' ]
FSUM9380 make: Unknown option -C
Usage: make [-eEinpqrstuvVx] [-k|-S] [-c dir] [-D macro=value] [-f file] [macro=value ...] [target ...]
You need to download and install a newer version of Make. For details, see Installing and configuring.

iconv-lite warning: JavaScript files use encoding different from utf-8

When you encounter the following error message:
iconv-lite warning: javascript files use encoding different from utf-8** /path/to/.js:<line-number> ...
SyntaxError: Invalid or unexpected token
If you install the iconv-lite package by extracting it from a downloaded file, you need to tag the file that is specified in the error message as ISO8859-1. For details, see Tagging files for Enhanced ASCII support.

If the issue cannot be resolved by tagging files, you can try to delete the iconv-lite directory and install it by using the npm install command.

Node.js emits ERROR: listen EACCES: permission denied N1.N2.N3.N4:PORT

This error indicates that the server attempts to bind and listen to a port that is in the reserved port range. To resolve this error, override the reserved port range in the TCP/IP profile configuration by using the TCP/IP PORTRANGE statement and modify the reserved range of ports for a specified user ID.