react-native run-android通过在android仿真器中的消息中保留一条消息来终止。消息如下
无法加载脚本。请确保您正在运行Metro服务器,或者已正确捆绑了软件包“ index.android.bundle”以进行发布。
我完全感到困惑,这是在做错什么。
编辑:添加错误屏幕截图
reactjs react-native react-native-android react-native-cli metro-bundler
我今天更新了node,但出现此错误:
error: TypeError: Cannot read properties of undefined (reading 'transformFile')
at Bundler.transformFile (/Users/.../node_modules/metro/src/Bundler.js:48:30)
at runMicrotasks (<anonymous>)
at processTicksAndRejections (node:internal/process/task_queues:96:5)
at async Object.transform (/Users/.../node_modules/metro/src/lib/transformHelpers.js:101:12)
at async processModule (/Users/.../node_modules/metro/src/DeltaBundler/traverseDependencies.js:137:18)
at async traverseDependenciesForSingleFile (/Users/.../node_modules/metro/src/DeltaBundler/traverseDependencies.js:131:3)
at async Promise.all (index 0)
at async initialTraverseDependencies (/Users/.../node_modules/metro/src/DeltaBundler/traverseDependencies.js:114:3)
at async DeltaCalculator._getChangedDependencies (/Users/.../node_modules/metro/src/DeltaBundler/DeltaCalculator.js:164:25)
at async DeltaCalculator.getDelta (/Users/.../node_modules/metro/src/DeltaBundler/DeltaCalculator.js:94:16)
Run Code Online (Sandbox Code Playgroud)
除此之外我没有做过任何不寻常的事情,所以我不知道该分享什么。如果我遗漏了任何信息,请评论,我会添加它。
在构建终端时也会抛出此错误:
Failed to construct transformer: Error: error:0308010C:digital envelope routines::unsupported
at new Hash (node:internal/crypto/hash:67:19)
at Object.createHash (node:crypto:130:10)
at stableHash (/Users/.../node_modules/metro-cache/src/stableHash.js:19:8)
at Object.getCacheKey (/Users/.../node_modules/metro-transform-worker/src/index.js:593:7)
at getTransformCacheKey (/Users/.../node_modules/metro/src/DeltaBundler/getTransformCacheKey.js:24:19)
at new Transformer (/Users/.../node_modules/metro/src/DeltaBundler/Transformer.js:48:9) …Run Code Online (Sandbox Code Playgroud) 我刚刚安装了node.js和cli
安装了react-native-cli
npm -g react-native-cli
Run Code Online (Sandbox Code Playgroud)并创建了一个“新项目”。
react-native init new_project
Run Code Online (Sandbox Code Playgroud)在“ new_project”目录中,我很疲倦地查看Metro bundler是否运行良好。
react-native start
Run Code Online (Sandbox Code Playgroud)但是该命令给了我以下错误,并且Metro无法启动。有任何解决此错误的线索吗?(我正在使用Windows 10 OS。)
C:\projects\new_proj>react-native start
错误无效的正则表达式:/(.\fixtures.|node_modules[]react[]dist[].|website\node_modules.|heapCapture\bundle.js|.\tests。)$/:未终止的字符类。使用--verbose标志运行CLI以获取更多详细信息。SyntaxError:无效的正则表达式:/(..fixtures.|node_modules[]react[]dist[].|website\node_modules.|heapCapture\bundle.js|.\tests.)$/:新RegExp( )在getBlacklistRE(D:\ projects \ new_proj \ node_modules \ react-native \ node_modules @ react-native)的黑名单(D:\ projects \ new_proj \ node_modules \ metro-config \ src \ defaults \ blacklist.js:34:10) getDefaultConfig上的-community \ cli \ build \ tools \ loadMetroConfig.js:69:59)(D:\ projects \ new_proj \ node_modules \ react-native \ node_modules @ react-native-community \ cli \ build \ tools \ loadMetroConfig.js :85:20)在负载(D:
reactjs react-native react-native-android react-native-cli metro-bundler
我正在本地环境中克隆现有的react本机应用程序,但每次运行'react-native run-ios'时都会出现以下错误:
** BUILD FAILED **
The following commands produced analyzer issues:
Analyze /Users/alydabbous/code/Dabbous-Innopay/ideal-app/node_modules/react-native/ReactCommon/yoga/yoga/YGNodeList.c normal x86_64
Analyze /Users/alydabbous/code/Dabbous-Innopay/ideal-app/node_modules/react-native/ReactCommon/yoga/yoga/Yoga.c normal x86_64
Analyze Base/RCTModuleMethod.mm normal x86_64
(3 commands with analyzer issues)
The following build commands failed:
Ld build/Build/Products/Debug-iphonesimulator/MyUros.app/MyUros normal x86_64
(1 failure)
Installing build/Build/Products/Debug-iphonesimulator/TPP.app
An error was encountered processing the command (domain=NSPOSIXErrorDomain, code=2):
Failed to install the requested application
An application bundle was not found at the provided path.
Provide a valid path to the desired application bundle.
Print: Entry, ":CFBundleIdentifier", Does …Run Code Online (Sandbox Code Playgroud)我试图直接从终端运行发布版本,我没有找到一个选项来做到这一点.
从XCode开始,需要做的是:
产品 - >方案 - >编辑方案(cmd + <),确保您在侧面的"运行"选项卡中,并将"构建配置"下拉列表设置为"释放".
有什么选择可以react-native-cli做同样的事情吗?有点像react-native run-ios -configuration Release?
我的目标是生成一个不需要服务器运行的构建,例如提供给QA团队.
我今天升级到Xcode 10.2,因为升级无法react-native run-ios通过cli 运行:
react-native run-ios --simulator="iPhone X"
Found Xcode workspace a.xcworkspace
Could not find iPhone X simulator
Error: Could not find iPhone X simulator
at resolve (/Users/user/Documents/work/a/a-light-ui/node_modules/react-native/local-cli/runIOS/runIOS.js:149:13)
at new Promise (<anonymous>)
at runOnSimulator (/Users/user/Documents/work/a/a-light-ui/node_modules/react-native/local-cli/runIOS/runIOS.js:134:10)
at Object.runIOS [as func] (/Users/user/Documents/work/a/a-light-ui/node_modules/react-native/local-cli/runIOS/runIOS.js:106:12)
at Promise.resolve.then (/Users/user/Documents/work/a/a-light-ui/node_modules/react-native/local-cli/cliEntry.js:117:22)
Run Code Online (Sandbox Code Playgroud)
如果我运行xcrun simctl list devices所有模拟器,则显示(Shutdown) (unavailable, runtime profile not found):
iPhone X (7AADFA50-7B57-4A40-8434-9A86F345D7ED) (Shutdown) (unavailable, runtime profile not found)
Run Code Online (Sandbox Code Playgroud)
自从将xcode升级到10.2以来,还有其他人遇到过RN的问题吗?它仍然可以通过Xcode ..起作用,但这意味着打开Xcode。
在 React Native 中,当我尝试在 Google 控制台中获取 Google GPS API 密钥时,我看到了包名称和 SHA-1 密钥,我在 React Native 中从何处获取 SHA-1 密钥
如何在 React Native cli 中获取 SHA-1 密钥?(不在世博会)。
我最近在全球范围内安装了 React Native cli。当我尝试使用react-native init projectnameor启动一个项目时npx react-native init projectname,它开始下载包并创建项目。完成后出现这个错误
cli.init(root, projectname);
^
typeerror: cli.init is not a function
at run (c:\users\showbi\appdata\roaming\npm\node_modules\react-native-cli\index.js:302:7)
at createproject (c:\users\showbi\appdata\roaming\npm\node_modules\react-native-cli\index.js:249:3)
at init (c:\users\showbi\appdata\roaming\npm\node_modules\react-native-cli\index.js:200:5)
at object.<anonymous> (c:\users\showbi\appdata\roaming\npm\node_modules\react-native-cli\index.js:153:7)
at module._compile (node:internal/modules/cjs/loader:1105:14)
at object.module._extensions..js (node:internal/modules/cjs/loader:1159:10)
at module.load (node:internal/modules/cjs/loader:981:32)
at function.module._load (node:internal/modules/cjs/loader:822:12)
at function.executeuserentrypoint [as runmain] (node:internal/modules/run_main:77:12)
at node:internal/main/run_main_module:17:47
Run Code Online (Sandbox Code Playgroud)
是什么导致了这个问题?
我按照以下链接开始使用react-native
我试图创建没有expo的本机应用程序,所以按照文档,我遵循以下命令
npm install -g react-native-cli
react-native init AwesomeProject
Run Code Online (Sandbox Code Playgroud)
运行android命令后
react-native run-android
Run Code Online (Sandbox Code Playgroud)
它给我以下模拟器错误
所以我用启动命令来运行Metro服务器
react-native start
Run Code Online (Sandbox Code Playgroud)
这个命令给了我控制台另一个错误
reactjs react-native react-native-android react-native-cli metro-bundler
我尝试在 react-native 中获取 Apk,但是它没有给我任何东西。Apk 文件中的 release 文件是空的,在 Gradlew bundle 发布完成后,它说
Deprecated Gradle features were used in this build, making it incompatible with Gradle 6.0.
Use '--warning-mode all' to show the individual deprecation warnings.
See https://docs.gradle.org/5.4.1/userguide/command_line_interface.html#sec:command_line_warnings
Run Code Online (Sandbox Code Playgroud)
我找不到如何解决这个问题
react-native run-android
info Starting JS server...
info Building and installing the app on the device (cd android && ./gradlew app:installDebug)...
Starting a Gradle Daemon, 2 incompatible and 1 stopped Daemons could not be reused, use --status for details
> Task :app:transformClassesWithDexBuilderForDebug FAILED
FAILURE: Build …Run Code Online (Sandbox Code Playgroud) react-native ×10
react-native-cli ×10
reactjs ×3
ios ×2
android ×1
build.gradle ×1
gradle ×1
javascript ×1
node.js ×1
npm ×1
npm-install ×1
xcode ×1