React Native: Module RCTLog is not a registered callable module (calling logIfNoNativeHook)

Viewed 1715

I made a React Native package and published it on npm.

The problem is when I run the code as a normal component inside React Native app it's work fine with no errors.

When I publish the package on Npm and download it to my project as a dependency the app is throwing red screen error.

The error is:

Invariant Violation: Module RCTLog is not a registered callable module (calling logIfNoNativeHook)

__callFunction
    index.bundle?platform=ios&dev=true&minify=false:109413:18
<unknown>
    index.bundle?platform=ios&dev=true&minify=false:109128:31
__guard
    index.bundle?platform=ios&dev=true&minify=false:109369:15
callFunctionReturnFlushedQueue
    index.bundle?platform=ios&dev=true&minify=false:109127:21
callFunctionReturnFlushedQueue
    [native code]:0

Note: All the code available on Github and the package is available on Npm if you can install it and give me feedback if you get the same error of not also it can be helpful

3 Answers

The reason is probably due to this.

I would try to implement the suggestion above to basically add this var RCTLog = require('RCTLog'); into the index.ios.js file.

Usually caused by a corrupt cache.

  1. Stop metro bundler
  2. rm -rf $TMPDIR/metro-cache/
  3. Start bundler again (react-native start)
Related