创建应用程序时出现本机错误“无法使用 BuildScopeServices.createScriptPluginFactory() 创建 ScriptPluginFactory 类型的服务。”

Rad*_*gus 8 react-native

我试着做

react-native run-android
Run Code Online (Sandbox Code Playgroud)

但是它出现了错误

--------------
FAILURE: Build failed with an exception.

* What went wrong:
Could not create service of type ScriptPluginFactory using BuildScopeServices.createScriptPluginFactory().
> Could not create service of type PluginResolutionStrategyInternal using BuildScopeServices.createPluginResolutionStrategy().

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.

* Get more help at https://help.gradle.org

BUILD FAILED in 0s
Could not install the app on the device, read the error above for details.
Make sure you have an Android emulator running or a device connected and have
set up your Android development environment:

https://facebook.github.io/react-native/docs/getting-started.html

    Command failed: ./gradlew installDebug

    Error: Command failed: ./gradlew installDebug
        at checkExecSyncError (child_process.js:637:11)
        at Object.execFileSync (child_process.js:655:13)
        at runOnAllDevices (/Users/bobbyjulian/Desktop/ReactNative/project/node_modules/react-native/local-cli/runAndroid/runAndroid.js:299:19)
        at buildAndRun (/Users/bobbyjulian/Desktop/ReactNative/project/node_modules/react-native/local-cli/runAndroid/runAndroid.js:135:12)
        at isPackagerRunning.then.result (/Users/bobbyjulian/Desktop/ReactNative/project/node_modules/react-native/local-cli/runAndroid/runAndroid.js:65:12)
        at processTicksAndRejections (internal/process/next_tick.js:81:5)
Run Code Online (Sandbox Code Playgroud)

小智 6

我在这里遇到了类似的问题,就我而言,它与访问权限有关。只需授予对项目文件夹的读取权限。

命令:

chmod -R 777 YourFolder/

我的日志错误:

spawnSync ./gradlew EACCES

Error: spawnSync ./gradlew EACCES
    at Object.spawnSync (internal/child_process.js:998:20)
    at spawnSync (child_process.js:622:24)
    at Object.execFileSync (child_process.js:650:13)
    at runOnAllDevices (/Users/willowchung/project/AwesomeApp/node_modules/react-native/local-cli/runAndroid/runAndroid.js:299:19)
    at buildAndRun (/Users/willowchung/project/AwesomeApp/node_modules/react-native/local-cli/runAndroid/runAndroid.js:135:12)
    at isPackagerRunning.then.result (/Users/willowchung/project/AwesomeApp/node_modules/react-native/local-cli/runAndroid/runAndroid.js:65:12)
    at processTicksAndRejections (internal/process/next_tick.js:81:5)
Run Code Online (Sandbox Code Playgroud)

希望能帮助到你!


小智 6

run chmod 755 android/gradlew
Run Code Online (Sandbox Code Playgroud)

那应该可以完成工作