What do you mean, they're not requireable?

    [zlatko@zlatko-mint /tmp]$ node -e "require('express')"
    module.js:338
        throw err;
          ^
    Error: Cannot find module 'express'
    [...cut...]

    [zlatko@zlatko-mint /tmp]$ npm i -G express
    \
    [...cut...]

    [zlatko@zlatko-mint /tmp]$ node -e "require('express')"
    [zlatko@zlatko-mint /tmp]$ 


For the OP, it's possible to do it manually, ie: `
require('/home/zlatko/.nvm/versions/node/v4.0.0/lib/node_modules/gulp');` 
but it's not very scalable.

The problem is - when I bump my node version to, say, 4.0.1, I'd have to 
fix the path. Also, if it were you, you would not have a `/home/zlatko` 
part, but possibly /usr/lib/node_modules or similar.


I don't know if there's a node config option for something like that 
though, probably there isn't.

Zlatko

On Sunday, September 13, 2015 at 12:55:56 AM UTC+2, Sam Roberts wrote:
>
> On Thu, Sep 10, 2015 at 2:51 PM, Bgsosh <[email protected] <javascript:>> 
> wrote: 
> > When there is both a globally locally installed version of a module, 
> does 
> > anyone know if it is possible to require() the global version, over the 
> > local one? 
>
> Global modules are misnamed, they are only scripts that you intend to 
> run, they are NEVER requireable. 
>

-- 
Job board: http://jobs.nodejs.org/
New group rules: 
https://gist.github.com/othiym23/9886289#file-moderation-policy-md
Old group rules: 
https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
--- 
You received this message because you are subscribed to the Google Groups 
"nodejs" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/nodejs/3dfa3049-a3f1-4903-8ee7-bd49b4333cb5%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to