鍍金池/ 問答/HTML5  Android/ rn 項(xiàng)目 運(yùn)行 react-native run-android 無效?

rn 項(xiàng)目 運(yùn)行 react-native run-android 無效?

init 執(zhí)行沒啥問題

xiaogang@xiaogang MINGW64 /e/webstorm/temps
$ react-native init rn_init
prompt: Directory rn_init already exists. Continue?:  (no) yes
This will walk you through creating a new React Native project in E:\webstorm\te                                                   mps\rn_init
'yarn' ????????????????????????е????
?????????????
Installing react-native...
Consider installing yarn to make this faster: https://yarnpkg.com
rn_init@0.0.1 E:\webstorm\temps\rn_init
`-- react-native@0.50.3

npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@^1.1.1 (node_modules\sane\node_modules\fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.1.2: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"})
Setting up new React Native app in E:\webstorm\temps\rn_init
Installing React...
rn_init@0.0.1 E:\webstorm\temps\rn_init
`-- react@16.0.0

npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@^1.1.1 (node_modules\sane\node_modules\fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.1.2: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"})
Installing Jest...
rn_init@0.0.1 E:\webstorm\temps\rn_init
+-- babel-jest@21.2.0
+-- babel-preset-react-native@4.0.0
+-- jest@21.2.1
`-- react-test-renderer@16.0.0

npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@^1.1.1 (node_modules\sane\node_modules\fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.1.2: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"})
To run your app on iOS:
   cd E:\webstorm\temps\rn_init
   react-native run-ios
   - or -
   Open ios\rn_init.xcodeproj in Xcode
   Hit the Run button
To run your app on Android:
   cd E:\webstorm\temps\rn_init
   Have an Android emulator running (quickest way to get started), or a device connected

react-native run-android 時(shí) 報(bào)錯(cuò)

Scanning folders for symlinks in E:\webstorm\temps\rn_init\node_modules (46ms)
 ┌────────────────────────────────────────────────────────────────────────────┐
 │  Running Metro Bundler on port 8081.                                       │
 │                                                                            │
 │  Keep Metro Bundler running while developing on any JS projects. Feel      │
 │  free to close this tab and run your own Metro Bundler  instance if you    │
 │  prefer.                                                                   │
 │                                                                            │
 │  https://github.com/facebook/react-native                                  │
 │                                                                            │
 └────────────────────────────────────────────────────────────────────────────┘
Looking for JS files in
   E:\webstorm\temps\rn_init


Metro Bundler ready.

Loading dependency graph, done.
Bundling `index.android.js`  [development, non-minified]  0.0% (0/1), failed.
error: bundling failed: NotFoundError: Cannot find entry file index.android.js in any of the roots: ["E:\\webstorm\\temps\\rn_init"]
    at DependencyGraph.getAbsolutePath (E:\webstorm\temps\rn_init\node_modules\metro-bundler\src\node-haste\DependencyGraph.js:322:11)
    at DependencyGraph.getDependencies (E:\webstorm\temps\rn_init\node_modules\metro-bundler\src\node-haste\DependencyGraph.js:300:4465)
    at E:\webstorm\temps\rn_init\node_modules\metro-bundler\src\Resolver\index.js:135:29
    at next (native)
    at step (E:\webstorm\temps\rn_init\node_modules\metro-bundler\src\Resolver\index.js:13:830)
    at E:\webstorm\temps\rn_init\node_modules\metro-bundler\src\Resolver\index.js:13:1060
    at E:\webstorm\temps\rn_init\node_modules\metro-bundler\src\Resolver\index.js:13:741
    at Resolver.getDependencies (E:\webstorm\temps\rn_init\node_modules\metro-bundler\src\Resolver\index.js:151:46)
    at E:\webstorm\temps\rn_init\node_modules\metro-bundler\src\Bundler\index.js:660:39
    at next (native)
::1 - - [09/Nov/2017:08:33:38 +0000] "GET /favicon.ico HTTP/1.1" 404 24 "http://localhost:8081/index.android.bundle?platform=android" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/62.0.3202.89 Safari/537.36"
Bundling `index.android.js`  [development, non-minified]  0.0% (0/1), failed.
error: bundling failed: NotFoundError: Cannot find entry file index.android.js in any of the roots: ["E:\\webstorm\\temps\\rn_init"]
    at DependencyGraph.getAbsolutePath (E:\webstorm\temps\rn_init\node_modules\metro-bundler\src\node-haste\DependencyGraph.js:322:11)
    at DependencyGraph.getDependencies (E:\webstorm\temps\rn_init\node_modules\metro-bundler\src\node-haste\DependencyGraph.js:300:4465)
    at E:\webstorm\temps\rn_init\node_modules\metro-bundler\src\Resolver\index.js:135:29
    at next (native)
    at step (E:\webstorm\temps\rn_init\node_modules\metro-bundler\src\Resolver\index.js:13:830)
    at E:\webstorm\temps\rn_init\node_modules\metro-bundler\src\Resolver\index.js:13:1060
    at E:\webstorm\temps\rn_init\node_modules\metro-bundler\src\Resolver\index.js:13:741
    at Resolver.getDependencies (E:\webstorm\temps\rn_init\node_modules\metro-bundler\src\Resolver\index.js:151:46)
    at E:\webstorm\temps\rn_init\node_modules\metro-bundler\src\Bundler\index.js:660:39
    at next (native)

clipboard.png

備注:

win10 64 系統(tǒng)
Android 項(xiàng)目
今天剛開始搭建。具體是參考 http://reactnative.cn/docs/0....

望有經(jīng)驗(yàn)的 指點(diǎn)!

回答
編輯回答
情已空

react-native新版本只有一個(gè)入口index.js了
需要修改配置,參考https://github.com/facebook/r...

2017年7月5日 03:21
編輯回答
浪蕩不羈

安裝下android studio 然后安裝sdk 按照教程 就能成功的 adb devices 看看是否有設(shè)備 最后運(yùn)行 基本就可以了

2018年5月26日 13:33