Hello everyone,
Someone with expriences running NodeBB on IISNode?
I successfully host node apps on IIS through IISNode plugin, for example Ghost. There are three simple steps. First, create new IIS app with physical path to node app folder. Next, in that folder create web.config with rewrite and handlers rules. And the last step, in node app set the port that IIS chose for site running.
Unfortunatly, I cannot run NodeBB this way, server returns strange error.
Below are app.js and web.config:
// nodebb/app.js
.
.
.
"use strict";
/*global require, global, process*/
var nconf = require('nconf');
var IIS_PORT = process.env.PORT;
nconf.overrides({
'port': IIS_PORT,
'PORT': IIS_PORT
});
nconf.argv().env('__');
.
.
.
nodebb/web.config
<configuration>
<system.webServer>
<handlers>
<add name="iisnode" path="app.js" verb="*" modules="iisnode" />
</handlers>
<rewrite>
<rules>
<rule name="nodebb">
<match url="/*" />
<action type="Rewrite" url="app.js" />
</rule>
</rules>
</rewrite>
</system.webServer>
</configuration>
I also edit nodebb config.json
{
"url": "http://mydomain.cz/nodebb",
"secret": "loremipsum",
"database": "mongo",
"mongo": {
"host": "mydomain.cz",
"port": "27017",
"username": "",
"password": "",
"database": "NodeBB_test"
}
}
So, IIS starts Node process which starts NodeBB app.js script. In that script is dynamically set nconf.port
from global variable process.env.PORT
.
Ok, everything seems good but when I navigate browser to http://mydomain.cz/nodebb, server returns internal server error
14/4 16:22 [12408] - error: Error: Cannot find module './node_modules/mongodb/package.json'
at Function.Module._resolveFilename (module.js:336:15)
at Function.Module._load (module.js:278:25)
at Module.require (module.js:365:17)
at module.checkCompatibility (C:\inetpub\iisnode\NodeBB9\NodeBB\src\database\mongo.js:170:31)
at C:\inetpub\iisnode\NodeBB\node_modules\async\lib\async.js:731:23
at C:\inetpub\iisnode\NodeBB\node_modules\async\lib\async.js:172:37
at fn (C:\inetpub\iisnode\NodeBB\node_modules\async\lib\async.js:717:34)
at C:\inetpub\iisnode\NodeBB\node_modules\async\lib\async.js:1170:16
at C:\inetpub\iisnode\NodeBB\node_modules\async\lib\async.js:172:37
at C:\inetpub\iisnode\NodeBB\node_modules\async\lib\async.js:677:43
The same installation runs good without IIS by node app.js
command.
I tried NodeBB v1.0.0 and v0.9.0, reinstall and update mongodb, nconf and async.
Please, can someone help?