Closed rudifa closed 3 years ago
That error means IJavascript was installed using Node.js v12, but it has been launched using Node.js v14. Reinstalling Ijavascript again with Node.js v14 should fix the issue.
@n-riesco Thank you for the advice, it worked.
I have one (last?) question: does the node
process that runs on behalf of the ijskernel
read the environment variables?
My experiments below show that the node
option --es-module-specifier-resolution=node
(passed via NODE_OPTIONS) suffices to run pure ES6 files (using export
- import
), however the ijskernel
+ node
do not seem to heed it.
Do you have any suggestions here? Thank you, @rudifa
es6-module-in-node14 % ll
total 48
drwxr-xr-x 13 rudifarkas staff 416B Nov 1 22:06 .git
drwxr-xr-x 5 rudifarkas staff 160B Nov 1 22:30 .ipynb_checkpoints
-rw-r--r-- 1 rudifarkas staff 2.0K Nov 1 23:01 Untitled.ipynb
-rw-r--r-- 1 rudifarkas staff 128B Nov 1 20:41 log.js
-rw-r--r-- 1 rudifarkas staff 155B Nov 1 20:42 main.js
# GIVEN ENVVAR
es6-module-in-node14 % echo $NODE_OPTIONS
--es-module-specifier-resolution=node
# AND 2 FILES
es6-module-in-node14 % cat log.js
// log.js
const log = console.log.bind(console);
const info = console.info.bind(console);
export { info };
export default log;
es6-module-in-node14 % cat main.js
// main.js
import log from './log';
import { info } from './log';
log('log, default export/import works!');
info('info, named export/import works too!');
# THIS WORKS
es6-module-in-node14 % node main.js
log, default export/import works!
info, named export/import works too!
# HOWEVER ...
... in a lab cell the import fails
@rudifa Sorry I missed your reply. To answer your questions:
yes, ijskenel
opens a real Node.js CLI session (and thus, it's affected by NODE_OPTIONS; although strictly speaking this depends on the frontend and your setup).
the error you see is the same error you'd see if you try to run import log from '.log'
in a Node.js CLI session. For more info, see related issues: #210 #213 #215
Running
ijskernel
injupyter-lab
on a Mac works nicely, but only with anode version <= 12.9
.Now, it would be highly desirable to use the
node version 14.15
or later, notably because these support theES6 modules
.Am I missing something in my installation, or is this a general problem? What could I do to fix it?
My versions:
FYI, an an attempt to run it with node version 14.15 produces the following diagnostic: