【发布时间】:2018-04-09 08:56:07
【问题描述】:
在 appveyor 上和作为 virtualbox 运行 Windows 10 时,我在为我的电子应用程序运行开玩笑测试时遇到了同样的错误。
The specified module could not be found.
\\?\C:\Users\User\peruse\app\node_modules\ref\build\Release\binding.node
Error: The specified module could not be found.
\\?\C:\Users\User\peruse\app\node_modules\ref\build\Release\binding.node
at Runtime.requireModule (node_modules/jest-runtime/build/index.js:263:31)
at bindings (app/node_modules/bindings/bindings.js:76:44)
at Object.<anonymous> (app/node_modules/ref/lib/ref.js:5:47)
(https://ci.appveyor.com/project/joshuef/peruse/build/1.0.733/job/fwflo19to9rvt085#L4664)
问题是......文件本身存在,通过运行确认:
dir \\?\C:\Users\User\peruse\app\node_modules\ref\build\Release\binding.node
导致:
-a---- 4/9/2018 1:44 AM 157696 binding.node
应用程序本身运行良好(它是一个电子应用程序,通过 webpack 编译)。只有在针对本机库运行测试时,我才会收到此错误。并且仅在 Windows 中。 (osx/linux 测试运行良好。)
我尝试过重建,使用npm 而不是yarn,通过命令行重新安装 vs2017 工具...我在两个系统上都经常遇到这个错误(这是 一些东西 em>),但我不知道接下来要尝试什么......
Jest 正在从命令行运行。
Jest 是这样配置的:
module.exports = {
verbose : true,
moduleFileExtensions : ['js', 'jsx', 'json'],
setupFiles : ['raf/polyfill','<rootDir>/test/setup.js'],
testPathIgnorePatterns : ['node_modules'],
moduleDirectories : ['app', 'test', 'node_modules', 'app/node_modules'],
moduleNameMapper : {
"electron": "<rootDir>/mocks/electron.js",
"\\.(jpg|jpeg|png|gif|eot|otf|webp|svg|ttf|woff|woff2|mp4|webm|wav|mp3|m4a|aac|oga)$":
"<rootDir>/mocks/fileMock.js",
"\\.(css|scss)$": "<rootDir>/mocks/fileMock.js",
'^appPackage$' : '<rootDir>/package.json',
'^@actions(.*)$' : '<rootDir>/app/actions$1',
'^@components(.*)$' : '<rootDir>/app/components$1',
'^@containers(.*)$' : '<rootDir>/app/containers$1',
'^appConstants$' : '<rootDir>/app/constants.js',
'^@extensions(.*)$' : '<rootDir>/app/extensions$1',
'^@logger$' : '<rootDir>/app/logger.js',
'^@reducers(.*)$' : '<rootDir>/app/reducers$1',
'^@store(.*)$' : '<rootDir>/app/store',
'^@utils(.*)$' : '<rootDir>/app/utils$1'
}
};
the appveyor config file is here.
任何要检查的指针/想法/事情 super 表示赞赏。如果需要更多代码说明,请告诉我。
提前致谢!
【问题讨论】:
-
嘿@josh,我目前遇到同样的问题 - 你设法解决了吗?
-
嘿@EvgenySorokin,很抱歉我们没有。一堆围绕各种文件夹结构选项的挖掘结果一无所获:(
-
@EvgenySorokin 有什么消息吗? Electron 和 Windows 也在这里卡住了。
-
@Nickensoul 不幸的是,没有,作为一种解决方法,我们停止模拟导致此错误的 ibm db 模块并模拟使用它的模块
-
@EvgenySorokin,同样。我们刚刚模拟了无法解析的原生模块。奇怪的事情。无论如何,感谢您的反馈!
标签: javascript node.js windows-10 electron jestjs