When testing your Node.js application, it is useful to be able to start the application from the command-line. By default, cPanel does not add Node.js to your $PATH. The following will walk you through adding it
You may receive the following output when attempting to use Node after installation, or after you install a module from NPM:
/usr/bin/env: node: No such file or directory
To have Node be available for your modules on the command-line, or for it to be used directly on the command-line, you need to add it to your PATH, but first, you must determine where Node.js is installed.
We offer multiple versions of Node.js. First, determine the version of ea-NodeJS you have installed:
# on RPM based systems
rpm -qa | grep ea-nodejs
# on Ubuntu based systems
dpkg -l | grep ea-nodejs
~# rpm -qa | grep ea-nodejs
Then, add this version to your PATH:
Notice the match between the package version "ea-nodejs18" and the path.
To ensure this change is permanent, add it to your .bashrc file with the correct nodejs version:
echo 'export PATH=/opt/cpanel/ea-nodejsXX/bin:$PATH' >> ~/.bashrc
For more information on the ~/.bashrc file, see this article: How to set environmental variables in .bashrc