用Android项目进行本机反应无法构建:react-native-share

时间:2018-11-21 05:32:06

标签: android react-native build.gradle

FPTECHS044s-MacBook-Pro:android prabhudas $ ./gradlew build --refresh-dependencies 启动Gradle守护进程,1个不兼容的守护进程和1个已停止的守护进程无法重用,请使用--status获取详细信息

失败:构建失败,并出现异常。

在1m 11s内失败

repositories {
//        google()
        jcenter()
        maven {
            url 'https://dl.google.com/dl/android/maven2'
        }
        maven { url 'https://maven.fabric.io/public' }
    }
    
    
    
    
    allprojects {
    repositories {
//        google()
        maven {
            url 'https://dl.google.com/dl/android/maven2'
        }
        jcenter()
        /*maven {
            url "https://jitpack.io"
        }*/
        maven {
            // All of React Native (JS, Obj-C sources, Android binaries) is installed from npm
//            url "/Users/prabhudas/StudioProjects/TilaWithReactJS/node_modules/react-native/android"
            url "$rootDir/../node_modules/react-native/android"
        }
        /*maven {
            url 'https://maven.google.com'
        }*/
    }
}

每次我运行 sudo react-native run-android

/Users/prabhudas/StudioProjects/TilaWithReactJS/node_modules/mkdirp/index.js:90
                    throw err0;
                    ^

Error: EACCES: permission denied, mkdir '/Users/prabhudas/StudioProjects/TilaWithReactJS/node_modules/react-native/node_modules/.cache'
    at Object.mkdirSync (fs.js:776:3)
    at sync (/Users/prabhudas/StudioProjects/TilaWithReactJS/node_modules/mkdirp/index.js:71:13)
    at sync (/Users/prabhudas/StudioProjects/TilaWithReactJS/node_modules/mkdirp/index.js:77:24)
    at sync (/Users/prabhudas/StudioProjects/TilaWithReactJS/node_modules/mkdirp/index.js:77:24)
    at save (/Users/prabhudas/StudioProjects/TilaWithReactJS/node_modules/@babel/register/lib/cache.js:50:20)
    at internalTickCallback (internal/process/next_tick.js:70:11)
    at process._tickCallback (internal/process/next_tick.js:47:5)
    at Function.Module.runMain (internal/modules/cjs/loader.js:778:11)
    at startup (internal/bootstrap/node.js:300:19)
    at bootstrapNodeJSCore (internal/bootstrap/node.js:826:3)
Process terminated. Press <enter> to close the window

logout
Saving session...
...copying shared history...
...saving history...truncating history files...
...completed.

[Process completed]

1 个答案:

答案 0 :(得分:0)

执行此命令可能对您有帮助(尝试!):

Step 1: npm uninstall react-native-share --save-dev

Step 2: npm install --save react-native-share

Step 3: npm link

Step 4: npm link react-native-share

Step 5: Killall node -9

Step 6: react-native run-android