/code/server/Chat.js:34
let stringToWrite = JSON.stringify(game, null, 2);
^
TypeError: Converting circular structure to JSON
at JSON.stringify (<anonymous>)
at /code/server/Chat.js:34:46
at FSReqWrap.oncomplete (fs.js:135:15)
[nodemon] app crashed - waiting for file changes before starting...
此功能在工作区A和生产服务器中正常运行。但是我在工作区B中遇到此错误。两个工作区都是macbook,服务器是linux。我不知道在一台计算机上这可能是圆形结构,而在另一台计算机上却没有任何想法吗?
此方法的功能是将“游戏状态”转换为可以保存为2000行.log文件的日志。目的是用于将来的生产调试。
这是日志的样子。我删除了与游戏相关的所有元素,因为我敢肯定那里没有圆形结构。 https://pastebin.com/dF8PsZKS
已测试: