It seems to me that I missed some very simple ones here ...
So, I am installing the npm library with npm install somelib . And from what I read, I would just have to do
var somelib = require('somelib');
But he cannot find anything. I have a node_modules directory in the root of my application, but it does not seem to pick it up.
I tried require.paths.push('node_modules') , but that does not help. The only thing that works is:
require.paths.unshift('.'); var somelib = require('node_modules/somelib/lib/somelib');
Which makes me feel like it is much more than I need to download the npm library. What am I doing wrong here? I thought installing modules in an application means I don't need futz with environment variables or roads?
Alex wayne
source share