我刚刚使用初始化命令create-react-native-app
启动了我的项目,并且安装了所有必备组件。
我在使用命令react-native run-android
时遇到了一些问题,我得到了这个错误
Starting JS server...
Building and installing the app on the device (cd android && ./gradlew installDebug)...
Incremental java compilation is an incubating feature.
:app:preBuild UP-TO-DATE
:app:preDebugBuild UP-TO-DATE
:app:checkDebugManifest
:app:preReleaseBuild UP-TO-DATE
:app:prepareComAndroidSupportAppcompatV72301Library UP-TO-DATE
:app:prepareComAndroidSupportRecyclerviewV72301Library UP-TO-DATE
:app:prepareComAndroidSupportSupportV42301Library UP-TO-DATE
:app:prepareComFacebookFrescoDrawee081Library UP-TO-DATE
:app:prepareComFacebookFrescoFbcore081Library UP-TO-DATE
:app:prepareComFacebookFrescoFresco081Library UP-TO-DATE
:app:prepareComFacebookFrescoImagepipeline081Library UP-TO-DATE
:app:prepareComFacebookFrescoImagepipelineOkhttp081Library UP-TO-DATE
:app:prepareComFacebookReactReactNative0201Library UP-TO-DATE
:app:prepareOrgWebkitAndroidJscR174650Library UP-TO-DATE
:app:prepareDebugDependencies
:app:compileDebugAidl UP-TO-DATE
:app:compileDebugRenderscript UP-TO-DATE
:app:generateDebugBuildConfig UP-TO-DATE
:app:mergeDebugShaders UP-TO-DATE
:app:compileDebugShaders UP-TO-DATE
:app:generateDebugAssets UP-TO-DATE
:app:mergeDebugAssets UP-TO-DATE
:app:generateDebugResValues UP-TO-DATE
:app:generateDebugResources UP-TO-DATE
:app:mergeDebugResources UP-TO-DATE
:app:bundleDebugJsAndAssets SKIPPED
:app:processDebugManifest UP-TO-DATE
:app:processDebugResources UP-TO-DATE
:app:generateDebugSources UP-TO-DATE
:app:incrementalDebugJavaCompilationSafeguard UP-TO-DATE
:app:compileDebugJavaWithJavac
:app:compileDebugJavaWithJavac - is not incremental (e.g. outputs have changed, no previous execution, etc.).
我试图搜索它,人们都在谈论升级react-native,但当我尝试"react-native-git-upgrade“时,我的"package.json”版本出现错误。
git-upgrade info Check for updates
git-upgrade info Read package.json files
git-upgrade info Check declared version
git-upgrade info Check matching versions
git-upgrade ERR! An error occurred during upgrade:
git-upgrade ERR! Error: react-native version in "package.json" (https://github.com/expo/react-native/archive/sdk-30.0.0.tar.gz) doesn't match the installed version in "node_modules" (0.55.4).
Try running "npm install" to fix this.
at checkMatchingVersions (/usr/local/lib/node_modules/react-native-git-upgrade/checks.js:24:11)
at Object.<anonymous> (/usr/local/lib/node_modules/react-native-git-upgrade/cliEntry.js:253:5)
at Generator.next (<anonymous>)
at step (/usr/local/lib/node_modules/react-native-git-upgrade/cliEntry.js:171:191)
at /usr/local/lib/node_modules/react-native-git-upgrade/cliEntry.js:171:361
at tryCallOne (/usr/local/lib/node_modules/react-native-git-upgrade/node_modules/promise/lib/core.js:37:12)
at /usr/local/lib/node_modules/react-native-git-upgrade/node_modules/promise/lib/core.js:123:15
at flush (/usr/local/lib/node_modules/react-native-git-upgrade/node_modules/asap/raw.js:50:29)
at _combinedTickCallback (internal/process/next_tick.js:131:7)
at process._tickCallback (internal/process/next_tick.js:180:9)
当我执行npm install
没有任何更改时,我尝试删除我的node_modules目录并使用npm install
创建一个新目录,但它没有更改。
我在Ubuntu上,几天以来我一直在为这个问题而苦苦挣扎。
发布于 2018-10-18 12:57:31
我认为这些步骤会对你有所帮助。
构建文件夹进入你的项目目录并运行这个命令Ubuntu:cd android && ./gradlew clean
rm -rf build
中,如果这个步骤没有产生任何结果,那么按照步骤1,2,然后删除node_modules目录,然后在你的项目<npm install
。最后,从中使用这个命令react-native run-android
https://stackoverflow.com/questions/52831555
复制相似问题