NodeRT: could not find assembly

后端 未结 5 654
耶瑟儿~
耶瑟儿~ 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: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.

提交回复
热议问题