click "win-x64/"
Choose "node.exe" to download.
2. After saving the file, upload node.exe to an /App_Data directory on the site.
3. Create a separate node_version.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);
4. Go to control panel->websites->...->Node.js APP to enable Node.js for this site.
5. Go to the site root directory and find web.config file, it should be:
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<system.webServer>
<handlers>
<add name="httpPlatformHandler" path="*" verb="*" modules="httpPlatformHandler" />
</handlers>
<httpPlatform processPath="node" arguments="node_version.js" startupTimeLimit="20" startupRetryCount="1" stdoutLogEnabled="true" stdoutLogFile=".\log.txt">
<environmentVariables>
<environmentVariable name="PORT" value="%HTTP_PLATFORM_PORT%" />
<environmentVariable name="NODE_ENV" value="production" />
</environmentVariables>
</httpPlatform>
</system.webServer>
</configuration>
6. Change it to(Please use the real path of your node.exe file):
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<system.webServer>
<handlers>
<add name="httpPlatformHandler" path="*" verb="*" modules="httpPlatformHandler" />
</handlers>
<httpPlatform processPath="H:\root\home\xxx-001\www\xxx\App_Data\node.exe" arguments="node_version.js" startupTimeLimit="20" startupRetryCount="1" stdoutLogEnabled="true" stdoutLogFile=".\log.txt">
<environmentVariables>
<environmentVariable name="PORT" value="%HTTP_PLATFORM_PORT%" />
<environmentVariable name="NODE_ENV" value="production" />
</environmentVariables>
</httpPlatform>
</system.webServer>
</configuration>
7. Access the site to check Node.js version:
Article ID: 2205, Created: November 16, 2021 at 9:47 PM, Modified: February 27 at 1:32 AM