n-riesco / ijavascript

IJavascript is a javascript kernel for the Jupyter notebook
Other
2.18k stars 187 forks source link

Updated NVM version, got error "no such file or directory" ".../bin/node" #280

Closed prothSFDC closed 1 year ago

prothSFDC commented 1 year ago

Recently updated my nvm version to 18.15.0 but upon starting up a nodebook with the JavaScript kernel, it was giving me an error similar to the following as soon as it would load up

[I 2023-03-31 11:03:52.759 LabApp] Build is up to date
[E 2023-03-31 11:03:57.998 ServerApp] Failed to run command:
    ['~/.nvm/versions/node/v16.17.1/bin/node', 
'~/.nvm/versions/node/v16.17.1/lib/node_modules/ijavascript/lib/kernel.js', 
'--hide-undefined', 
'~/Library/Jupyter/runtime/kernel-fb3354aa-48f5-498e-8741-1721dbb85342.json', 
'--protocol=5.1']

I installed the iJavaScript npm package, and linked it, and still had the error continue to occur:

npm install -g ijavascript
ijsinstall --install=global --spec-path=full

the old version was indeed v16.17.1, but the new version of v18.15.0 wasn't being recognized.

prothSFDC commented 1 year ago

After reviewing further, it seems that you can list the jupyter kernels like the following:

jupyter kernelspec list
  javascript    ~/Library/Jupyter/kernels/javascript
  python3       ~/opt/anaconda3/share/jupyter/kernels/python3

That showed me the javascript kernel held here: ~/Library/Jupyter/kernels/javascript/kernel.json

it turns out that kernel.json file does indeed hold the link to the old nvm version and global path

{
    "argv":
    [
        "~/.nvm/versions/node/v18.15.0/bin/node",
        "~/.nvm/versions/node/v18.15.0/lib/node_modules/ijavascript/lib/kernel.js",
        "--hide-undefined","{connection_file}","--protocol=5.1"
    ],
    "display_name":"JavaScript (Node.js)",
    "language":"javascript"
}

Changing the versions there and then rerunning jupyter seemed to solve the problem.

n-riesco commented 1 year ago

@prothSFDC ~/Library/Jupyter/kernels/javascript is a local kernel spec. To update local kernel specs, run ijsinstall without the option --global:

ijsinstall --spec-path=full