【问题标题】:NodeWebKit with RobotJS error Win32带有 RobotJS 错误 Win32 的 NodeWebKit
【发布时间】:2015-09-06 13:59:29
【问题描述】:

我遇到了 RobotJs 的问题,我有一个错误:

"Uncaught Error: %1 nest pas une application Win32 valide.
  C:\Users\antoine\Desktop\testNW\node_modules\robotjs\build\Release\robotjs.node"

NodeWebKit 会出现此问题。 但是,当我在没有 NodeWebKit 的情况下使用节点运行此脚本时,我没有问题。

例子:

C:\Users\antoine\Desktop\testNW>node index.js
Mouse is at x:1281 y:132

文件 index.js

    var robot = require("robotjs");

    //Get the mouse position, returns an object with x and y. 
    var mouse = robot.getMousePos();
    console.log("Mouse is at x:" + mouse.x + " y:" + mouse.y);

    //Move the mouse down by 100 pixels.
    robot.moveMouse(mouse.x, mouse.y + 100);

    //Left click!
    robot.mouseClick();

提前感谢您的帮助,

【问题讨论】:

    标签: node.js windows node-webkit


    【解决方案1】:

    使用 NW.js 时,需要使用 nw-gyp 编译原生模块。有关更多信息,请参阅本指南:

    https://github.com/nwjs/nw.js/wiki/Build-native-modules-with-nw-gyp

    【讨论】:

    • 嗨,我使用了 nw-gyp,但我发现了问题。显然,当我使用 NW 64 位版本时,我遇到了问题,而 32 位版本没有问题。
    猜你喜欢
    • 2015-10-31
    • 2022-07-16
    • 2013-07-04
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2016-03-23
    • 1970-01-01
    相关资源
    最近更新 更多