tslab
tslab copied to clipboard
tslab cannot find globally-installed modules even when NODE_PATH is set
Hi & thanks for your work putting tslab together!
(I believe this is separate from #40, which is talking about the built-in fs module that works fine for me).
I'm trying to use tslab in a containerised environment with some globally-installed packages e.g.:
RUN npm install -g \
@tensorflow/[email protected] \
@tensorflow/[email protected] \
@tensorflow/[email protected] \
The packages get installed in the /usr/lib/node_modules folder.
I understand that NodeJS require can't find globally-installed packages by default, but setting the NODE_PATH environment variable can fix it. However, not with tslab it seems...
Is there some other way to enable this?
Expected behavior:
tslab/jslab kernels should be able to see global packages - either always as a design decision, or else iff the NODE_PATH environment variable is set.
Observed behavior:
Setting the environment variable in my container, I can see:
process.env.NODE_PATHis set, inside thejslabkernel, and- Standard
nodein a terminal can require the packages correctly if referenced in a script file, but - I cannot e.g.
require("@tensorflow/tfjs")in the kernel - getting error likeCannot find module '@tensorflow/tfjs' or its corresponding type declarations.
Setup:
- tslab version: 1.0.15
- Kernel: JavaScript (
jslab) - Platform: Linux (Ubuntu 18.04)
^ My current workaround to this is to just install the packages higher up in the filesystem, instead of using -g flag - which enables the resolver to find them.