Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/android/225.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Android 世博会&x2B;react native:发送日志消息时出现问题_Android_Node.js_React Native_Expo - Fatal编程技术网

Android 世博会&x2B;react native:发送日志消息时出现问题

Android 世博会&x2B;react native:发送日志消息时出现问题,android,node.js,react-native,expo,Android,Node.js,React Native,Expo,我正在构建一个react原生应用程序,最近我将其移动到了世博会。应用程序似乎显示了预期的屏幕,但在它完成之前,我收到了以下错误消息:console.error:“向开发环境发送日志消息时出现问题,{“name”:“error”}”。当我查看expo browser屏幕时,当我单击设备时,我会看到以下堆栈跟踪: node_modules/expo/build/logs/LogSerialization.js:146:14 in _captureConsoleStackTrace node_

我正在构建一个react原生应用程序,最近我将其移动到了世博会。应用程序似乎显示了预期的屏幕,但在它完成之前,我收到了以下错误消息:console.error:“向开发环境发送日志消息时出现问题,{“name”:“error”}”。当我查看expo browser屏幕时,当我单击设备时,我会看到以下堆栈跟踪:

  node_modules/expo/build/logs/LogSerialization.js:146:14 in _captureConsoleStackTrace
  node_modules/expo/build/logs/LogSerialization.js:41:24 in Object.serializeLogDataAsync$
  node_modules/regenerator-runtime/runtime.js:62:39 in tryCatch
  node_modules/regenerator-runtime/runtime.js:288:21 in Generator.invoke [as _invoke]
  node_modules/regenerator-runtime/runtime.js:114:20 in Generator.prototype.(anonymous
  node_modules/regenerator-runtime/runtime.js:62:39 in tryCatch
  node_modules/regenerator-runtime/runtime.js:152:19 in invoke
  node_modules/regenerator-runtime/runtime.js:187:10 in <unknown>
  node_modules/promise/setimmediate/core.js:45:4 in tryCallTwo
  node_modules/promise/setimmediate/core.js:200:12 in doResolve
node_modules/expo/build/logs/LogSerialization.js:146:14 in_captureConsoleStackTrace
Object.serializeLogDataAsync中的node_modules/expo/build/logs/LogSerialization.js:41:24$
tryCatch中的node_modules/registrator runtime/runtime.js:62:39
Generator.invoke[as _invoke]中的node_modules/registrator runtime/runtime.js:288:21
Generator.prototype中的node_modules/registrator runtime/runtime.js:114:20。(匿名)
tryCatch中的node_modules/registrator runtime/runtime.js:62:39
invoke中的node_modules/registrator runtime/runtime.js:152:19
node_modules/registrator runtime/runtime.js:187:10 in
tryCallTwo中的node_modules/promise/setimmediate/core.js:45:4
doResolve中的node_modules/promise/setimmediate/core.js:200:12
以下是错误的屏幕截图:


这个错误是什么意思?我发现一些文档提到删除console.log语句,并删除了我有的语句,但没有帮助。

今天早上我也遇到了这个奇怪的错误。我正在使用Expo客户端开发react-native,用于我正在使用流行的MERN堆栈(mongoDB、Express、react-native和Node.js)构建的应用程序。我提到的是,因为我使用了很多控制台日志,我的意思是后端有很多控制台日志,到目前为止,这并没有给我带来任何问题。因此,在我的例子中,我不确定此错误是否源于我使用的任何console.log。我在控制台中检查了expo调试器的stacktrace(在端口19001中),因为红色屏幕没有提供有关错误来源的更多信息(许多
代替函数)我发现这与我的操作功能以及我在执行与后端通信的特定操作时发送给减速器的负载有关。后端的响应格式如下:

payload: {
  config: {
     .
     .
     .
 }
 data: { the only part that i needed... }
 headers: {
    .
    .
    .
}

..other stuff from the response..
上面没有什么值得注意的,但是:

我感兴趣的实际工资是在道具键
数据
下的,并且是我从响应中需要的唯一东西。但是,在我的无知中,我把所有东西都发送到了我的减速机。所以我要说的是,我发送了一个非常大的
对象作为
有效载荷
,我只需要它的一部分。所以当我做一些dest时重新构造并保留我上面提到的
数据
,错误消失了

总之,对于其他可能偶然发现这一“错误”的人这实际上不是一个错误,bc应用程序不会崩溃或发生任何事情,因为你可以关闭窗口,然后应用程序继续运行,当你从服务器获取数据时,确保你只保留
数据
,而不保留整个
响应
对象,以及调用中的元数据。看起来
redux logger
抛出了这个b它不喜欢它的结构


我希望这也能对您有所帮助。

这是因为React本机控制台记录器无法解析来自Axios的JSON对象。 我可以保证出现此错误的任何人都不会在将JSON对象记录到控制台之前解析它

将产生此错误的代码:

Axios.post(URL).then(function (response)
{
console.log("POST RESPONSE: "+response);
}
Axios.post(URL).then(function (response)
{
console.log("POST RESPONSE: "+JSON.stringify(response));
}
修复此错误的代码:

Axios.post(URL).then(function (response)
{
console.log("POST RESPONSE: "+response);
}
Axios.post(URL).then(function (response)
{
console.log("POST RESPONSE: "+JSON.stringify(response));
}

我也遇到过这个问题,但由于其他原因

背景: 项目堆栈(对错误很重要的部分):

expo:^34.0.1
react-native:SDK 34
react导航:4.0.5
react导航抽屉:^2.2.1

在这个项目中,我没有使用
react-redux
axios
我实际上是使用
graphql
@apollo/react-hooks
apollo-boost
来处理网络请求和本地状态管理

答复: 正如您在后台看到的,我使用的是
react导航
。根据

我想使用
DrawerNavigatorConfig
contentComponent
属性来创建自定义
DrawerNavigatorItems

我在
contentComponent
属性中放置了和匿名箭头函数,唯一的参数是
props

这导致了错误: 我在上面提到的匿名箭头函数中放置了一个
console.log()

我在iOS模拟器上收到的错误如下: `console.error:“向开发环境发送日志消息时出现问题”

请参见下面的我的代码:

import {createDrawerNavigator, DrawerNavigatorItems} from "react-navigation-drawer";
import ProfileNavigator from "../Profile/Profile";
import Colors from "../../constants/colors";
import {AsyncStorage, Button, SafeAreaView, View} from "react-native";
import React from "react";
import {Logout} from "../Common";
import HomeNavigator from "../Home/Home";

const AppDrawerNavigator = createDrawerNavigator(
    {
        Profile: ProfileNavigator
    },
    {
        contentOptions: {
            activeTintColor: Colors.primary
        },
        contentComponent: props => {
            console.log(props) // THIS IS THE ISSUE CAUSING THE ERROR!!!!!!
            return (
                <View style={{ flex: 1, paddingTop: 20 }}>
                    <SafeAreaView forceInset={{ top: 'always', horizontal: 'never' }}>
                        <DrawerNavigatorItems {...props} />
                        <Button
                            title="Logout"
                            color={Colors.primary}
                            onPress={Logout}
                        />
                    </SafeAreaView>
                </View>
            )
        },
        drawerType: 'slide',
        unmountInactiveRoutes: true
    }
)

export default AppDrawerNavigator
从“反应导航抽屉”导入{createDrawerNavigator,DrawerNavigationItems};
从“./Profile/Profile”导入ProfileNavigator;
从“../../constants/Colors”导入颜色;
从“react native”导入{AsyncStorage,Button,SafeAreaView,View};
从“React”导入React;
从“./Common”导入{Logout};
从“./Home/Home”导入HomeNavigator;
const AppDrawerNavigator=createDrawerNavigator(
{
Profile:ProfileNavigator
},
{
内容选项:{
activeTintColor:Colors.primary
},
contentComponent:props=>{
console.log(props)//这是导致错误的问题!!!!!!
返回(
)
},
抽屉类型:“幻灯片”,
UnmountNativeRoutes:true
}
)
导出默认AppDroperNavigator

我在将提取调用的结果转储到控制台(如:
console.log(result)

我曾经用过:

console.log(JSON.stringify(result))