yunabe / tslab

Interactive JavaScript and TypeScript programming with Jupyter
Apache License 2.0
702 stars 44 forks source link

Cannot find module 'tslab'. #21

Closed arvind47d closed 4 years ago

arvind47d commented 4 years ago

I followed the instructions to get tslab on my computer; I get 1:24 - Cannot find module 'tslab'.

I am using windows.

$ jupyter --version

jupyter core     : 4.6.1
jupyter-notebook : 6.0.2
qtconsole        : not installed
ipython          : 7.9.0
ipykernel        : 5.1.3
jupyter client   : 5.3.4
jupyter lab      : 1.2.3
nbconvert        : 5.6.1
ipywidgets       : 7.5.1
nbformat         : 4.4.0
traitlets        : 4.3.3
$tslab install
Running python <<user>>\AppData\Roaming\npm\node_modules\tslab\python\install.py --tslab=tslab.cmd
Installing TypeScript kernel spec
Installing JavaScript kernel spec
$tslab --version
tslab 1.0.4

Can you please help?

arvind47d commented 4 years ago

I actually found the fix by looking into the docker file. The notebook needs to have a package.json to maintain dependencies and have a local node_modules.

yunabe commented 4 years ago

The notebook needs to have a package.json to maintain dependencies and have a local node_modules.

It's weird. tslab is designed to be able to use Node.js modules (@types/node) and "tslab" module even if these libraries are not installed locally. Notebooks don't have to be in directories with package.json. If you could not import "tslab" without package.json, it's a bug.

What was the code you executed?

arvind47d commented 4 years ago

I executed the simple example from your get started article after installation to verify setup.

import * as tslab from 'tslab';

console.log('Hello, tslab!')
console.log('Versions:', tslab.versions)
yunabe commented 4 years ago

Then, this is a bug though I can not reproduce it.

It would be great if you can check how the special logic about "tslab" (forwardTslabPath) works when this bug is reproducible by installing tslab from source.

Here is a guide of installing tslab from source: https://github.com/yunabe/tslab/blob/master/docs/developing.md

andreasCanSee commented 4 years ago

I actually found the fix by looking into the docker file. The notebook needs to have a package.json to maintain dependencies and have a local node_modules.

I ran into the same issue but couldn't reproduce your solution. Would you mind to share the code of your solution, please?

yunabe commented 4 years ago

I'm closing this bug because I can not reproduce it and there is no additional information. If you see a similar problem, please file another bug with details.