mobx-remotedev icon indicating copy to clipboard operation
mobx-remotedev copied to clipboard

[React-native] Cannot read property 'getDebugName' of undefined

Open Fsarmento opened this issue 5 years ago • 6 comments

I have an app that works fine if I do not use/ reference mobx-remotedev. I can even use "react-native Debugger" to connect in debug mode and have access to the console.

However, when I add mobx-remotedev to a store, I get the error Cannot read property 'getDebugName' of undefined

// @flow
import remotedev from 'mobx-remotedev'    // <-- new
import { observable, action } from 'mobx'
import Orientation from 'react-native-orientation'
import { Keyboard, NetInfo, AppState, BackHandler } from 'react-native'

@remotedev({        // <-- new decorator
  name: 'AppStateStore',
  remote: true,
  global: true,
})
export default class AppStateStore {
  @observable keyboard: any
  @observable isConnected: boolean = true
  ...
}

error:

Cannot read property 'getDebugName' of undefined

handleException | @ | ExceptionsManager.js:63
-- | -- | --
  | handleError | @ | InitializeCore.js:69
  | reportFatalError | @ | error-guard.js:42
  | guardedLoadModule | @ | require.js:143
  | _require | @ | require.js:132
  | (anonymous) | @ | format.js:27
  | executeApplicationScript | @ | RNDebuggerWorker.js:1
  | t | @ | RNDebuggerWorker.js:1

"dependencies": { ... "react": "16.3.1", "react-native": "0.55.3", "mobx": "^5.0.3", "mobx-react": "^5.2.3", "mobx-remotedev": "^0.2.8", },

Fsarmento avatar Jul 30 '18 18:07 Fsarmento

Pull this fork and link it in your NPM/Yarn global tree.

# git clone -b SimeonC-mobx-4 https://github.com/SimeonC/mobx-remotedev
# cd mobx-remotedev
# yarn || npm install
# yarn build || npm build
# yarn link || npm link

stevefan1999-personal avatar Aug 01 '18 09:08 stevefan1999-personal

Thanks @stevefan1999 !

I followed your instructions and then I did the following commands

# cd.. && cd peeqDaycare     (my_project)
# yarn link "mobx-remotedev"

but now I get the following error:

error: bundling failed: Error: Unable to resolve module `./getDecorator` from `/Users/franciscosarmento/Dev/peeq/peeqDaycare/node_modules/mobx-remotedev/lib/index.js`: The module `./getDecorator` could not be found from `/Users/franciscosarmento/Dev/peeq/peeqDaycare/node_modules/mobx-remotedev/lib/index.js`. Indeed, none of these files exist:

  * `/Users/franciscosarmento/Dev/peeq/peeqDaycare/node_modules/mobx-remotedev/lib/getDecorator(.native||.ios.js|.native.js|.js|.ios.json|.native.json|.json)`
  * `/Users/franciscosarmento/Dev/peeq/peeqDaycare/node_modules/mobx-remotedev/lib/getDecorator/index(.native||.ios.js|.native.js|.js|.ios.json|.native.json|.json)`

My project is in the folder /Users/franciscosarmento/Dev/peeq/peeqDaycare and I cloned the fork to /Users/franciscosarmento/Dev/peeq/mobx-remotedev. Shouldn't it be getting the files from the fork folder instead after being linked?

What am I doing wrong?

Fsarmento avatar Aug 01 '18 10:08 Fsarmento

~~Oh yes I've forgotten a build process :)~~ @Fsarmento Try import remoteDev from 'mobx-remotedev/dist'

stevefan1999-personal avatar Aug 01 '18 10:08 stevefan1999-personal

Thanks @stevefan1999, I ended up using this fork directly by installing the package as yarn add mobx-remotedev@dayangdata/mobx-remotedev (it was also updated to allow mobx4 for react-native)

Fsarmento avatar Aug 06 '18 18:08 Fsarmento

Is anybody going to fix it?

eugene-beliaev avatar Aug 12 '18 10:08 eugene-beliaev

Any updates on this?

samscarsella avatar Sep 18 '18 18:09 samscarsella