【问题标题】:NodeRT: could not find assemblyNodeRT:找不到程序集
【发布时间】:2017-06-28 16:38:53
【问题描述】:

我正在编写一个带有 electron-windows-notificationselectron 应用程序,它依赖于 NodeRT

当我尝试安装我的项目时,每个 @nodert-win10 依赖项都会出现以下错误:

> if not defined npm_config_node_gyp (node "C:\Applications\nodejs\node_modules\npm\bin\node-gyp-bin\\..\..\node_modules\node-gyp\bin\node-gyp.js" rebuild --msvs_version=2015 )  else (node "" rebuild --msvs_version=2015 )
Building the projects in this solution one at a time. To enable parallel build, please add the "/m" switch.
  _nodert_generated.cpp
  NodeRtUtils.cpp
  OpaqueWrapper.cpp
  CollectionsConverterUtils.cpp
..\_nodert_generated.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 [C:\Users\moro\projects\t w-en-ty\node_modules\@nodert-win10\windows.ui.startscreen\build\binding.vcxproj]
..\NodeRtUtils.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 [C:\Users\moro\projects\tw-en-t y\node_modules\@nodert-win10\windows.ui.startscreen\build\binding.vcxproj]
..\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 [C:\Users\moro\pr ojects\tw-en-ty\node_modules\@nodert-win10\windows.ui.startscreen\build\binding.vcxproj]
  win_delay_load_hook.cc
..\OpaqueWrapper.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 [C:\Users\moro\projects\tw-en -ty\node_modules\@nodert-win10\windows.ui.startscreen\build\binding.vcxproj]
C:\Applications\nodejs\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 assembly search path using /AI or by se tting the LIBPATH environment variable [C:\Users\moro\projects\tw-en-ty\node_modules\@nodert-win10\windows.ui.startscreen\build\binding.vcxproj]
gyp ERR! build error
gyp ERR! stack Error: `C:\Program Files (x86)\MSBuild\14.0\bin\msbuild.exe` failed with exit code: 1
gyp ERR! stack     at ChildProcess.onExit (C:\Applications\nodejs\node_modules\npm\node_modules\node-gyp\lib\build.js:276:23)
gyp ERR! stack     at emitTwo (events.js:106:13)
gyp ERR! stack     at ChildProcess.emit (events.js:191:7)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:215:12)
gyp ERR! System Windows_NT 10.0.14393
gyp ERR! command "C:\\Applications\\nodejs\\node.exe" "C:\\Applications\\nodejs\\node_modules\\npm\\node_modules\\node-gyp\\bin\\node-gyp.js" "rebuild" "--msvs_version=2015"
gyp ERR! cwd C:\Users\moro\projects\tw-en-ty\node_modules\@nodert-win10\windows.ui.startscreen
gyp ERR! node -v v6.9.5
gyp ERR! node-gyp -v v3.4.0
gyp ERR! not ok

拜托,你能帮帮我吗?

这里也有人问过这个问题:https://github.com/NodeRT/NodeRT/issues/56

