以下问题仅在Windows上存在,在macOS上,以下代码按预期工作。
因此,我在Windows 10(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!
});
});
最佳答案
我遇到了类似的问题,尤其是考虑到stop
调用是 repo 示例中的一部分。但是,在您的情况下,您似乎没有.catch
来显示实际的潜在错误。
关于javascript - Axosoft/nsfw文件监控器不会触发文件更改,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/62779363/