I am writing an electron app with electron-windows-notifications which is dependant on NodeRT.
As I try to install my project, I get following error for each of
I was also getting following error:
d:\nodejs\app\node_modules\npm\node_modules\node-gyp\src\win_delay_load_hook.cc : fatal error C1107: could not find assembly 'Windows.winmd': please specify the assemb
ly search path using /AI or by setting the LIBPATH environment variable [D:\nodejs\work\app\node_modules\@nodert-win10-cu\windows.applicationmodel\b
uild\binding.vcxproj]
d:\nodejs\work\app\node_modules\@nodert-win10-cu\windows.applicationmodel\opaquewrapper.cpp : fatal error C1107: could not find assembly 'Windows.wi
nmd': please specify the assembly search path using /AI or by setting the LIBPATH environment variable [D:\nodejs\work\app\node_modules\@nodert-win1
0-cu\windows.applicationmodel\build\binding.vcxproj]
d:\nodejs\work\app\node_modules\@nodert-win10-cu\windows.applicationmodel\nodertutils.cpp : fatal error C1107: could not find assembly 'Windows.winm
d': please specify the assembly search path using /AI or by setting the LIBPATH environment variable [D:\nodejs\work\app\node_modules\@nodert-win10-
cu\windows.applicationmodel\build\binding.vcxproj]
d:\nodejs\work\app\node_modules\@nodert-win10-cu\windows.applicationmodel\_nodert_generated.cpp : fatal error C1107: could not find assembly 'Window
s.winmd': please specify the assembly search path using /AI or by setting the LIBPATH environment variable [D:\nodejs\work\app\node_modules\@nodert-
win10-cu\windows.applicationmodel\build\binding.vcxproj]
d:\nodejs\work\app\node_modules\@nodert-win10-cu\windows.applicationmodel\collectionsconverterutils.cpp : fatal error C1107: could not find assembly
'Windows.winmd': please specify the assembly search path using /AI or by setting the LIBPATH environment variable [D:\nodejs\work\app\node_modules\
@nodert-win10-cu\windows.applicationmodel\build\binding.vcxproj]
I followed the following steps:
Create a folder(check building.gyp file for path)
%ProgramFiles(x86)%/Microsoft Visual Studio 14.0/VC/lib/store/references
Copy file platform.winmd
from
C:\Program Files (x86)\Microsoft Visual Studio\2017\BuildTools\VC\Tools\MSVC\14.16.27023\lib\x86\store\references
Copy file Windows.winmd
from
C:\Program Files (x86)\Windows Kits\10\UnionMetadata\10.0.17763.0
did the trick to fix the "platform.winmd", "Windows.winmd" error for me!
After trying full installation process on a different computer I found an issue causing this problem. In install instructions it is stated that "VS 2015 Express for Windows Desktop" is needed. However, Visual Studio itself is not enough and when installing a person has to install Windows 10 SDK as well.
Retrospectively it seems obvious but for someone new to JS-native-related technologies, it might be useful to explicitly declare this in README. :)
Here is what I did to get the entire process to work for windows.devices.geolocation with Electron.
node-gyp rebuild --msvs_version=2017
%ProgramFiles(x86)%/Microsoft Visual Studio 14.0/VC/lib/store/references
Now the build should work without any issues. Run the test.js file from the output folder to make sure everything is working.
To use this node addon in Electron, it needs to be rebuilt to match the exact version of Electron you are using. (otherwise Electron app will freeze)
Copy the entire output folder into your Electron app folder. MyApp\windows.devices.geolocation\
etc. and modify the top level package.json file with this dependency as "windows.devices.geolocation": "file:windows.devices.geolocation"
Check your electron version using MyApp\node_modules/.bin/electron --version
for me it was 4.0.1
Run the following command to rebuild the NodeRT module to work in electron
node-gyp rebuild --target=4.0.1 --arch=x64 --dist-url=https://atom.io/download/atom-shell
Now run the npm install
at the MyApp folder and your NodeRT is ready to go.
You need to match your installation of the Windows 10 SDK exactly with the required version of NodeRT.
As recommended by some of the answers here, I installed various versions of the Windows 10 SDK and Visual Studio 2015 over the course of a few frustrating hours and still nothing.
Finally, after a bit of research and coming across the official NodeRT page:
https://github.com/NodeRT/NodeRT
I saw it lists exactly which Windows 10 SDK you need for each version of nodert.
Looking a bit closer at my exact error messages I saw it was complaining about nodert-win10-cu, so according to the above page I needed to install exactly the SDK Windows 10, Build 15063. After doing that it compiled like a charm, but only for that exact SDK version. Somehow of all the SDKs I installed, I did not install that exact one :).
I hope this helps someone else for whom the other answers didn't work. They get you close, but the details are important -- match your installation of the Windows 10 SDK exactly with the required version of NodeRT using the above link.
For anyone else dealing with this issue. I fixed it by copying Windows.winmd
from
C:\Program Files (x86)\Windows Kits\10\UnionMetadata\10.0.16299.0
to
C:\Program Files (x86)\Windows Kits\10\UnionMetadata