justinlatimer / node-midi

A node.js wrapper for RtMidi providing MIDI I/O
MIT License
745 stars 119 forks source link

Error installing on windows 10 #208

Open TheTrueGravity opened 3 years ago

TheTrueGravity commented 3 years ago

Upon install, I get an error message that seems related to node-gyp but I have Visual c++ and python installed on my system

SYSTEM INFO

OS: Windows 10 Home Node Version: 14.7.4 NPM Version: 7.20.5 node-midi Version: Latest

Output:

npm ERR! code 1
npm ERR! path E:\code\vm\node_modules\midi
npm ERR! command failed
npm ERR! command C:\Windows\system32\cmd.exe /d /s /c node-gyp rebuild
npm ERR! Building the projects in this solution one at a time. To enable parallel build, please add the "/m" switch.
npm ERR!   RtMidi.cpp
npm ERR!   input.cpp
npm ERR! c:\users\charl\appdata\local\node-gyp\cache\14.17.4\include\node\node.h(67): fatal error C1083: Cannot open include file: 'v8.h': No such file or directory [E:\code\vm\node_modules\midi\build\midi.vcxproj]
npm ERR! gyp info it worked if it ends with ok
npm ERR! gyp info using node-gyp@7.1.2
npm ERR! gyp info using node@14.17.4 | win32 | x64
npm ERR! gyp info find Python using Python version 3.8.9 found at "C:/Program Files/msys64/mingw64/bin/python3.exe"
npm ERR! gyp info find VS using VS2017 (15.9.28307.1622) found at:
npm ERR! gyp info find VS "C:\Program Files (x86)\Microsoft Visual Studio\2017\Community"
npm ERR! gyp info find VS run with --verbose for detailed information
npm ERR! gyp info spawn C:/Program Files/msys64/mingw64/bin/python3.exe
npm ERR! gyp info spawn args [
npm ERR! gyp info spawn args   'C:\\Users\\charl\\AppData\\Roaming\\npm\\node_modules\\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   'E:\\code\\vm\\node_modules\\midi\\build\\config.gypi',
npm ERR! gyp info spawn args   '-I',
npm ERR! gyp info spawn args   'C:\\Users\\charl\\AppData\\Roaming\\npm\\node_modules\\npm\\node_modules\\node-gyp\\addon.gypi',
npm ERR! gyp info spawn args   '-I',
npm ERR! gyp info spawn args   'C:\\Users\\charl\\AppData\\Local\\node-gyp\\Cache\\14.17.4\\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\\charl\\AppData\\Local\\node-gyp\\Cache\\14.17.4',
npm ERR! gyp info spawn args   '-Dnode_gyp_dir=C:\\Users\\charl\\AppData\\Roaming\\npm\\node_modules\\npm\\node_modules\\node-gyp',
npm ERR! gyp info spawn args   '-Dnode_lib_file=C:\\\\Users\\\\charl\\\\AppData\\\\Local\\\\node-gyp\\\\Cache\\\\14.17.4\\\\<(target_arch)\\\\node.lib',
npm ERR! gyp info spawn args   '-Dmodule_root_dir=E:\\code\\vm\\node_modules\\midi',
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   'E:\\code\\vm\\node_modules\\midi\\build',
npm ERR! gyp info spawn args   '-Goutput_dir=.'
npm ERR! gyp info spawn args ]
npm ERR! gyp info spawn C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\MSBuild\15.0\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 (x86)\Microsoft Visual Studio\2017\Community\MSBuild\15.0\Bin\MSBuild.exe` failed with exit code: 1
npm ERR! gyp ERR! stack     at ChildProcess.onExit (C:\Users\charl\AppData\Roaming\npm\node_modules\npm\node_modules\node-gyp\lib\build.js:194:23)
npm ERR! gyp ERR! stack     at ChildProcess.emit (events.js:400:28)
npm ERR! gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:277:12)
npm ERR! gyp ERR! System Windows_NT 10.0.19043
npm ERR! gyp ERR! command "C:\\Program Files\\nodejs\\node.exe" "C:\\Users\\charl\\AppData\\Roaming\\npm\\node_modules\\npm\\node_modules\\node-gyp\\bin\\node-gyp.js" "rebuild"
npm ERR! gyp ERR! cwd E:\code\vm\node_modules\midi
npm ERR! gyp ERR! node -v v14.17.4
npm ERR! gyp ERR! node-gyp -v v7.1.2
npm ERR! gyp ERR! not ok

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\charl\AppData\Local\npm-cache\_logs\2021-09-05T15_48_17_155Z-debug.log
josiahcbloomer commented 2 years ago

Same issue here, though I'm using Node 17.3.0

TheTrueGravity commented 2 years ago

Same issue here, though I'm using Node 17.3.0

It ended up fixing itself for me, not sure if it was because I did a reinstall of windows (unrelated) or because of an update but I'd recommend trying it in a different directory or with anaconda to see if it fixes it!

BambiHaber commented 2 years ago

Same here, running on a Macbook M1, Windows 11 within Parallels(ARM):

PS C:\Users\bambihaber\Projects\midi-service> npm install midi npm ERR! code 1 npm ERR! path C:\Users\bambihaber\Projects\midi-service\node_modules\midi npm ERR! command failed npm ERR! command C:\Windows\system32\cmd.exe /d /s /c node-gyp rebuild npm ERR! Building the projects in this solution one at a time. To enable parallel build, please add the "/m" switch. npm ERR! C:\Users\bambihaber\Projects\midi-service\node_modules\midi\build\midi.vcxproj(20,3): error MSB4019: The imported project "C:\Microsoft.Cpp.Default.props" was not found. Confirm that the path in the declaration is correct, and that the file exists on disk. npm ERR! gyp info it worked if it ends with ok npm ERR! gyp info using node-gyp@8.4.1 npm ERR! gyp info using node@17.3.0 | win32 | x64 npm ERR! gyp info find Python using Python version 3.9.9 found at "C:\Users\bambihaber\AppData\Local\Microsoft\WindowsApps\PythonSoftwareFoundation.Python.3.9_qbz5n2kfra8p0\python.exe" npm ERR! gyp info find VS using VS2015 (14.0) found at: npm ERR! gyp info find VS "C:\Program Files (x86)\Microsoft Visual Studio 14.0" npm ERR! gyp info find VS run with --verbose for detailed information npm ERR! gyp info spawn C:\Users\bambihaber\AppData\Local\Microsoft\WindowsApps\PythonSoftwareFoundation.Python.3.9_qbz5n2kfra8p0\python.exe npm ERR! gyp info spawn args [ npm ERR! gyp info spawn args 'C:\Users\bambihaber\AppData\Roaming\nvm\v17.3.0\node_modules\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\bambihaber\Projects\midi-service\node_modules\midi\build\config.gypi', npm ERR! gyp info spawn args '-I', npm ERR! gyp info spawn args 'C:\Users\bambihaber\AppData\Roaming\nvm\v17.3.0\node_modules\npm\node_modules\node-gyp\addon.gypi', npm ERR! gyp info spawn args '-I', npm ERR! gyp info spawn args 'C:\Users\bambihaber\AppData\Local\node-gyp\Cache\17.3.0\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\bambihaber\AppData\Local\node-gyp\Cache\17.3.0', npm ERR! gyp info spawn args '-Dnode_gyp_dir=C:\Users\bambihaber\AppData\Roaming\nvm\v17.3.0\node_modules\npm\node_modules\node-gyp', npm ERR! gyp info spawn args '-Dnode_lib_file=C:\\Users\\bambihaber\\AppData\\Local\\node-gyp\\Cache\\17.3.0\\<(target_arch)\\node.lib', npm ERR! gyp info spawn args '-Dmodule_root_dir=C:\Users\bambihaber\Projects\midi-service\node_modules\midi', 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\bambihaber\Projects\midi-service\node_modules\midi\build', npm ERR! gyp info spawn args '-Goutput_dir=.' npm ERR! gyp info spawn args ] npm ERR! gyp info spawn C:\Program Files (x86)\MSBuild\14.0\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 (x86)\MSBuild\14.0\bin\MSBuild.exe failed with exit code: 1 npm ERR! gyp ERR! stack at ChildProcess.onExit (C:\Users\bambihaber\AppData\Roaming\nvm\v17.3.0\node_modules\npm\node_modules\node-gyp\lib\build.js:194:23) npm ERR! gyp ERR! stack at ChildProcess.emit (node:events:390:28) npm ERR! gyp ERR! stack at Process.ChildProcess._handle.onexit (node:internal/child_process:290:12) npm ERR! gyp ERR! System Windows_NT 10.0.22000 npm ERR! gyp ERR! command "C:\Program Files (x86)\nodejs\node.exe" "C:\Users\bambihaber\AppData\Roaming\nvm\v17.3.0\node_modules\npm\node_modules\node-gyp\bin\node-gyp.js" "rebuild" npm ERR! gyp ERR! cwd C:\Users\bambihaber\Projects\midi-service\node_modules\midi npm ERR! gyp ERR! node -v v17.3.0 npm ERR! gyp ERR! node-gyp -v v8.4.1 npm ERR! gyp ERR! not ok

npm ERR! A complete log of this run can be found in: npm ERR! C:\Users\bambihaber\AppData\Local\npm-cache_logs\2022-01-07T01_06_02_033Z-debug-0.log PS C:\Users\bambihaber\Projects\midi-service>

BambiHaber commented 2 years ago

I solved the issue by installing the deprecated package: npm install --global --production windows-build-tools

This probably install the runtimes required by VSC compiler to bind, the question is, what are the exact packages, since this was done after manually installing VS2015 build tools and the 2019 CPP Desktop runtimes.. (again on an ARM windows 11 Machine running in parallels on a Macbook), but seems related since its just specific runtimes that are needed.

JoueBien commented 2 years ago

Install the windows built tools (windows dose not ship with them so you'll need to separately install the various C compilers). If you are using nvm for windows you can run:

npm install --global --production windows-build-tools

https://github.com/felixrieseberg/windows-build-tools Otherwise the modern node installers should allow you to install the windows built tools. Otherwise buy and install Visual Studio.

Then install python 2.7 as node-gypt used in this project requires python 2.7 and then tell npm to use python 2.7

BambiHaber commented 2 years ago

Hey, thanks for the late reply anyway, I solved it long time ago just by installing the windows build tools at the time :)