Note that there are some explanatory texts on larger screens.

plurals
  1. PONODE_PATH is being ignored or not working
    primarykey
    data
    text
    <p>I'm trying to run my node app on a new server and am having some issues with the NODE_PATH environment variable. The app works fine on my local machine (OSX Lion) but not on the server (Redhat linux). When starting my app with <code>node app.js</code> from within my project directory <code>/development/nodeproject</code>, I get the following error :</p> <pre><code>Error: Cannot find module 'mod/core/models/Category' at Function._resolveFilename (module.js:334:11) at Function._load (module.js:279:25) at Module.require (module.js:357:17) at require (module.js:368:17) at /development/nodeproject/app.js:57:5 at Object.&lt;anonymous&gt; (/development/nodeproject/app.js:258:1) at Module._compile (module.js:432:26) at Object..js (module.js:450:10) at Module.load (module.js:351:31) at Function._load (module.js:310:12) </code></pre> <p><code>mod/core/models/Category</code> is the first require() in my app.js and looks like this: <code>var Category = require('mod/core/models/Category')</code>. So apparently node is not looking for modules in my project directory. </p> <p>I'm not sure why though, because I made the following changes (that are working just fine on my local machine).</p> <ul> <li>added <code>export NODE_PATH=/development/nodeproject</code> to my ~/.bash_profile</li> <li>ran <code>source ~/.bash_profile</code></li> <li>if I run <code>env</code> I see <code>NODE_PATH=/development/nodeproject</code> listed there</li> <li>in my app.js if I console log <code>process.env.NODE_PATH</code> I get <code>/development/framework</code> (should this output an array instead of a string?)</li> </ul> <p>Other information that might be relevant:</p> <ul> <li>I'm on node v0.6.7</li> <li>I'm doing all of this as root (sudo su -)</li> </ul> <p>At this point I'm not sure what else I can do. Any help would be greatly appreciated.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload