node -r doesn't find global package


(Alphapage) #1

Hello,

I use docker node:8.

I installed my local package like this:
npm install -g ./mypackage

then:
npm ls -g
shows the globally installed package.

But if I RUN:
RUN node -r mypackage
then:
it throws a cannot resolve ‘mypackage’

Why doesn’t node find the global package ?

Thank you in advance for your help.


(Joshua) #2

ASFAIK, node doesn’t look for modules in your global npm install dir. Try running npm install ./mypackage (no -g).