Cant install NPM ijavascript package, it keeps erroring out (npm ERR! errno -4058)

125 views Asked by At

I am very new to node/npm etc. Pardon me, if I am maxing my terms.

I am trying to set up ijavascript on my system, so that I can take notes of interactive JavaScript code in VSCode (Jupyter Notebook), like I currently can with Python.

I am stuck on actually setting it up, the instructions, Windows (Official Python Distribution) say:

pip3 install --upgrade pip
pip3 install jupyter
npm install -g ijavascript
ijsinstall
# Or run: %appdata%\npm\ijsinstall

I managed to do pip3 install --upgrade pip and pip3 install jupyter but npm install -g ijavascript always throws an error:

npm ERR! syscall spawn C:\Windows\system32\cmd.exe
npm ERR! path C:\Temp\node_modules\zeromq
npm ERR! errno -4058
npm ERR! enoent spawn C:\Windows\system32\cmd.exe ENOENT
npm ERR! enoent This is related to npm not being able to find a file.
npm ERR! enoent

npm ERR! A complete log of this run can be found in: C:\Users\\AppData\Local\npm-cache\_logs\2023-10-24T23_30_15_508Z-debug-0.log
C:\Temp                                                                                                                                                                         00:30 Wednesday 25-10-2023 _cnpm install -g ijavascript
npm WARN deprecated [email protected]: Please upgrade  to version 7 or higher.  Older versions may use Math.random() in certain circumstances, which is known to be problematic.  See https://v8.dev/blog/math-random for details.
npm ERR! code ENOENT
npm ERR! syscall spawn C:\Windows\system32\cmd.exe
npm ERR! path C:\Users\\AppData\Roaming\nvm\v21.1.0\node_modules\ijavascript\node_modules\zeromq
npm ERR! errno -4058
npm ERR! enoent spawn C:\Windows\system32\cmd.exe ENOENT
npm ERR! enoent This is related to npm not being able to find a file.
npm ERR! enoent

npm ERR! A complete log of this run can be found in: C:\Users\\AppData\Local\npm-cache\_logs\2023-10-24T23_30_54_675Z-debug-0.log

I tried it without the global option, npm install ijavascript, for a moment a folder is created in working directory but then its deleted. I can install other packages with NPM just fine, both globally and locally. I also tried downgrading to an older version of Node, as suggested here, but it did not help.

I am on windows 11

1

There are 1 answers

0
Ralf_Reddings On

There were a number of errors that I had to step through and solve one by one:

  1. CMD not being found in my path, as suggested to me by Phil
  2. Node not being able to build some of part the ijavapscript package, I think there is C++ code that needs to be compiled at package install, because Microsoft build tools were not present on my system
  3. Python not being found in my path
  4. Python /script/ not being found in my path
  5. Either NPM or Node v21.1.0 is making use of Python library diskutils, which has been depracted as of 3.12, see the distutils package (Python 3.12) #92584.

For those on Mac, I am not familiar with Mac, but check that Node/NPM can find the external tools that it needs (Python/Shell/Build Tools). The last point (5) is what gave me the most headache, as when I chose to let Node download and set up things its own way (the last tick on the windows installer), it was using Chocolatey to install Python 12 (which deprecated diskutils). When I chose to do this part on my own by

  1. Installing Python 11 (which has diskutils)
  2. and sourcing the MS build tools from, here Microsoft's Node.js Guidelines for Windows

Finally, making sure everything is in place at the ENV Path, I was able to get it working on Node 21.10

The links that helped me: Microsoft's Node.js Guidelines for Windows How can I solve error gypgyp ERR!ERR! find VSfind VS msvs_version not set from command line or npm config? Node on Widnows Windows-Build-Tools