Custom node.js version

Due to the release schedule of node.js versions, you may find your application requires a newer version than what’s available on the server.  Fortunately, running a custom version of node.js is relatively easy and only involves uploading two files to a site:  node.exe and iisnode.yml


node.exe

Visit https://nodejs.org/en/download/releases/ to view the available versions.  Then click the “Downloads” link for the preferred version.


Then click “win-x64/”.


And finally “node.exe” to download the executable.


After saving the file, upload it to hosted site.  When uploading the file, make sure to place node.exe outside the document root or into a directory that only the application has access to, like /site/wwwroot/app_data.  For this example, node.exe is being placed into the root directory of the site.


iisnode.yml

Create a new text file and name it “iisnode.yml”.  In that file add the following line:  nodeProcessCommandLine: “server path to file”

For the example above where node.exe was placed in the site root, the syntax would be:


nodeProcessCommandLine: "C:\home\node.exe"


To test the update, create a separate .js file and add the following syntax to display the version of node.js the site is using:


var http = require('http');
http.createServer(function(req,res) {
  res.writeHead(200, {'Content-Type': 'text/html'});
  res.end('Node.js ' + process.version);
}).listen(process.env.PORT);


Or download node.zip for a sample iisnode.yml and test script.  Then upload iisnode.yml (and the test script) to the document root.


Then viewing the test file through a browser should show the new node.js version.

I hope this helps you with getting your node.js applications to run.

Visit Everleap.com to learn more about our cloud hosting and node.js hosting solutions.


No responses yet

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.



oui décor