Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Unable to resolve module 'AccessibilityInfo', when trying to create release bundle

I am running

react-native bundle --platform windows --dev false --entry-file index.windows.js --bundle-output windows/app/ReactAssets/index.windows.bundle --assets-dest windows/app/ ReactAssets/

command to create release bundle, but I am getting following error

Unable to resolve module `AccessibilityInfo` from `C:\Users\godha.pranay\project\node_modules\react-native\Libraries\react-native\react-native-implementation.js`: Module does not exist in the module map



This might be related to https://github.com/facebook/react-native/issues/4968

To resolve try the following:

  1. Clear watchman watches: `watchman watch-del-all`.

  2. Delete the `node_modules` folder: `rm -rf node_modules && npm install`.

  3. Reset Metro Bundler cache: `rm -rf $TMPDIR/react-*` or `npm start -- --reset-cache`.  4. Remove haste cache: `rm -rf $TMPDIR/haste-map-react-native-packager-*`.

I tried everything recommended on internet, nothing is working. I am totally stuck on it. Please help.

like image 806
pranay godha Avatar asked Feb 12 '18 22:02

pranay godha


4 Answers

It seems like a bug in 0.56 related to dependencies. The "solution" is to find the correct combination of dependencies' versions. We found a workaround by installing those versions EXACTLY:

react-native >> 0.55.4
babel-core >> latest 
babel-loader >> latest
babel-preset-react-native >> 4.0.0

So you have to run those commands in order:

react-native init AwesomeProject
cd AwesomeProject
react-native run-android
npm uninstall react-native
npm install --save [email protected]
react-native run-android
npm install --save babel-core@latest babel-loader@latest
npm uninstall --save babel-preset-react-native
npm install --save [email protected]
react-native run-android
like image 102
mr L Avatar answered Nov 09 '22 05:11

mr L


If you are running the reactive-native version 0.56.0 then downgrade it to 0.55.4.

cd "on your project directory"
npm install [email protected]

If you want to know the reason follow this issue.

like image 45
JFC Avatar answered Nov 09 '22 05:11

JFC


i had the same issue.

previous my react-native version was

C:\WINDOWS\system32>react-native -v
react-native-cli: 2.0.1
react-native: 0.56.0

then i uninstall react-native

C:\WINDOWS\system32>npm uninstall -g react-native-cli
removed 41 packages in 3.999s

then i installed react-native

npm install [email protected]

again intsalled

npm install -g [email protected]

then this installation of creating react-native project work out

react-native init --version="0.55.4" myprojectname
like image 8
Raikumar Khangembam Avatar answered Nov 09 '22 04:11

Raikumar Khangembam


    "dependencies": {
        "react": "^16.4.1",
        "react-native": "^0.55.4"
      },
    "devDependencies": {
        "babel-preset-react-native": "^4.0.0",
      },

then hit following commands

    npm update
    npm cache clean --force
    cd android
    gradlew clean
    cd..
    react-native run-android

Worked for me

like image 6
Umesh Patadiya Avatar answered Nov 09 '22 05:11

Umesh Patadiya