Doesn't build after project initialization
After recent update in cli-platform-android the project doesn't start. Stating Cannot invoke method getErrorStream() on null object. I wanted to submit an issue for that package but I could not find a github repo for that.
$ react-native run-android
info Running jetifier to migrate libraries to AndroidX. You can disable it using "--no-jetifier" flag.
Jetifier found 863 file(s) to forward-jetify. Using 8 workers...
info Starting JS server...
info Installing the app...
:ReactNative:Cannot run program "npx": CreateProcess error=2, ═х єфрхЄё эрщЄш єърчрээ√щ Їрщы
:ReactNative:Automatic import of native modules failed.
FAILURE: Build failed with an exception.
* Where:
Script 'C:\TEMP\natapp\node_modules\@react-native-community\cli-platform-android\native_modules.gradle' line: 169
* What went wrong:
A problem occurred evaluating script.
> Cannot invoke method getErrorStream() on null object
* 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 1s
error Failed to install the app. Make sure you have the Android development environment set up: https://facebook.github.io/react-native/docs/getting-started.html#android-development-environment. Run CLI with --v
erbose flag for more details.
Error: Command failed: gradlew.bat app:installDebug -PreactNativeDevServerPort=8081
FAILURE: Build failed with an exception.
* Where:
Script 'C:\TEMP\natapp\node_modules\@react-native-community\cli-platform-android\native_modules.gradle' line: 169
* What went wrong:
A problem occurred evaluating script.
> Cannot invoke method getErrorStream() on null object
* 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 1s
at checkExecSyncError (child_process.js:621:11)
at execFileSync (child_process.js:639:15)
at runOnAllDevices (C:\TEMP\natapp\node_modules\@react-native-community\cli-platform-android\build\commands\runAndroid\runOnAllDevices.js:94:39)
at buildAndRun (C:\TEMP\natapp\node_modules\@react-native-community\cli-platform-android\build\commands\runAndroid\index.js:158:41)
at C:\TEMP\natapp\node_modules\@react-native-community\cli-platform-android\build\commands\runAndroid\index.js:125:12
at processTicksAndRejections (internal/process/task_queues.js:85:5)
at async Command.handleAction (C:\TEMP\natapp\node_modules\@react-native-community\cli\build\index.js:164:9)
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
I'm running on Windows 10 x64 and node version is 12.8.0
The code is here in this repo :) https://github.com/react-native-community/cli/tree/master/packages/platform-android. Fixing it is appreciated
I see Cannot run program "npx" in the error message. Can you verify npx works for you as a standalone command? It should ship with npm by default.
I see
Cannot run program "npx"in the error message. Can you verifynpxworks for you as a standalone command? It should ship with npm by default.
Yes it does. I created the project using this command
npx react-native init MyApp --template react-native-template-typescript
And I noticed that platform-android was updated recently. Before this update everything worked fine.
Ww change quite a bit there to improve monorepo support. We would appreciate further debugging on this
Funny as I have another project inside a monorepo. And obviously I had some issues there due to lack of symlinks support and I thought that I eventually found the solution. Reinstalled the dependencies and it stopped working because of this issue.
Also tried this command
npx react-native init MyApp --template [email protected]
It works just fine there
I just tried on this template and can't reproduce, so most likely it's Windows related. Can you run npx --quiet react-native config exactly? This is what we run under the hood. Maybe the --quiet flag is a problem?
I'm also having this issue on a fresh created project on Windows.
yarn react-native --version output: 3.0.0-alpha.6
node version: 12.10.0
yarn version: 1.19.0
I had started a project with npx react-native, but react-native was installed globally, I uninstalled it and everything is working fine now
I'm having this issue as well on a new project when i run
react-native run-android
Node version : 12.12.0
react-native-cli version: 2.0.1
react-native version: 0.61.2
I'm also facing this issue from morning today. Till yesterday it all went fine. react-native run-android
Node version : 10.16.3 react-native-cli version: 2.0.1 react-native version: 0.61.2
I'm on same status Node Version: v12.12.0 react-native --version 3.3.0-alpha.6
On Windows, npx command is "npx.cmd" and windows terminal can omit extensions for executables(i.e. bat,cmd,exe ) .so we can run npx by "npx" in the terminal, but it's looks only in terminal (except for *.exe) I modified native_modules.gradle L.153 "npx --quiet react-native config" to "npx.cmd --quiet react-native config" ,then I could run run-android but it's not smart and not portable.
@zrelyydereva - this worked for the time being. thanks for that.
It worked for me after I manually installed cli-platform-android
Same error on Android.
:ReactNative:Cannot run program "npx": CreateProcess error=2 ... Cannot invoke method getErrorStream() on null object
Anybody have some idea with this condition?
I wonder if there's any way to rollback to previous version when it was working. I also noticed that all react native community dependencies do not appear in package.json. it would be great to have them there for a possibility to lock the version which is actually working.
It worked for me after I manually installed cli-platform-android whats the command to do that..
CLI is a direct dependency of react-native and we want it to keep it this way. You can use yarn resolutions in package.json to pin to previous version:
"resolutions": {
"@react-native-community/cli": "3.0.0-alpha.2",
"@react-native-community/cli-platform-android": "3.0.0-alpha.2",
"@react-native-community/cli-platform-ios": "3.0.0-alpha.2",
"@react-native-community/cli-tools": "2.8.3"
}
CLI is a direct dependency of react-native and we want it to keep it this way. You can use yarn resolutions in package.json to pin to previous version:
"resolutions": { "@react-native-community/cli": "3.0.0-alpha.2", "@react-native-community/cli-platform-android": "3.0.0-alpha.2", "@react-native-community/cli-platform-ios": "3.0.0-alpha.2", "@react-native-community/cli-platform-tools": "2.8.3" }
@react-native-community/cli-platform-tools => @react-native-community/cli-tools
I've sent a PR with a possible fix: https://github.com/react-native-community/cli/pull/801 that @zrelyydereva suggested (thanks!). Can you make sure it works for you?
Released alpha.7 with a fix for that. Please update the @react-native-community/cli to the latest version and let us know :)