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

2

12

I've installed latest "rxjs": "6.2.2", and "redux-observable": "1.0.0",.

I have precommit hook that does eslint checks.

After installation is started to throw this error:

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?
Brad answered 20/8, 2018 at 9:17 Comment(0)
A
19

I had a similar issue. I deleted the package-lock.json and the node-modules folder, run npm install and everything was fixed.

Agility answered 12/10, 2018 at 8:43 Comment(3)
i did not need to delete after running 'npm install' all was fine, thanksClementclementas
Delete package-lock.json did the trick for me only. Everyone should try it.Wakayama
I had this problem with a Bitbucket Pipeline after there was a reset on their end. This was the solution for my pipeline to run again successfully, thanks.Caia
D
6

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.

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

so, just install the dependency

npm install rxjs-compat
Distributary answered 18/10, 2018 at 7:3 Comment(0)

© 2022 - 2025 — McMap. All rights reserved.