System:
OS: macOS 10.14.5
CPU: (4) x64 Intel(R) Core(TM) i5-7360U CPU @ 2.30GHz
Memory: 599.25 MB / 16.00 GB
Shell: 5.3 - /bin/zsh
Binaries:
Node: 10.15.0 - ~/.nvm/versions/node/v10.15.0/bin/node
Yarn: 1.10.1 - ~/.yarn/bin/yarn
npm: 6.4.1 - ~/.nvm/versions/node/v10.15.0/bin/npm
SDKs:
iOS SDK:
Platforms: iOS 12.2, macOS 10.14, tvOS 12.2, watchOS 5.2
IDEs:
Android Studio: 3.1 AI-173.4819257
Xcode: 10.2.1/10E1001 - /usr/bin/xcodebuild
npmPackages:
react: 16.8.6 => 16.8.6
react-native: 0.60.4 => 0.60.4
After I run react-native run-android, the entire react-native command will break on this line.
// FILE: node_modules/@react-native-community/cli/build/commands/server/middleware/getDevToolsMiddleware.js
var __opn = require('opn');
It seems that this package is not even used, so I fixed this error, by just removing the entire line.
The interesting part is, that I haven't seen this error, when running ios app. It broke completely the first time I run the run-android.
Doesn't seem to be related to this: https://github.com/react-native-community/cli/issues/468, since I don't have monorepo. android folder is on same level as node_modules.
When directly running
"node ./node_modules/react-native/cli.js config"
internal/modules/cjs/loader.js:583
throw err;
^
Error: Cannot find module 'opn'
at Function.Module._resolveFilename (internal/modules/cjs/loader.js:581:15)
at Function.Module._load (internal/modules/cjs/loader.js:507:25)
at Module.require (internal/modules/cjs/loader.js:637:17)
at require (internal/modules/cjs/helpers.js:22:18)
at Object.<anonymous> (/Users/lukaskurucz/Git/app-name/node_modules/@react-native-community/cli/build/commands/server/middleware/getDevToolsMiddleware.js:41:13)
at Module._compile (internal/modules/cjs/loader.js:689:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:700:10)
at Module.load (internal/modules/cjs/loader.js:599:32)
at tryModuleLoad (internal/modules/cjs/loader.js:538:12)
at Function.Module._load (internal/modules/cjs/loader.js:530:3)
Gradle error for reference
FAILURE: Build failed with an exception.
* Where:
Script '/Users/lukaskurucz/Git/app-name/node_modules/@react-native-community/cli-platform-android/native_modules.gradle' line: 190
* What went wrong:
A problem occurred evaluating settings 'app-name'.
> Text must not be null or empty
* 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
There's no such call in the source and build output on latest version. Please update the @react-native-community/cli.
Adding for reference:
Not even cli issue. I was using react-native-debugger
Which has this template:
https://github.com/jhen0409/react-native-debugger/blob/master/npm-package/lib/injectDevToolsMiddleware.tmpl.js
to inject ingetDevToolsMiddleware.js file.
This ultimately break the latest CLI.
Most helpful comment
Not even cli issue. I was using
react-native-debuggerWhich has this template:
https://github.com/jhen0409/react-native-debugger/blob/master/npm-package/lib/injectDevToolsMiddleware.tmpl.js
to inject in
getDevToolsMiddleware.jsfile.This ultimately break the latest CLI.