Failure to install the node-red-contrib-midi palette

Hello everyone,
Sorry to open a new topic, it is the first time I use the forum as I have not been able to find the solution to my problem.

I want to use Midi on my Node-red, the node-red-contrib-midi palette works fine on the Mac but on Windows I can't get it installed.

the first errors told me to install Python and Visual Basic, that's done.

But it still won't install.
I seem to understand in the log that something called "distutils" is missing. What is it and how do I fix it in Windows? Is it a versioning problem? Does anyone have a solution that can share with me?
I really appreciate it!
Thank you very much for your help.

LOG:

2023-12-09T11:25:45.019Z Install : node-red-contrib-midi 1.1.2

2023-12-09T11:25:45.028Z npm.cmd install --no-audit --no-update-notifier --no-fund --save --save-prefix=~ --production --engine-strict node-red-contrib-midi@1.1.2
2023-12-09T11:25:47.294Z [err] npm
2023-12-09T11:25:47.294Z [err]  WARN config production Use `--omit=dev` instead.
2023-12-09T11:25:54.623Z [err] npm
2023-12-09T11:25:54.623Z [err]  ERR! code 1
2023-12-09T11:25:54.623Z [err] npm 
2023-12-09T11:25:54.623Z [err] ERR!
2023-12-09T11:25:54.623Z [err]  path
2023-12-09T11:25:54.623Z [err]  C:\Users\escap\.node-red\node_modules\midi
2023-12-09T11:25:54.625Z [err] npm ERR!
2023-12-09T11:25:54.625Z [err]  command failed
2023-12-09T11:25:54.625Z [err] npm ERR! command C:\Windows\system32\cmd.exe /d /s /c node-gyp rebuild
2023-12-09T11:25:54.625Z [err] npm ERR! gyp info it worked if it ends with ok
2023-12-09T11:25:54.625Z [err] npm 
2023-12-09T11:25:54.625Z [err] ERR! gyp info using node-gyp@9.4.0
2023-12-09T11:25:54.625Z [err] npm ERR! gyp info using node@20.9.0 | win32 | x64
2023-12-09T11:25:54.625Z [err] npm ERR! gyp info find Python using Python version 3.12.0 found at "C:\Users\escap\AppData\Local\Programs\Python\Python312\python.exe"
2023-12-09T11:25:54.625Z [err] npm 
2023-12-09T11:25:54.625Z [err] ERR! gyp info find VS using VS2022 (17.8.34322.80) found at:
2023-12-09T11:25:54.625Z [err] npm ERR!
2023-12-09T11:25:54.625Z [err]  gyp info find VS "C:\Program Files\Microsoft Visual Studio\2022\Community"
2023-12-09T11:25:54.625Z [err] npm ERR! gyp info find VS run with --verbose for detailed information
2023-12-09T11:25:54.625Z [err] npm ERR! gyp info spawn C:\Users\escap\AppData\Local\Programs\Python\Python312\python.exe
2023-12-09T11:25:54.625Z [err] npm
2023-12-09T11:25:54.625Z [err]  ERR! gyp info spawn args [
2023-12-09T11:25:54.625Z [err] npm 
2023-12-09T11:25:54.625Z [err] ERR! gyp info spawn args   'C:\\Program Files\\nodejs\\node_modules\\npm\\node_modules\\node-gyp\\gyp\\gyp_main.py',
2023-12-09T11:25:54.625Z [err] npm 
2023-12-09T11:25:54.625Z [err] ERR! gyp info spawn args   'binding.gyp',
2023-12-09T11:25:54.625Z [err] npm ERR!
2023-12-09T11:25:54.625Z [err]  gyp info spawn args   '-f',
2023-12-09T11:25:54.625Z [err] npm ERR!
2023-12-09T11:25:54.625Z [err]  gyp info spawn args   'msvs',
2023-12-09T11:25:54.625Z [err] npm ERR!
2023-12-09T11:25:54.625Z [err]  gyp info spawn args   '-I',
2023-12-09T11:25:54.625Z [err] npm ERR!
2023-12-09T11:25:54.625Z [err]  gyp info spawn args   'C:\\Users\\escap\\.node-red\\node_modules\\midi\\build\\config.gypi',
2023-12-09T11:25:54.625Z [err] npm ERR!
2023-12-09T11:25:54.625Z [err]  gyp info spawn args   '-I',
2023-12-09T11:25:54.625Z [err] npm ERR! gyp info spawn args   'C:\\Program Files\\nodejs\\node_modules\\npm\\node_modules\\node-gyp\\addon.gypi',
2023-12-09T11:25:54.625Z [err] npm ERR! gyp info spawn args   '-I',
2023-12-09T11:25:54.625Z [err] npm ERR! gyp info spawn args   'C:\\Users\\escap\\AppData\\Local\\node-gyp\\Cache\\20.9.0\\include\\node\\common.gypi',
2023-12-09T11:25:54.625Z [err] npm ERR! gyp info spawn args   '-Dlibrary=shared_library',
2023-12-09T11:25:54.625Z [err] npm
2023-12-09T11:25:54.625Z [err]  ERR! gyp info spawn args   '-Dvisibility=default',
2023-12-09T11:25:54.625Z [err] npm ERR! gyp info spawn args   '-Dnode_root_dir=C:\\Users\\escap\\AppData\\Local\\node-gyp\\Cache\\20.9.0',
2023-12-09T11:25:54.625Z [err] npm
2023-12-09T11:25:54.625Z [err]  ERR! gyp info spawn args   '-Dnode_gyp_dir=C:\\Program Files\\nodejs\\node_modules\\npm\\node_modules\\node-gyp',
2023-12-09T11:25:54.625Z [err] npm ERR! gyp info spawn args   '-Dnode_lib_file=C:\\\\Users\\\\escap\\\\AppData\\\\Local\\\\node-gyp\\\\Cache\\\\20.9.0\\\\<(target_arch)\\\\node.lib',
2023-12-09T11:25:54.625Z [err] npm ERR! gyp info spawn args   '-Dmodule_root_dir=C:\\Users\\escap\\.node-red\\node_modules\\midi',
2023-12-09T11:25:54.626Z [err] npm ERR! gyp info spawn args   '-Dnode_engine=v8',
2023-12-09T11:25:54.626Z [err] npm ERR! gyp info spawn args   '--depth=.',
2023-12-09T11:25:54.626Z [err] npm ERR! gyp info spawn args   '--no-parallel',
2023-12-09T11:25:54.626Z [err] npm ERR!
2023-12-09T11:25:54.626Z [err]  gyp info spawn args   '--generator-output',
2023-12-09T11:25:54.626Z [err] npm ERR! gyp info spawn args   'C:\\Users\\escap\\.node-red\\node_modules\\midi\\build',
2023-12-09T11:25:54.626Z [err] npm ERR!
2023-12-09T11:25:54.626Z [err]  gyp info spawn args   '-Goutput_dir=.'
2023-12-09T11:25:54.626Z [err] npm ERR! gyp info spawn args ]
2023-12-09T11:25:54.626Z [err] npm 
2023-12-09T11:25:54.626Z [err] ERR! Traceback (most recent call last):
2023-12-09T11:25:54.626Z [err] npm ERR!   File "C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\gyp\gyp_main.py", line 42, in <module>
2023-12-09T11:25:54.626Z [err] npm
2023-12-09T11:25:54.626Z [err]  ERR!     import gyp  # noqa: E402
2023-12-09T11:25:54.626Z [err] npm ERR!     ^^^^^^^^^^
2023-12-09T11:25:54.626Z [err] npm ERR!   File "C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\gyp\pylib\gyp\__init__.py", line 9, in <module>
2023-12-09T11:25:54.626Z [err] npm ERR!
2023-12-09T11:25:54.626Z [err]      import gyp.input
2023-12-09T11:25:54.626Z [err] npm ERR!   File "C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\gyp\pylib\gyp\input.py", line 19, in <module>
2023-12-09T11:25:54.626Z [err] npm 
2023-12-09T11:25:54.626Z [err] ERR!     from distutils.version import StrictVersion
2023-12-09T11:25:54.626Z [err] npm ERR! ModuleNotFoundError: No module named 'distutils'
2023-12-09T11:25:54.626Z [err] npm ERR! gyp ERR! configure error 
2023-12-09T11:25:54.626Z [err] npm ERR! gyp ERR! stack Error: `gyp` failed with exit code: 1
2023-12-09T11:25:54.626Z [err] npm ERR! gyp ERR! stack     at ChildProcess.onCpExit (C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\lib\configure.js:325:16)
2023-12-09T11:25:54.626Z [err] npm ERR! gyp ERR! stack     at ChildProcess.emit (node:events:514:28)
2023-12-09T11:25:54.626Z [err] npm
2023-12-09T11:25:54.626Z [err]  ERR! gyp ERR! stack     at ChildProcess._handle.onexit (node:internal/child_process:294:12)
2023-12-09T11:25:54.626Z [err] npm ERR! gyp ERR! System Windows_NT 10.0.22621
2023-12-09T11:25:54.626Z [err] npm 
2023-12-09T11:25:54.626Z [err] ERR! gyp ERR! command "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\node_modules\\node-gyp\\bin\\node-gyp.js" "rebuild"
2023-12-09T11:25:54.626Z [err] npm ERR! gyp ERR! cwd C:\Users\escap\.node-red\node_modules\midi
2023-12-09T11:25:54.626Z [err] npm ERR!
2023-12-09T11:25:54.626Z [err]  gyp ERR! node -v v20.9.0
2023-12-09T11:25:54.626Z [err] npm ERR! gyp ERR! node-gyp -v v9.4.0
2023-12-09T11:25:54.626Z [err] npm
2023-12-09T11:25:54.626Z [err]  ERR! gyp ERR! not ok
2023-12-09T11:25:54.628Z [err] 
2023-12-09T11:25:54.628Z [err] npm ERR! A complete log of this run can be found in: C:\Users\escap\AppData\Local\npm-cache\_logs\2023-12-09T11_25_47_225Z-debug-0.log
2023-12-09T11:25:54.651Z rc=1

@Escapop welcome to the forum!

When I look at an issue with a node, one of the first things is look in the flow library for it. The midi node is here:

Then I follow the GitHub link

and then look at the opened

and closed issues:

Take a look at those issues and see if any of them help.

Just one more thing, the author of that node has not been active on GitHug for over a year so you may not get a response from him.

1 Like

Hi Zenofmud, thank you very much for your quick response. Indeed I had already searched for an answer on Github and forums but I haven't found anything related.

My intuition tells me that the error has more to do with Python versions than with the particular palette. Have you seen the 'distutils' error for a Windows OS before? Would you know how to fix it?

Thank you very much for taking the time to help

Sorry I’m a macOS and raspberry pi user.

You could try opening an issue on the nodes GitHub page or looking at the issues and adding to an existing issue. That way you might get help from someone who posted on that issue.

This looks as if it may be the problem. There is a suggested workaround there.

Yes I had read all these forums but I couldn't find a solution, so I thought I'd go simple and look for an older version of python, I used version 3.10 and it worked!

Thanks to all of you

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.