NodeRT:找不到程序集
NodeRT: could not find assembly
我正在写一篇electron app with electron-windows-notifications which is dependant on 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.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。
在另一台计算机上尝试完整安装过程后,我发现了导致此问题的问题。在安装说明中指出需要 "VS 2015 Express for Windows Desktop"。然而,Visual Studio本身是不够的,安装一个人时必须安装Windows 10 SDK。
回想起来这似乎很明显,但对于 JS-native-related 技术的新手来说,在 README 中明确声明这一点可能会有用。 :)
对于处理此问题的任何其他人。我通过复制 Windows.winmd
修复了它
来自
C:\Program Files (x86)\Windows Kits\UnionMetadata.0.16299.0
至
C:\Program Files (x86)\Windows Kits\UnionMetadata
您需要将 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 中,我没有准确安装那个 :)。
我希望这对其他答案无效的其他人有所帮助。它们让您接近,但细节很重要——使用上述 link.
将您安装的 Windows 10 SDK 与所需的 NodeRT 版本完全匹配
我也遇到了以下错误:
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]
我遵循了以下步骤:
创建文件夹(检查 building.gyp 文件的路径)
%ProgramFiles(x86)%/微软Visual Studio
14.0/VC/lib/store/references
从
复制文件 platform.winmd
C:\Program Files (x86)\Microsoft Visual
Studio17\BuildTools\VC\Tools\MSVC.16.27023\lib\x86\store\references
从
复制文件 Windows.winmd
C:\Program Files (x86)\Windows
Kits\UnionMetadata.0.17763.0
为我修复了 "platform.winmd"、"Windows.winmd" 错误!
以下是我为 windows.devices.geolocation 使用 Electron 所做的整个过程。
- 安装 Visual Studio 2017 与构建工具和独立于 Microsoft 站点的平台 SDK。我安装了 Windows 10 平台 SDK 版本 17134。
- 获取 NodeRT (3.0) 的最新源代码并使用 Visual Studio 2017 构建它。
- 运行 构建的应用程序。我使用了 NodeRTUI.exe 文件你也可以使用命令行版本。
- 将Winmd 文件位置指向安装平台SDK 的文件夹。对我来说,它在 C:\Program Files (x86)\Windows Kits\UnionMetadata.0.17134.0\
下
- Select Windows.Devices.Geolocation 或者任何你想要的 RT 模块
- Select Visual Studio 2017,Windows 10 和输出文件夹的位置。
- 单击 "Generate and build module" 如果收到错误消息,请不要担心。
- 导航到生成输出文件的输出文件夹
- 运行
node-gyp rebuild --msvs_version=2017
- 如果由于找不到 platform.winmd 文件而导致构建失败,请执行以下操作。
- 在您的 ProgramFiles(x86) 中搜索 platform.winmd 文件。这应该是 Visual Studio 安装的一部分
- 从 NodeRT 生成的输出项目中打开 binding.gyp 文件并找到 WIN_VER=="\v10\"" 的路径并将 platform.winmd 文件复制到该位置,然后将 plaftform.winmd 文件复制到那个位置。对我来说是
%ProgramFiles(x86)%/Microsoft Visual Studio 14.0/VC/lib/store/references
现在构建应该可以正常工作了。 运行 输出文件夹中的 test.js 文件以确保一切正常。
要在 Electron 中使用此节点插件,需要重新构建它以匹配您正在使用的 Electron 的确切版本。 (否则 Electron 应用程序会冻结)
将整个输出文件夹复制到您的 Electron 应用程序文件夹中。 MyApp\windows.devices.geolocation\
等,修改顶层 package.json 文件,此依赖为 "windows.devices.geolocation": "file:windows.devices.geolocation"
使用 MyApp\node_modules/.bin/electron --version
检查你的电子版,我是 4.0.1
运行 以下命令重建 NodeRT 模块以在 electron 中工作
node-gyp rebuild --target=4.0.1 --arch=x64 --dist-url=https://atom.io/download/atom-shell
现在 运行 MyApp 文件夹中的 npm install
,您的 NodeRT 已准备就绪。
要在这里补充一点,除了安装 C++ 工具之外,最终对我有用的是使用 -rs3
版本,而不仅仅是 nodert-win10
:
npm install @nodert-win10-rs3/windows.media
我正在写一篇electron app with electron-windows-notifications which is dependant on 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.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。
在另一台计算机上尝试完整安装过程后,我发现了导致此问题的问题。在安装说明中指出需要 "VS 2015 Express for Windows Desktop"。然而,Visual Studio本身是不够的,安装一个人时必须安装Windows 10 SDK。
回想起来这似乎很明显,但对于 JS-native-related 技术的新手来说,在 README 中明确声明这一点可能会有用。 :)
对于处理此问题的任何其他人。我通过复制 Windows.winmd
修复了它来自
C:\Program Files (x86)\Windows Kits\UnionMetadata.0.16299.0
至
C:\Program Files (x86)\Windows Kits\UnionMetadata
您需要将 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 中,我没有准确安装那个 :)。
我希望这对其他答案无效的其他人有所帮助。它们让您接近,但细节很重要——使用上述 link.
将您安装的 Windows 10 SDK 与所需的 NodeRT 版本完全匹配我也遇到了以下错误:
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]
我遵循了以下步骤:
创建文件夹(检查 building.gyp 文件的路径)
%ProgramFiles(x86)%/微软Visual Studio 14.0/VC/lib/store/references
从
复制文件platform.winmd
C:\Program Files (x86)\Microsoft Visual Studio17\BuildTools\VC\Tools\MSVC.16.27023\lib\x86\store\references
从
复制文件Windows.winmd
C:\Program Files (x86)\Windows Kits\UnionMetadata.0.17763.0
为我修复了 "platform.winmd"、"Windows.winmd" 错误!
以下是我为 windows.devices.geolocation 使用 Electron 所做的整个过程。
- 安装 Visual Studio 2017 与构建工具和独立于 Microsoft 站点的平台 SDK。我安装了 Windows 10 平台 SDK 版本 17134。
- 获取 NodeRT (3.0) 的最新源代码并使用 Visual Studio 2017 构建它。
- 运行 构建的应用程序。我使用了 NodeRTUI.exe 文件你也可以使用命令行版本。
- 将Winmd 文件位置指向安装平台SDK 的文件夹。对我来说,它在 C:\Program Files (x86)\Windows Kits\UnionMetadata.0.17134.0\ 下
- Select Windows.Devices.Geolocation 或者任何你想要的 RT 模块
- Select Visual Studio 2017,Windows 10 和输出文件夹的位置。
- 单击 "Generate and build module" 如果收到错误消息,请不要担心。
- 导航到生成输出文件的输出文件夹
- 运行
node-gyp rebuild --msvs_version=2017
- 如果由于找不到 platform.winmd 文件而导致构建失败,请执行以下操作。
- 在您的 ProgramFiles(x86) 中搜索 platform.winmd 文件。这应该是 Visual Studio 安装的一部分
- 从 NodeRT 生成的输出项目中打开 binding.gyp 文件并找到 WIN_VER=="\v10\"" 的路径并将 platform.winmd 文件复制到该位置,然后将 plaftform.winmd 文件复制到那个位置。对我来说是
%ProgramFiles(x86)%/Microsoft Visual Studio 14.0/VC/lib/store/references
现在构建应该可以正常工作了。 运行 输出文件夹中的 test.js 文件以确保一切正常。
要在 Electron 中使用此节点插件,需要重新构建它以匹配您正在使用的 Electron 的确切版本。 (否则 Electron 应用程序会冻结)
将整个输出文件夹复制到您的 Electron 应用程序文件夹中。
MyApp\windows.devices.geolocation\
等,修改顶层 package.json 文件,此依赖为"windows.devices.geolocation": "file:windows.devices.geolocation"
使用
MyApp\node_modules/.bin/electron --version
检查你的电子版,我是 4.0.1运行 以下命令重建 NodeRT 模块以在 electron 中工作
node-gyp rebuild --target=4.0.1 --arch=x64 --dist-url=https://atom.io/download/atom-shell
现在 运行 MyApp 文件夹中的
npm install
,您的 NodeRT 已准备就绪。
要在这里补充一点,除了安装 C++ 工具之外,最终对我有用的是使用 -rs3
版本,而不仅仅是 nodert-win10
:
npm install @nodert-win10-rs3/windows.media