我尝试安装本机react,当我输入命令npm时,运行android-windows出现错误。
如何解决这个问题?
这是我的packages.json
{ “ name”:“ Fyp”, “ version”:“ 0.0.1”, “私人”:是的, “脚本”:{ “ start”:“ react-native start”, “ test”:“开玩笑”, “ lint”:“ eslint”, “ android-windows”:“ react-native bundle --platform android --dev false npm run android-windows--entry-file index.js --bundle-output android / app / src / main / assets / index.android .bundle --assets-dest android / app / src / main / res && react-native run-android“ }, “依赖关系”:{ “ react”:“ 16.8.6”, “本机”:“ 0.60.5” }, “ devDependencies”:{ “ @ babel / core”:“ 7.5.5”, “ @ babel /运行时”:“ 7.5.5”, “ @ react-native-community / eslint-config”:“ 0.0.3”, “ babel-jest”:“ 24.9.0”, “ eslint”:“ 6.3.0”, “ jest”:“ 24.9.0”, “ metro-react-native-babel-preset”:“ 0.54.1”, “ react-test-renderer”:“ 16.8.6” }, “笑话”:{ “ preset”:“ react-native” } }
这是错误
错误缺少选项“ --entry-file”。使用--verbose标志运行CLI以获取更多详细信息。
错误:缺少选项“ --entry-file”
在C:\ Users \ user \ Fyp \ node_modules \ react-native \ node_modules @ react-native-community \ cli \ build \ tools \ assertRequiredOptions.js:51:13
在Array.forEach()
在assertRequiredOptions(C:\ Users \ user \ Fyp \ node_modules \ react-native \ node_modules @ react-native-community \ cli \ build \ tools \ assertRequiredOptions.js:40:11)
在Command.handleAction(C:\ Users \ user \ Fyp \ node_modules \ react-native \ node_modules @ react-native-community \ cli \ build \ cliEntry.js:159:42)
在Command.listener(C:\ Users \ user \ Fyp \ node_modules \ commander \ index.js:315:8)
在Command.emit(events.js:209:13)
在Command.parseArgs(C:\ Users \ user \ Fyp \ node_modules \ commander \ index.js:651:12)
在Command.parse(C:\ Users \ user \ Fyp \ node_modules \ commander \ index.js:474:21)
在setupAndRun(C:\ Users \ user \ Fyp \ node_modules \ react-native \ node_modules @ react-native-community \ cli \ build \ cliEntry.js:210:24)
在Object.run(C:\ Users \ user \ Fyp \ node_modules \ react-native \ node_modules @ react-native-community \ cli \ build \ cliEntry.js:173:11)
npm ERR!代码ELIFECYCLE
npm ERR! errno 1
npm ERR! Fyp@0.0.1 android-windows:react-native bundle --platform android --dev false npm run android-windows--entry-file index.js --bundle-output android/app/src/main/ass
ets/index.android.bundle --assets-dest android/app/src/main/res && react-native run-android
npm ERR!退出状态1
npm ERR!
npm ERR!在Fyp@0.0.1 android-windows脚本处失败。
npm ERR! npm可能不是问题。上面可能还有其他日志记录输出。
npm错误!可以在以下位置找到此运行的完整日志: npm ERR! C:\ Users \ user \ AppData \ Roaming \ npm-cache_logs \ 2019-09-06T15_03_19_543Z-debug.log
答案 0 :(得分:0)
尝试以下命令:
react-native bundle --dev false --platform android --entry-file index.js --bundle-output ./android/app/build/intermediates/assets/debug/index.android.bundle --assets-dest ./android/app/build/intermediates/res/merged/debug
答案 1 :(得分:0)
尝试此命令:
react-native bundle --dev false --platform android --entry-file index.js --bundle-output ./android/app/src/main/assets/index.android.bundle --assets-dest ./android/app/src/main/res
链接here需要修复