How I Work Around The require(“../../../../../../../”) Problem In NodeJS
1–10 of 44 posts
Re: How I Work Around The require(“../../../../../../../”) Problem In NodeJS
#2Re: How I Work Around The require(“../../../../../../../”) Problem In NodeJS
#3Then your other project in the same file system can just require like a first class public npm module.
Re: How I Work Around The require(“../../../../../../../”) Problem In NodeJS
#4Re: How I Work Around The require(“../../../../../../../”) Problem In NodeJS
#5Another approach, which I favor now, is to place modules directly into the default locations, such as /usr/lib/share/perl5 and etc.--usually there are a number of paths Perl looks at by default. It's then just a matter of saying 'use MyModule;' in code.
Is node.js similar, in having one or more include paths set by default, and could files be put there, to where you never have to refer to something by relative location again?
Re: How I Work Around The require(“../../../../../../../”) Problem In NodeJS
#6Re: How I Work Around The require(“../../../../../../../”) Problem In NodeJS
#7I've never worked on a Node project with directories that nested more than 3 or 4 levels deep, so I don't see this as a "problem" (but maybe the article makes a case that it is).
Re: How I Work Around The require(“../../../../../../../”) Problem In NodeJS
#8can't you install a private npm module by npm link? That won't touch the npm servers [1]. Then your other project in the same file system can just require like a first class public npm module. [1] https://www.npmjs.org/doc/cli/npm-link.html
Re: How I Work Around The require(“../../../../../../../”) Problem In NodeJS
#9Re: How I Work Around The require(“../../../../../../../”) Problem In NodeJS
#10can't you install a private npm module by npm link? That won't touch the npm servers [1]. Then your other project in the same file system can just require like a first class public npm module. [1] https://www.npmjs.org/doc/cli/npm-link.html