NodeRT: could not find assembly

后端 未结 5 655
耶瑟儿~
耶瑟儿~ 2021-01-05 10:09

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

相关标签:
5条回答
  • 2021-01-05 10:46

    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:

    1. Create a folder(check building.gyp file for path)

      %ProgramFiles(x86)%/Microsoft Visual Studio 14.0/VC/lib/store/references

    2. Copy file platform.winmd from

      C:\Program Files (x86)\Microsoft Visual Studio\2017\BuildTools\VC\Tools\MSVC\14.16.27023\lib\x86\store\references

    3. 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!

    0 讨论(0)
  • 2021-01-05 10:47

    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. :)

    0 讨论(0)
  • 2021-01-05 10:48

    Here is what I did to get the entire process to work for windows.devices.geolocation with Electron.

    1. Install Visual Studio 2017 with build tools and the platform SDK separately from the Microsoft site. I installed Windows 10 platform SDK ver 17134.
    2. Get the latest source for NodeRT (3.0) and build it using Visual Studio 2017.
    3. Run the built application. I used the NodeRTUI.exe file you can use the command line version as well.
    4. Point Winmd file location to the folder where the platform SDK is installed. For me it was under C:\Program Files (x86)\Windows Kits\10\UnionMetadata\10.0.17134.0\
    5. Select Windows.Devices.Geolocation or whatever the RT module(s) you want
    6. Select Visual Studio 2017, Windows 10 and the location of the output folder.
    7. Click the "Generate and build module" and don't worry if you get an error message.
    8. Navigate to the output folder where you generated the output files
    9. run node-gyp rebuild --msvs_version=2017
    10. If the build fails because the platform.winmd file cannot be located then do the following.
    11. Search for platform.winmd file on in your ProgramFiles(x86). This should have been installed part of Visual Studio installation
    12. Open the binding.gyp file from your NodeRT generated output project and locate the path for WIN_VER=="\v10\"" and copy the platform.winmd file to that location and copy the plaftform.winmd file to that location. For me it was %ProgramFiles(x86)%/Microsoft Visual Studio 14.0/VC/lib/store/references
    13. Now the build should work without any issues. Run the test.js file from the output folder to make sure everything is working.

    14. 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)

    15. 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"

    16. Check your electron version using MyApp\node_modules/.bin/electron --version for me it was 4.0.1

    17. 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

    18. Now run the npm install at the MyApp folder and your NodeRT is ready to go.

    0 讨论(0)
  • 2021-01-05 10:56

    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.

    0 讨论(0)
  • 2021-01-05 11:07

    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

    0 讨论(0)
提交回复
热议问题