To be able to send myself text alerts from the server, sensors off line, high temps, low temps..., through my 4G router, I needed to install Node.js and Yarn.
Node.js® is an open-source, cross-platform JavaScript runtime environment.
Yarn is a package manager for your code. It allows you to use and share (e.g. JavaScript) code.
Log in as root privileged su:
Just in case, update your system...
Install Node.js. First you need to install a Global version. Later you will need to install a local variant in the directory of your code
Step 1 - Installing Yarn Globally.
The easiest way is via "npm" which you may wish to install first ... then install Yarn
You may wish to check the install using..
(mine outputs version: 1.22.21)
The code for connecting to the modem requires an addition package, called " minimist ". Install minimist ...
Node.js, Yarn and minimist are now globally installed and .
Step 2 - Installing Yarn locally into your new project.
First create a directory for the project.. I created mine in the root of my website
so it can easily be activated from local PHP code.
For this you can either use an FTP tool of Command Line Instructions (CLI). For CLI...
Change Directory to your website root.
Make a new directory. I called my project and folder " sendSMS ".
Change directory into the newly form one.
Initiate Yarn...
This will add a package.json configuration file and a yarn.lock file to your directory. The package.json contains configuration and your list of module dependencies. The yarn.lock file locks those dependencies to specific versions, making sure that the dependency tree is always consistent. To download and install all the dependencies in an existing Yarn-based project, use the install subcommand:
You will be asked ~8 (irrelevant) questions and pressing enter will just enter the default value, as show in the brackets. Change these if you wish.
To be able to FTP into the project directory, you much change ownership and accessability
Lastly, the Node.js file - sms-send.js - must have its accessabilty changed from 644 to 777 so to make it executable.
Project " sendSMS " is now set up with a project-specific version of Yarn.