problems with node paths in prod env
<p>I have my first node server app running fine on localhost, but in a digitalocean (ubuntu) environment I can't get the paths to work.</p>

<p>This line</p>

<pre><code>require("./lib/dbHelper").initilize();
</code></pre>

<p>Generate this error</p>

<pre><code>Error: Cannot find module './lib/dbHelper'
at Function.Module._resolveFilename (module.js:339:15)
at Function.Module._load (module.js:290:25)
at Module.require (module.js:367:17)
at require (internal/module.js:16:19)
at Object.&lt;anonymous&gt; (/var/www/wsApp/app.js:18:1)
at Module._compile (module.js:413:34)
at Object.Module._extensions..js (module.js:422:10)
at Module.load (module.js:357:32)
at Function.Module._load (module.js:314:12)
at Function.Module.runMain (module.js:447:10)
</code></pre>

<p>And this line</p>

<pre><code>let User = require("../models/User");
</code></pre>

<p>generates this error</p>

<pre><code>Error: Cannot find module '../models/User'
at Function.Module._resolveFilename (module.js:339:15)
at Function.Module._load (module.js:290:25)
at Module.require (module.js:367:17)
at require (internal/module.js:16:19)
at Object.&lt;anonymous&gt; (/var/www/wsApp/routes/auth.js:5:12)
at Module._compile (module.js:413:34)
at Object.Module._extensions..js (module.js:422:10)
at Module.load (module.js:357:32)
at Function.Module._load (module.js:314:12)
at Module.require (module.js:367:17)
</code></pre>

<p>I have looked here (<a href="https://gist.github.com/branneman/8048520" rel="nofollow">https://gist.github.com/branneman/8048520</a>) for solutions and I have tried suggestions 3, 4.2 and 6 but nothing changes the error messages.</p>

<p>Worth noting is that this line seems to work fine</p>

<pre><code>app.use("/", require("./routes/auth.js"));
</code></pre>

<p>Being new to node I don't quite understand the path mappings, and it seems strange that this last one would work while the first one doesn't since they both use the dot syntax...</p>