Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/461.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript Axosoft/nsfw文件监视器不’;t触发文件更改_Javascript_Node.js_Electron - Fatal编程技术网

Javascript Axosoft/nsfw文件监视器不’;t触发文件更改

Javascript Axosoft/nsfw文件监视器不’;t触发文件更改,javascript,node.js,electron,Javascript,Node.js,Electron,以下问题仅在Windows上存在,在macOS上,以下代码按预期工作。 因此,我在Windows10(v1909)上,在我的electron程序中安装了nsfw,无法使其工作。我使用以下命令安装了它: npm install nsfw --save > nsfw@2.0.0 install C:\Users\daniel\Desktop\my-foo-example\node_modules\nsfw > node-gyp rebuild C:\Users\daniel\Desk

以下问题仅在Windows上存在,在macOS上,以下代码按预期工作。

因此,我在Windows10(v1909)上,在我的electron程序中安装了
nsfw
,无法使其工作。我使用以下命令安装了它:

npm install nsfw --save

> nsfw@2.0.0 install C:\Users\daniel\Desktop\my-foo-example\node_modules\nsfw
> node-gyp rebuild

C:\Users\daniel\Desktop\my-foo-example\node_modules\nsfw>if not defined npm_config_node_gyp (node "C:\Program Files\nodejs\node_modules\npm\node_modules\npm-lifecycle\node-gyp-bin\\..\..\node_modules\node-gyp\bin\node-gyp.js" rebuild )  else (node "C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\bin\node-gyp.js" rebuild )
Building the projects in this solution one at a time. To enable parallel build, please add the "-m" switch.
  NSFW.cpp
  Queue.cpp
  NativeInterface.cpp
  Controller.cpp
  Watcher.cpp
  win_delay_load_hook.cc
     Creating library C:\Users\daniel\Desktop\my-foo-example\node_modules\nsfw\build\Release\nsfw.lib a
  nd object C:\Users\daniel\Desktop\my-foo-example\node_modules\nsfw\build\Release\nsfw.exp
  nsfw.vcxproj -> C:\Users\daniel\Desktop\my-foo-example\node_modules\nsfw\build\Release\\nsfw.node
+ nsfw@2.0.0
我用下面的方法调用
nsfw
。我希望“开始观看”会被打印出来,但什么也没发生。此外,不会打印出给定目录中的任何文件更改。目录确实存在。我错过什么了吗


var watcher2;

app.whenReady().then(() => {
  createWindow();

  nsfw(
    "C:\\Users\\daniel\\Desktop\\foo",
    function (events) {
      console.log(events);
    },
    {
      debounceMS: 250,
      errorCallback(errors) {
        console.log(errors);
      },
    }
  )
    .then(function (watcher) {
      watcher2 = watcher;
      console.log("start"); <--- get's executed
      return watcher.start();
    })
    .then(function () {
      console.log("start watching"); <--- DOES NOT get triggered
      // we are now watching dir for events!
    });
});

var观察者2;
app.whenReady().然后(()=>{
createWindow();
nsfw(
“C:\\Users\\daniel\\Desktop\\foo”,
功能(事件){
console.log(事件);
},
{
debounceMS:250,
errorCallback(错误){
console.log(错误);
},
}
)
.then(功能(观察者){
观察者2=观察者;

console.log(“start”);我也有类似的问题,特别是考虑到
stop
调用是repo中示例的一部分。但是,在您的情况下,似乎没有
.catch
来揭示实际的潜在错误。

如果您打算更改npm包,我建议使用“npm包”