11

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?
Elias Zamaria
  • 96,623
  • 33
  • 114
  • 148
dragonfly
  • 17,407
  • 30
  • 110
  • 219

2 Answers2

18

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

andresmechali
  • 705
  • 2
  • 7
  • 18
  • 3
    i did not need to delete after running 'npm install' all was fine, thanks – tibi Jul 11 '19 at 10:39
  • Delete package-lock.json did the trick for me only. Everyone should try it. – Herr_Hansen Apr 09 '20 at 08:29
  • 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. – RoboBear Jul 09 '20 at 23:34
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
idsbllp
  • 836
  • 9
  • 8