反应本机命令给出错误

时间:2018-08-09 06:30:09

标签: android reactjs react-native

希望每个人都做得很好,我在react native命令中遇到了一个问题,我创建了Assets文件夹,然后运行命令

react-native bundle --platform android --dev false --entry-file index.js --bundle-output android/app/src/main/assets/index.android.bundle --assets-dest android/app/src/main/res

但是它再次给我错误n

Unable to resolve module `AccessibilityInfo` from `C:\AnkitaFolder\Vanilla1\node_modules\react-native\Libraries\react-native\react-native-implementation.js`: Module `AccessibilityInfo` does not exist in the Haste 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 /tmp/metro-bundler-cache-*` or `npm start -- --reset-cache`.  4. Remove haste cache: `rm -rf /tmp/haste-map-react-native-packager-*`.

我尝试了所有可能的方法,但是一旦工作仍然无法正常工作,并再次给出了相同的错误。我所使用的版本如下所述。

 NPM-VER- 6.3.0 
    "react": "16.4.1",
    "react-native": "0.56.0"
"devDependencies": {
    "babel-jest": "23.4.2",
    "babel-preset-react-native": "5",
    "jest": "23.4.2",
    "react-test-renderer": "16.4.1"
  },

1 个答案:

答案 0 :(得分:0)

尝试清理npm和所有缓存。如果无法解决问题,则可能是您的捆绑道具错误或文件已损坏

  1. rm -rf $ TMPDIR / react-native-packager-cache- * && rm -rf $ TMPDIR / metro-bundler-cache-*
  2. cd android && ./gradlew clean
  3. 删除所有node_modules
  4. npm缓存清理或npm缓存清理--force

On windows React 0.56 not working for https://github.com/facebook/react-native/issues/19953 also https://github.com/facebook/react-native/issues/20353