eslint error : Cannot find any-observable implementation nor global.Observable

eslint error : Cannot find any-observable implementation nor global.Observable

我安装了最新的 "rxjs": "6.2.2","redux-observable": "1.0.0",

我有执行 eslint 检查的预提交挂钩。

安装开始后报错:

C:\XXX\node_modules\any-observable\register.js:29
                throw new Error('Cannot find any-observable implementation nor' +
                ^

Error: Cannot find any-observable implementation nor
global.Observable. You must install polyfill or call
require("any-observable/register") with your preferred implementation,
e.g. require("any-observable/register")('rxjs') on application load
prior to any require("any-observable").
    at loadImplementation (C:\XXX\node_modules\any-observable\register.js:29:9)
    at register (C:\XXX\node_modules\any-observable\loader.js:32:18)
    at Object.<anonymous> (C:\XXX\node_modules\any-observable\index.js:2:39)
    at Module._compile (module.js:635:30)
    at Object.Module._extensions..js (module.js:646:10)
    at Module.load (module.js:554:32)
    at tryModuleLoad (module.js:497:12)
    at Function.Module._load (module.js:489:3)
    at Module.require (module.js:579:17)
    at require (internal/module.js:11:18)

husky > pre-commit hook failed (add --no-verify to bypass)

How can I fix it? 
Why eslint is doing stuff with files in `node_modules` anyway?

我遇到了类似的问题。我删除了 package-lock.json 和 node-modules 文件夹,运行 npm install 一切都已修复。

It seems Listr depends on RxJS, and because it hasn't been updated to support RxJS 6, a compatibility package rxjs-compat is required. Once this package is installed, the issue goes away.

https://github.com/okonet/lint-staged/issues/416

所以,只需安装依赖项

npm install rxjs-compat