简体   繁体   中英

IOException File too large, while downloading gradle on mac while running react-native run-android command

I am in the process of setting up my development environment for react-native android development.

I have already followed all the steps as mentioned in installation guide: https://reactnative.dev/docs/environment-setup

I am getting the following exception while executing npx react-native run-android

info Running jetifier to migrate libraries to AndroidX. You can disable it using "--no-jetifier" flag.
(node:14406) Warning: Accessing non-existent property 'padLevels' of module exports inside circular dependency
(Use `node --trace-warnings ...` to show where the warning was created)
Jetifier found 1426 file(s) to forward-jetify. Using 8 workers...
info JS server already running.
info Launching emulator...
error Failed to launch emulator. Reason: Emulator exited before boot..
warn Please launch an emulator manually or connect a device. Otherwise app may fail to launch.
info Installing the app...
debug Running command "cd android && ./gradlew app:installDebug -PreactNativeDevServerPort=8081"
Downloading https://services.gradle.org/distributions/gradle-6.2-all.zip
..
Exception in thread "main" java.io.IOException: File too large
    at java.base/java.io.FileOutputStream.writeBytes(Native Method)
    at java.base/java.io.FileOutputStream.write(FileOutputStream.java:347)
    at java.base/java.io.BufferedOutputStream.write(BufferedOutputStream.java:123)
    at org.gradle.wrapper.Download.downloadInternal(Download.java:98)
    at org.gradle.wrapper.Download.download(Download.java:63)
    at org.gradle.wrapper.Install$1.call(Install.java:68)
    at org.gradle.wrapper.Install$1.call(Install.java:48)
    at org.gradle.wrapper.ExclusiveFileAccessManager.access(ExclusiveFileAccessManager.java:69)
    at org.gradle.wrapper.Install.createDist(Install.java:48)
    at org.gradle.wrapper.WrapperExecutor.execute(WrapperExecutor.java:107)
    at org.gradle.wrapper.GradleWrapperMain.main(GradleWrapperMain.java:63)

error Failed to install the app. Make sure you have the Android development environment set up: https://reactnative.dev/docs/environment-setup.
Error: Command failed: ./gradlew app:installDebug -PreactNativeDevServerPort=8081

React native version:react-native-cli: 2.0.1 react-native: 0.63.2 macOS version 11.2.2

Looks like it was the OS which was complaining that the file is too big. Probably there is a limit on Maximum size of files created by the shell. ulimit -f 2097152 which will set the limit to 2 GB (2097152 kB = 2 GB). This solved the problem for me.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM