pixiedust / pixiedust_node

Jupyter magic to allow Node.js code to run in a notebook
https://medium.com/ibm-watson-data-lab/running-node-js-notebooks-in-watson-studio-a8f6545d8299
Apache License 2.0
213 stars 24 forks source link

Installing Node if it's not there #1

Open glynnbird opened 7 years ago

glynnbird commented 7 years ago

If pixiedust_node is installed, could it conceivably install Node.js (node/npm) on the target system? If so how?

@DTAIEB said

"yeah, I think we could do a command line download/install of node under PIXIEDUST_HOME directory when we detect it’s not there"

Currently, we assume node is in the PATH so we run

self.ps = subprocess.Popen( ('node', path), stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.STDOUT)

This could be changed to:

home = get_ipython().home_dir
self.ps = subprocess.Popen( ('node', path), stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.STDOUT, cwd = home)

This would ensure node's home directory is the same as Pixiedust's.

glynnbird commented 7 years ago

So this module now detects whether it can find 'node' before attempting to run it. This is the first stage of doing this ticket.:)

see: https://github.com/ibm-cds-labs/pixiedust_node/commit/c9d142f334962c590007bbc53b9e5c24e86fc35e