Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
1.1k views
in Technique[技术] by (71.8m points)

react native - 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:Usersgodha.pranayproject
ode_modules
eact-nativeLibraries
eact-native
eact-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.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

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 react-native@0.55.4
react-native run-android
npm install --save babel-core@latest babel-loader@latest
npm uninstall --save babel-preset-react-native
npm install --save babel-preset-react-native@4.0.0
react-native run-android

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...