缓冲区 - 类型错误:无法读取未定义的属性“来自”

dev*_*ris 5 buffer node.js node-mysql

我使用nodejs并做出反应。

我经常收到此错误,有时不出现此错误消息,有时也会出现。

错误

返回 SafeBuffer.Buffer.from(json, 'utf8').toString('base64'); 类型错误:无法读取未定义的属性“来自”

我不知道为什么会这样。但据我所知,但是当我重新启动或运行服务器时,它花费的时间太长。这会影响吗?因为我在 mysql 连接上经历了同样的事情。因此我得到一个旧的 connectTimeOut 像这样:

import mysql from 'mysql';

var con = mysql.createConnection({
    host:'localhost',
    user:'root',
    password:'',
    database:'hammerst_hammer',
    multipleStatements: true,
    connectTimeout:30000
});

con.connect((err) =>{
    if(err) throw err;
    else console.log('MySql connected')
});

export default con; 
Run Code Online (Sandbox Code Playgroud)

请帮助我,我不知道哪个错误以及该怎么办