运行以下代码时出现此错误。我不确定代码可能有什么问题?
TypeError: watcher.on(...) 不是函数
'use strict';
const fs = require('fs');
const path = require('path');
var chokidar = require('chokidar');
var watcher = chokidar.watch('C:/myproject/instances/b53pd4574z8pe9x793go', { ignored: /^\./, persistent: true });
watcher
.on('add', function (path) { console.log('File', path, 'has been added'); })
console.log(`start doing something now when a file has been added`);