zilverline / react-tap-event-plugin

Instant TapEvents for React
http://facebook.github.io/react/
MIT License
1.07k stars 110 forks source link

Uncaught TypeError: Cannot read property 'injection' of undefined #123

Closed ghost closed 6 years ago

ghost commented 6 years ago

I've just been assigned to a project which makes use of this plugin, the project works fine on other members' machine, but on my machine it is throwing the error mentioned in title.

The version number of React and React-DOM is 16.0.36 and 16.0.3 respectively.

So, based on readme.md this plugin should be supported.

The error looks like the following:

react-event-tap-error

As of now, I've put the function call injectTpEventPlugin(); in a try-catch block, so that the project can at least be run.

paulincai commented 6 years ago

Could you please let me know how and where you initialize the plugin in JS.

ghost commented 6 years ago

It is initialized in index.js file, the code looks like the following:

code-error-react-event-tap

paulincai commented 6 years ago

Would you please try to first fix the misspelling in the function name just to make sure there is no issue there.

ghost commented 6 years ago

Sorry, my mistake! but I changed the spelling to injectTapEventPlugin and still the same error is persisting.

paulincai commented 6 years ago

Ok, not sure what this might be, I cannot reproduce when I remove various things like jquery. If you say it works fine on other machines, I'd look at the local NPM setup in the packages.json and in the local NPM on the machine. It may be that your jquery version is newer. The rest of the error you have related to jquery was introduced in the past as a result of a breaking change in a new jquery version. That might be the issue. Anyway, if the exact same project works on a different machine, clearly the code is valid, I'd say. So ... NPMs...

ghost commented 6 years ago

I was just doing trial and error and i commented out the function call and I moved it in

if (module.hot) {
  module.hot.accept('./containers/app/App', () => {
    injectTapEventPlugin();
    const RootComponent = require('./containers/app/App').default;
    renderApp(RootComponent);
  });
}

And it has started working don't know how, but it's working now. Anyway thanks for the cooperation.

paulincai commented 6 years ago

thumb_my-code-doesnt-work-ihave-no-idea-why-my-code-works-14032925