【问题讨论】:

    标签: node.js windows-runtime windows-10 electron


    【解决方案1】:

    在这里补充一下,除了安装 C++ 工具之外,最终对我有用的是使用-rs3 版本,而不仅仅是nodert-win10

    npm install @nodert-win10-rs3/windows.media
    

    【讨论】:

      【解决方案2】:

      这是我为使整个过程使用 Electron 为 windows.devices.geolocation 工作所做的工作。

      1. 使用构建工具和平台 SDK 安装 Visual Studio 2017,与 Microsoft 站点分开安装。我安装了 Windows 10 平台 SDK 版本 17134。
      2. 获取 NodeRT (3.0) 的最新源代码并使用 Visual Studio 2017 构建它。
      3. 运行构建的应用程序。我使用的是 NodeRTUI.exe 文件,你也可以使用命令行版本。
      4. 将 Winmd 文件位置指向安装平台 SDK 的文件夹。对我来说,它位于 C:\Program Files (x86)\Windows Kits\10\UnionMetadata\10.0.17134.0\
      5. 选择 Windows.Devices.Geolocation 或任何您想要的 RT 模块
      6. 选择 Visual Studio 2017、Windows 10 和输出文件夹的位置。
      7. 点击“生成和构建模块”,如果您收到错误消息,请不要担心。
      8. 导航到生成输出文件的输出文件夹
      9. 运行node-gyp rebuild --msvs_version=2017
      10. 如果由于找不到 platform.winmd 文件而导致构建失败,请执行以下操作。
      11. 在 ProgramFiles(x86) 中搜索 platform.winmd 文件。这应该是 Visual Studio 安装的一部分
      12. 从 NodeRT 生成的输出项目中打开 binding.gyp 文件,找到 WIN_VER=="\v10\"" 的路径,然后将 platform.winmd 文件复制到该位置,然后将 pflatform.winmd 文件复制到该位置。对我来说是%ProgramFiles(x86)%/Microsoft Visual Studio 14.0/VC/lib/store/references
      13. 现在构建应该可以正常工作了。从输出文件夹运行 test.js 文件以确保一切正常。

      14. 要在 Electron 中使用此节点插件,需要重新构建它以匹配您正在使用的 Electron 的确切版本。 (否则 Electron 应用将冻结)

      15. 将整个输出文件夹复制到您的 Electron 应用程序文件夹中。 MyApp\windows.devices.geolocation\ 等,并将顶层 package.json 文件修改为 "windows.devices.geolocation": "file:windows.devices.geolocation"

      16. 使用 MyApp\node_modules/.bin/electron --version 检查您的电子版本,我是 4.0.1

      17. 运行以下命令重建 NodeRT 模块以在电子中工作 node-gyp rebuild --target=4.0.1 --arch=x64 --dist-url=https://atom.io/download/atom-shell

      18. 现在在 MyApp 文件夹中运行 npm install,您的 NodeRT 已准备就绪。

      【讨论】:

        【解决方案3】:

        我也收到以下错误:

        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]
        

        我按照以下步骤操作:

        1. 创建一个文件夹(检查 building.gyp 文件的路径)

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

        2. 复制文件platform.winmd

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

        3. 复制文件Windows.winmd

          C:\Program Files (x86)\Windows 套件\10\UnionMetadata\10.0.17763.0

        为我解决了“platform.winmd”、“Windows.winmd”错误!

        【讨论】:

        • 不错的答案!一些额外的信息 - 实际上确切的路径可能会因版本而异,所以如果它不起作用,请在 Visual Studio 中打开 binding.sln,并检查库目录...然后将 winmds 复制到对应的路径。
        【解决方案4】:

        您需要将安装的 Windows 10 SDK 与所需的 NodeRT 版本完全匹配。

        按照这里的一些答案的建议,我在几个令人沮丧的小时内安装了各种版本的 Windows 10 SDK 和 Visual Studio 2015,但仍然没有。

        最后,经过一番研究并浏览了 NodeRT 官方页面:

        https://github.com/NodeRT/NodeRT

        我看到它准确列出了每个 nodert 版本所需的 Windows 10 SDK。

        仔细查看我的确切错误消息,我发现它在抱怨 nodert-win10-cu,因此根据上面的页面,我需要安装 SDK Windows 10,Build 15063。之后它编译为魅力,但仅适用于该确切的 SDK 版本。不知何故,在我安装的所有 SDK 中,我没有安装那个确切的 :)。

        我希望这对其他答案不起作用的其他人有所帮助。它们让您接近,但细节很重要 - 使用上面的链接将您的 Windows 10 SDK 安装与所需的 NodeRT 版本完全匹配。

        【讨论】:

        【解决方案5】:

        对于其他处理此问题的人。我通过复制 Windows.winmd 来修复它

        来自

        C:\Program Files (x86)\Windows Kits\10\UnionMetadata\10.0.16299.0

        C:\Program Files (x86)\Windows Kits\10\UnionMetadata

        【讨论】:

        • 这解决了我的问题,但是没有解释为什么会这样。我首先尝试按照错误提示将适当的文件夹添加到 PATH 和 LIBPATH 环境变量中,但这没有用。
        • 这个 hack 对我不起作用 - 请参阅下面的答案,我认为它更简单,可能是“正确的方法”。
        • 在我的情况下,从适用的 SDK 文件夹中单独复制 Windows.md 不起作用。我还必须从“C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\Common7\IDE \VC\vcpackages”到“C:\Program Files (x86)\Microsoft Visual Studio\2019\Preview\Common7\IDE\VC\vcpackages”,因为我的项目是为 VS2017 配置的,而我在 VS2019 预览版下构建它。
        【解决方案6】:

        在另一台计算机上尝试完整安装过程后,我发现了导致此问题的问题。在安装说明中指出需要“VS 2015 Express for Windows Desktop”。但是,Visual Studio 本身是不够的,安装的时候还得安装Windows 10 SDK

        回想起来,这似乎很明显,但对于 JS-native 相关技术的新手来说,在 README 中明确声明这一点可能很有用。 :)

        【讨论】:

          猜你喜欢
          • 2010-10-19
          • 2011-09-23
          • 2019-06-06
          • 2011-03-20
          • 2011-03-02
          • 1970-01-01
          • 1970-01-01
          • 2011-07-25
          相关资源
          最近更新 更多