eslint错误:找不到任何可观察到的实现或全局。

时间:2018-08-20 09:17:29

标签: rxjs eslint redux-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?

2 个答案:

答案 0 :(得分:2)

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

答案 1 :(得分:1)

  

似乎Listr依赖于RxJS,并且由于尚未进行更新以支持RxJS 6,因此需要兼容软件包rxjs-compat。安装此软件包后,问题就消失了。

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

所以,只需安装依赖项

[I 2018-11-13 10:40:03.183 JupyterHub log:158] 302 GET /hub/ -> /hub/login (@::ffff:192.168.3.47) 1.19ms
[I 2018-11-13 10:40:03.245 JupyterHub log:158] 200 GET /hub/login (@::ffff:192.168.3.47) 47.94ms
[I 2018-11-13 10:40:11.116 JupyterHub ldapauthenticator:586] User 't1' sucessfully authenticated against ldap server ['ldap://ldap.example.com:389'].
[I 2018-11-13 10:40:11.128 JupyterHub ldapauthenticator:290] Creating 't1' user home directory using command 'mkhomedir_helper t1'
[E 2018-11-13 10:40:11.133 JupyterHub web:1670] Uncaught exception POST /hub/login?next= (::ffff:192.168.3.47)
    HTTPServerRequest(protocol='http', host='192.168.3.49:8000', method='POST', uri='/hub/login?next=', version='HTTP/1.1', remote_ip='::ffff:192.168.3.47')
    Traceback (most recent call last):
      File "/usr/local/lib/python3.6/dist-packages/tornado/web.py", line 1592, in _execute
        result = yield result
      File "/usr/local/lib/python3.6/dist-packages/jupyterhub/handlers/login.py", line 81, in post
        user = await self.login_user(data)
      File "/usr/local/lib/python3.6/dist-packages/jupyterhub/handlers/base.py", line 483, in login_user
        await maybe_future(self.authenticator.add_user(user))
      File "/usr/local/lib/python3.6/dist-packages/ldapauthenticator/ldapauthenticator.py", line 269, in add_user
        yield gen.maybe_future(self.add_user_home_dir(username))
      File "/usr/local/lib/python3.6/dist-packages/ldapauthenticator/ldapauthenticator.py", line 295, in add_user_home_dir
        raise RuntimeError("Failed to create system user %s: %s" % (username, err))
    RuntimeError: Failed to create system user t1: 

[E 2018-11-13 10:40:11.146 JupyterHub log:150] {
      "X-Forwarded-Host": "192.168.3.49:8000",
      "X-Forwarded-Proto": "http",
      "X-Forwarded-Port": "8000",
      "X-Forwarded-For": "::ffff:192.168.3.47",
      "Accept-Language": "de-DE,de;q=0.9,en-US;q=0.8,en;q=0.7",
      "Accept-Encoding": "gzip, deflate",
      "Referer": "http://192.168.3.49:8000/hub/login",
      "Accept": "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8",
      "User-Agent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/70.0.3538.77 Safari/537.36",
      "Content-Type": "application/x-www-form-urlencoded",
      "Upgrade-Insecure-Requests": "1",
      "Origin": "http://192.168.3.49:8000",
      "Cache-Control": "max-age=0",
      "Content-Length": "29",
      "Connection": "close",
      "Host": "192.168.3.49:8000"
    }
[E 2018-11-13 10:40:11.147 JupyterHub log:158] 500 POST /hub/login?next= (@::ffff:192.168.3.47) 603.82ms