ijavascript
ijavascript copied to clipboard
Requirements to install IJavascript using Node.js v9, v10, v11 and above
I'm opening this issue so that I can close a number of duplicate issues reporting a failure to install IJavascript on Node.js v9 and above:
- #165
- #179
- #182
- #183
IJavascript depends on zeromq v4 that only provides prebuilt binaries to Node.js versions up to 8.
Users of Node.js v9 and above need the following requirements to install IJavascript:
-
the requirements to run
node-gyp
:-
python v2.7 (note that it is possible to install
python v2
andpython v3
on the same machine) -
make
- a C/C++ compiler (e.g.
gcc
)
-
python v2.7 (note that it is possible to install
- the library
libzmq
:- (option 1) the user's machine has internet access to https://github.com/zeromq/libzmq and it isn't behind a proxy (see issue https://github.com/zeromq/zeromq.js/issues/260 ). This option should work by default
- (option 2)
libzmq
is already installed in the user's machine. This option requires the use of the flag--zmq-external
.
For example, on an Ubuntu machine without internet access, the user would need to run the following:
$ sudo apt install libzmq3-dev build-essential python2.7
$ npm install -g ijavascript --zmq-external
I'm considering the following solutions to this issue:
-
Upgrade dependency to
zeromq v5
.- Pros:
- quickest solution
- Cons:
- drop support for Node.js v4 and v0.10
- @lgeiger I'm guessing from https://github.com/nteract/nteract/pull/3388 that the upcoming
zeromq-ng
requires changes injmp
, doesn't it?
- Pros:
-
Provide missing prebuilt binaries for
zeromq v4
.- Pros:
- keep support for Node.js v4 and v0.10
- Cons:
- not a solution for users that can't access github
- not a solution, only postpones the decision on upgrading
zeromq
- Pros:
-
Distribute IJavascript as an electron app.
- Pros:
- users don't need to install any requirements
- users can easily install kernels for different versions of Node.js on the same machine
- Cons:
- only postpones the decision on upgrading
zeromq
- electron apps are heavy
- only postpones the decision on upgrading
- Pros:
-
...
Yay for dropping support for old node that is before the long term stable releases.
This is not a con:
drop support for Node.js v4 and v0.10
We should be actively discouraging people from using Node versions (v6 and older) that have reached their end of life 👍
Yeah, get rid of those ancient versions!
I am new to Mac and stuck on the second last step of the installation instruction (the first 4 steps went well): npm install -g ijavascript
I have the latest Node (12.4.0) and NPM (6.9.0). It seems that the error is the c compiler (where is the config.log
?):
checking whether the C compiler works... no
configure: error: in `/usr/local/lib/node_modules/ijavascript/node_modules/zeromq/zmq/zeromq-4.2.2':
configure: error: C compiler cannot create executables
See `config.log' for more details
I do have the gcc compiler:
(base) Kais-MBP:~ kai$ gcc -v
Configured with: --prefix=/Library/Developer/CommandLineTools/usr --with-gxx-include-dir=/Library/Developer/CommandLineTools/SDKs/MacOSX10.14.sdk/usr/include/c++/4.2.1
Apple LLVM version 10.0.1 (clang-1001.0.46.4)
Target: x86_64-apple-darwin18.6.0
Thread model: posix
InstalledDir: /Library/Developer/CommandLineTools/usr/bin
Also, I have both python 2 (/usr/local/bin/python2
) and python 3 (/anaconda3/bin/python3
). Calling 'python' will run python 3 (3.7.3) not python 2 (2.7.16); I am not sure if this is an issue.
Below is the full output:
(base) Kais-MBP:~ kai$ npm install -g ijavascript
/usr/local/bin/ijs -> /usr/local/lib/node_modules/ijavascript/bin/ijavascript.js
/usr/local/bin/ijsconsole -> /usr/local/lib/node_modules/ijavascript/bin/ijsconsole.js
/usr/local/bin/ijsinstall -> /usr/local/lib/node_modules/ijavascript/bin/ijsinstall.js
/usr/local/bin/ijskernel -> /usr/local/lib/node_modules/ijavascript/lib/kernel.js
/usr/local/bin/ijsnotebook -> /usr/local/lib/node_modules/ijavascript/bin/ijsnotebook.js
> [email protected] install /usr/local/lib/node_modules/ijavascript/node_modules/zeromq
> node scripts/prebuild-install.js || (node scripts/preinstall.js && node-gyp rebuild)
prebuild-install WARN install No prebuilt binaries found (target=12.4.0 runtime=node arch=x64 platform=darwin)
Building libzmq for darwin
checking for a BSD-compatible install... /usr/bin/install -c
checking whether build environment is sane... yes
checking for a thread-safe mkdir -p... config/install-sh -c -d
checking for gawk... no
checking for mawk... no
checking for nawk... no
checking for awk... awk
checking whether make sets $(MAKE)... yes
checking whether make supports nested variables... yes
checking whether UID '501' is supported by ustar format... yes
checking whether GID '20' is supported by ustar format... yes
checking how to create a ustar tar archive... gnutar
checking whether make supports nested variables... (cached) yes
checking for gcc... x86_64-apple-darwin13.4.0-clang
checking whether the C compiler works... no
configure: error: in `/usr/local/lib/node_modules/ijavascript/node_modules/zeromq/zmq/zeromq-4.2.2':
configure: error: C compiler cannot create executables
See `config.log' for more details
child process exited with code 77
make: Entering directory '/usr/local/lib/node_modules/ijavascript/node_modules/zeromq/build'
CXX(target) Release/obj.target/zmq/binding.o
../binding.cc:28:10: fatal error: 'zmq.h' file not found
#include <zmq.h>
^~~~~~~
1 error generated.
make: *** [zmq.target.mk:129: Release/obj.target/zmq/binding.o] Error 1
make: Leaving directory '/usr/local/lib/node_modules/ijavascript/node_modules/zeromq/build'
gyp ERR! build error
gyp ERR! stack Error: `make` failed with exit code: 2
gyp ERR! stack at ChildProcess.onExit (/usr/local/lib/node_modules/npm/node_modules/node-gyp/lib/build.js:262:23)
gyp ERR! stack at ChildProcess.emit (events.js:200:13)
gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:272:12)
gyp ERR! System Darwin 18.6.0
gyp ERR! command "/usr/local/bin/node" "/usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd /usr/local/lib/node_modules/ijavascript/node_modules/zeromq
gyp ERR! node -v v12.4.0
gyp ERR! node-gyp -v v3.8.0
gyp ERR! not ok
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] install: `node scripts/prebuild-install.js || (node scripts/preinstall.js && node-gyp rebuild)`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] install script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR! /Users/kai/.npm/_logs/2019-06-12T23_55_51_043Z-debug.log
(base) Kais-MBP:~ kai$
@kaimdx This may be an issue with your dev tools. Please, could you open a new issue?
To locate the 'config.log', I'd try to run:
find /usr/local/lib/node_modules/ijavascript/node_modules/zeromq -name config.log
Hi! I successfully installed ijavascript as this:
conda update -c conda-forge nodejs
conda activate base
npm config set python "C:\Python27\python.exe"
(**open cmd as administrator**) npm install --global --production windows-build-tools
npm install -g node-gyp
npm install -g ijavascript
ijsinstall
However, I open jupyter notebook and create javascript notebook, and it can't execute js code cell, and cmd shows error:
[I 10:08:56.307 NotebookApp] KernelRestarter: restarting kernel (1/5), new random ports internal/modules/cjs/loader.js:613 throw err; ^
Error: Cannot find module '../build/Release/zmq.node' Require stack:
- C:\Users\welcome2\Miniconda3\node_modules\ijavascript\node_modules\zeromq\lib\index.js
- C:\Users\welcome2\Miniconda3\node_modules\ijavascript\node_modules\zeromq\index.js
- C:\Users\welcome2\Miniconda3\node_modules\ijavascript\node_modules\jmp\index.js
- C:\Users\welcome2\Miniconda3\node_modules\ijavascript\node_modules\jp-kernel\lib\jp-kernel.js
- C:\Users\welcome2\Miniconda3\node_modules\ijavascript\node_modules\jp-kernel\index.js
- C:\Users\welcome2\Miniconda3\node_modules\ijavascript\lib\kernel.js at Function.Module._resolveFilename (internal/modules/cjs/loader.js:610:15) at Function.Module._load (internal/modules/cjs/loader.js:526:27) at Module.require (internal/modules/cjs/loader.js:666:19) at require (internal/modules/cjs/helpers.js:16:16) at Object.
(C:\Users\welcome2\Miniconda3\node_modules\ijavascript\node_modules\zeromq\lib\index.js:6:11) at Module._compile (internal/modules/cjs/loader.js:759:30) at Object.Module._extensions..js (internal/modules/cjs/loader.js:770:10) at Module.load (internal/modules/cjs/loader.js:628:32) at Function.Module._load (internal/modules/cjs/loader.js:555:12) at Module.require (internal/modules/cjs/loader.js:666:19)
Then, I download libzmq and build using vs 2019, now I get zeromq-4.3.2\bin2\bin\Release\libzmq-v141-mt-4_3_2.dll, how to use this to make npm install zeromq
successful?
I've just released [email protected]
that depends jp-kernel@2
and uses the new prebuilt binaries for zeromq@5
. This should make life easier for those using recent versions of Node.
I had the same issue on MacOS
and nvm
. I guess something is wrong in this case with the global installation. So, I had to install it locally
npm init
npm install --save ijavascript
(without -g
key)
added "start": "ijsnotebook"
to the package.json
npm start
Not sure how this bug happens, but I still have this problem even you update to use zeromq@5
.
The way I solve this:
Step1. npm install -g zeromq
Step2. npm install -g ijavascript
npm detect a newer version zeromq@6
so it skip the installation of dependency zeromq@5
.
And then every thing works.
Maybe you should consider using zeromq@6
?
I don't have plans to upgrade to zeromq@6 while it remains in beta.
Also note that zeromq@6 still lacks some binaries (e.g. see https://github.com/zeromq/zeromq.js/issues/396).
I think I found the culprit of this problem. In my windows box, all the npm installed module are line up nicely in the folder: "C:\Users<user>\AppData\Roaming\npm\node_modules", including:
- ijavascript
- node-gyp
- zeromq
However, the kernel complains of not finding the zmq.node in the folder: "C:\Users<user>\AppData\Roaming\npm\node_modules\ijavascript\node_modules"
So, I just copy manually the zeromq folder from [...\npm\node_modules] to [...\npm\node_modules\ijavascript\node_modules] and the kernel start working without a hitch in the notebook.
The zeromq folder was actually there, only missing the /Release folder that contains the zmq.node
In my opinion looks like just a matter of missing "/" in the path variable. The ijavascript is not supposed to have its own /node_modules/, isn't it?
As a recap, all the installation I did were:
npm install --global --production windows-build-tools --vs2015
npm install -g zeromq@5
npm install -g node-gyp
npm install -g ijavascript
ijsinstall
Good stuff guys!
Thank you @ozbigcat This solution worked for me
Thanks @ozbigcat It worked for me too!
Thank you so much @ozbigcat The solution worked perfectly for me, id been digging for a day!
I am new to programming, and am attempting to setup my Jupyternotebook with the JS kernel as well.
After spending 5-6 hours trying everything I am completely stuck. The issue seems to be with compatibility.
npm install -g zeromq@5
npm ERR! code 1
npm ERR! path C:\Users\Kolo\AppData\Roaming\npm\node_modules\zeromq
npm ERR! command failed
npm ERR! command C:\Windows\system32\cmd.exe /d /s /c node-gyp-build || npm run build:libzmq
npm ERR! prepare-build
npm ERR! Downloading libzmq for Windows
npm ERR! Download finished
npm ERR! binding.cc
npm ERR! C:\Users\Kolo\AppData\Roaming\npm\node_modules\zeromq\binding.cc(399,10): warning C4996: 'Nan::MakeCallback': was declared deprecated [C:\Users\Kolo\AppData\Roaming\npm\node_modules\zeromq\build\zmq.vcxproj]
npm ERR! C:\Users\Kolo\AppData\Roaming\npm\node_modules\zeromq\binding.cc(407,10): warning C4996: 'Nan::MakeCallback': was declared deprecated [C:\Users\Kolo\AppData\Roaming\npm\node_modules\zeromq\build\zmq.vcxproj]
npm ERR! C:\Users\Kolo\AppData\Roaming\npm\node_modules\zeromq\binding.cc(458,10): warning C4996: 'Nan::MakeCallback': was declared deprecated [C:\Users\Kolo\AppData\Roaming\npm\node_modules\zeromq\build\zmq.vcxproj]
npm ERR! C:\Users\Kolo\AppData\Roaming\npm\node_modules\zeromq\binding.cc(473,10): warning C4996: 'Nan::MakeCallback': was declared deprecated [C:\Users\Kolo\AppData\Roaming\npm\node_modules\zeromq\build\zmq.vcxproj]
npm ERR! C:\Users\Kolo\AppData\Roaming\npm\node_modules\zeromq\binding.cc(814,10): warning C4996: 'Nan::MakeCallback': was declared deprecated [C:\Users\Kolo\AppData\Roaming\npm\node_modules\zeromq\build\zmq.vcxproj]
npm ERR! C:\Users\Kolo\AppData\Roaming\npm\node_modules\zeromq\binding.cc(893,10): warning C4996: 'Nan::MakeCallback': was declared deprecated [C:\Users\Kolo\AppData\Roaming\npm\node_modules\zeromq\build\zmq.vcxproj]
npm ERR! C:\Users\Kolo\AppData\Local\node-gyp\Cache\21.6.2\include\node\v8-local-handle.h(253,42): error C2338: static_assert failed: 'type check' [C:\Users\Kolo\AppData\Roaming\npm\node_modules\zeromq\build\zmq.vcxproj]
npm ERR! (compiling source file '../binding.cc')
npm ERR! C:\Users\Kolo\AppData\Local\node-gyp\Cache\21.6.2\include\node\v8-local-handle.h(253,42):
npm ERR! the template instantiation context (the oldest one first) is
npm ERR! C:\Users\Kolo\AppData\Roaming\npm\node_modules\zeromq\node_modules\nan\nan_callbacks_12_inl.h(175,41):
npm ERR! see reference to function template instantiation 'v8::Localv8::Value::Localv8::Data(v8::Localv8::Data)' being compiled
npm ERR! C:\Users\Kolo\AppData\Roaming\npm\node_modules\zeromq\node_modules\nan\nan_callbacks_12_inl.h(175,13):
npm ERR! see the first reference to 'v8::Localv8::Value::Local' in 'Nan::imp::FunctionCallbackWrapper'
npm ERR!
npm ERR!
npm ERR! > [email protected] build:libzmq
npm ERR! > node-gyp rebuild
npm ERR!
npm ERR!
npm ERR!
npm ERR! prepare-build
npm ERR! binding.cc
npm ERR! C:\Users\Kolo\AppData\Roaming\npm\node_modules\zeromq\binding.cc(399,10): warning C4996: 'Nan::MakeCallback': was declared deprecated [C:\Users\Kolo\AppData\Roaming\npm\node_modules\zeromq\build\zmq.vcxproj]
npm ERR! C:\Users\Kolo\AppData\Roaming\npm\node_modules\zeromq\binding.cc(407,10): warning C4996: 'Nan::MakeCallback': was declared deprecated [C:\Users\Kolo\AppData\Roaming\npm\node_modules\zeromq\build\zmq.vcxproj]
npm ERR! C:\Users\Kolo\AppData\Roaming\npm\node_modules\zeromq\binding.cc(458,10): warning C4996: 'Nan::MakeCallback': was declared deprecated [C:\Users\Kolo\AppData\Roaming\npm\node_modules\zeromq\build\zmq.vcxproj]
npm ERR! C:\Users\Kolo\AppData\Roaming\npm\node_modules\zeromq\binding.cc(473,10): warning C4996: 'Nan::MakeCallback': was declared deprecated [C:\Users\Kolo\AppData\Roaming\npm\node_modules\zeromq\build\zmq.vcxproj]
npm ERR! C:\Users\Kolo\AppData\Roaming\npm\node_modules\zeromq\binding.cc(814,10): warning C4996: 'Nan::MakeCallback': was declared deprecated [C:\Users\Kolo\AppData\Roaming\npm\node_modules\zeromq\build\zmq.vcxproj]
npm ERR! C:\Users\Kolo\AppData\Roaming\npm\node_modules\zeromq\binding.cc(893,10): warning C4996: 'Nan::MakeCallback': was declared deprecated [C:\Users\Kolo\AppData\Roaming\npm\node_modules\zeromq\build\zmq.vcxproj]
npm ERR! C:\Users\Kolo\AppData\Local\node-gyp\Cache\21.6.2\include\node\v8-local-handle.h(253,42): error C2338: static_assert failed: 'type check' [C:\Users\Kolo\AppData\Roaming\npm\node_modules\zeromq\build\zmq.vcxproj]
npm ERR! (compiling source file '../binding.cc')
npm ERR! C:\Users\Kolo\AppData\Local\node-gyp\Cache\21.6.2\include\node\v8-local-handle.h(253,42):
npm ERR! the template instantiation context (the oldest one first) is
npm ERR! C:\Users\Kolo\AppData\Roaming\npm\node_modules\zeromq\node_modules\nan\nan_callbacks_12_inl.h(175,41):
npm ERR! see reference to function template instantiation 'v8::Localv8::Value::Localv8::Data(v8::Localv8::Data)' being compiled
npm ERR! C:\Users\Kolo\AppData\Roaming\npm\node_modules\zeromq\node_modules\nan\nan_callbacks_12_inl.h(175,13):
npm ERR! see the first reference to 'v8::Localv8::Value::Local' in 'Nan::imp::FunctionCallbackWrapper'
npm ERR! gyp info it worked if it ends with ok
npm ERR! gyp info using [email protected]
npm ERR! gyp info using [email protected] | win32 | x64
npm ERR! gyp info find Python using Python version 3.12.2 found at "C:\Users\Kolo\AppData\Local\Programs\Python\Python312\python.exe"
npm ERR! gyp info find VS using VS2022 (17.9.34616.47) found at:
npm ERR! gyp info find VS "C:\Program Files\Microsoft Visual Studio\2022\Community"
npm ERR! gyp info find VS run with --verbose for detailed information
npm ERR! gyp info spawn C:\Users\Kolo\AppData\Local\Programs\Python\Python312\python.exe
npm ERR! gyp info spawn args [
npm ERR! gyp info spawn args 'C:\Users\Kolo\AppData\Roaming\npm\node_modules\node-gyp\gyp\gyp_main.py',
npm ERR! gyp info spawn args 'binding.gyp',
npm ERR! gyp info spawn args '-f',
npm ERR! gyp info spawn args 'msvs',
npm ERR! gyp info spawn args '-I',
npm ERR! gyp info spawn args 'C:\Users\Kolo\AppData\Roaming\npm\node_modules\zeromq\build\config.gypi',
npm ERR! gyp info spawn args '-I',
npm ERR! gyp info spawn args 'C:\Users\Kolo\AppData\Roaming\npm\node_modules\node-gyp\addon.gypi',
npm ERR! gyp info spawn args '-I',
npm ERR! gyp info spawn args 'C:\Users\Kolo\AppData\Local\node-gyp\Cache\21.6.2\include\node\common.gypi',
npm ERR! gyp info spawn args '-Dlibrary=shared_library',
npm ERR! gyp info spawn args '-Dvisibility=default',
npm ERR! gyp info spawn args '-Dnode_root_dir=C:\Users\Kolo\AppData\Local\node-gyp\Cache\21.6.2',
npm ERR! gyp info spawn args '-Dnode_gyp_dir=C:\Users\Kolo\AppData\Roaming\npm\node_modules\node-gyp',
npm ERR! gyp info spawn args '-Dnode_lib_file=C:\\Users\\Kolo\\AppData\\Local\\node-gyp\\Cache\\21.6.2\\<(target_arch)\\node.lib',
npm ERR! gyp info spawn args '-Dmodule_root_dir=C:\Users\Kolo\AppData\Roaming\npm\node_modules\zeromq',
npm ERR! gyp info spawn args '-Dnode_engine=v8',
npm ERR! gyp info spawn args '--depth=.',
npm ERR! gyp info spawn args '--no-parallel',
npm ERR! gyp info spawn args '--generator-output',
npm ERR! gyp info spawn args 'C:\Users\Kolo\AppData\Roaming\npm\node_modules\zeromq\build',
npm ERR! gyp info spawn args '-Goutput_dir=.'
npm ERR! gyp info spawn args ]
npm ERR! gyp info spawn C:\Program Files\Microsoft Visual Studio\2022\Community\MSBuild\Current\Bin\MSBuild.exe
npm ERR! gyp info spawn args [
npm ERR! gyp info spawn args 'build\binding.sln',
npm ERR! gyp info spawn args '/clp:Verbosity=minimal',
npm ERR! gyp info spawn args '/nologo',
npm ERR! gyp info spawn args '/p:Configuration=Release;Platform=x64'
npm ERR! gyp info spawn args ]
npm ERR! gyp ERR! build error
npm ERR! gyp ERR! stack Error: C:\Program Files\Microsoft Visual Studio\2022\Community\MSBuild\Current\Bin\MSBuild.exe
failed with exit code: 1
npm ERR! gyp ERR! stack at ChildProcess.C:\Program Files\Microsoft Visual Studio\2022\Community\MSBuild\Current\Bin\MSBuild.exe
failed with exit code: 1
npm ERR! gyp ERR! stack at ChildProcess.
npm ERR! A complete log of this run can be found in: C:\Users\Kolo\AppData\Local\npm-cache_logs\2024-02-24T23_40_00_007Z-debug-0.log vi These are my Visual Studio 22 with all the C++ Developmental Tools and Node.js tools (Optional also) +-- [email protected] `-- [email protected] node -v v21.6.2
Can anybody suggest whats the next step. Seems the issue is in installing zeromq@5 not 6, and it simply wont install.
@L4yman43 It's likely an issue with Node.js v21 (unstable). I've just tested the installation on Node.js 20 (linux) and it's working. Please, try with Node.js v20 and let me know if it doesn't work for you.