运行sequelize-test项目,创建用户或者博客,不管是本地代码和老师的示范代码,都报错
来源:12-5 -使用sequelize新增数据
qq_简爱_20
2023-04-03
写回答
1回答
-
qq_简爱_20
提问者
2023-04-03
下面是全部的报错代码,在MySQL数据库里也查询不到新建的用户或者博客。
PS E:\学习node\teacher-program\nodejs-myblog\code-demo\sequelize-test> node src/create.js Executing (default): INSERT INTO `blogs` (`id`,`title`,`content`,`author`,`createdAt`,`updatedAt`) VALUES (DEFAULT,?,?,?,?,?); node:internal/process/promises:279 triggerUncaughtException(err, true /* fromPromise */); ^ Error at Query.run (E:\学习node\teacher-program\nodejs-myblog\code-demo\sequelize-test\node_modules\sequelize\lib\dialects\mysql\query.js:52:25) at E:\学习node\teacher-program\nodejs-myblog\code-demo\sequelize-test\node_modules\sequelize\lib\sequelize.js:315:28 at processTicksAndRejections (node:internal/process/task_queues:96:5) at async MySQLQueryInterface.insert (E:\学习node\teacher-program\nodejs-myblog\code-demo\sequelize-test\node_modules\sequelize\lib\dialects\abstract\query-interface.js:308:21) at async model.save (E:\学习node\teacher-program\nodejs-myblog\code-demo\sequelize-test\node_modules\sequelize\lib\model.js:2490:35) at async Function.create (E:\学习node\teacher-program\nodejs-myblog\code-demo\sequelize-test\node_modules\sequelize\lib\model.js:1362:12) at async E:\学习node\teacher-program\nodejs-myblog\code-demo\sequelize-test\src\create.js:14:19 { name: 'SequelizeDatabaseError', parent: Error: Incorrect string value: '\xE5\x8D\x9A\xE5\xAE\xA2...' for column 'title' at row 1 at Packet.asError (E:\学习node\teacher-program\nodejs-myblog\code-demo\sequelize-test\node_modules\mysql2\lib\packets\packet.js:728:17) at Execute.execute (E:\学习node\teacher-program\nodejs-myblog\code-demo\sequelize-test\node_modules\mysql2\lib\commands\command.js:29:26) at Connection.handlePacket (E:\学习node\teacher-program\nodejs-myblog\code-demo\sequelize-test\node_modules\mysql2\lib\connection.js:456:32) at PacketParser.onPacket (E:\学习node\teacher-program\nodejs-myblog\code-demo\sequelize-test\node_modules\mysql2\lib\connection.js:85:12) at PacketParser.executeStart (E:\学习node\teacher-program\nodejs-myblog\code-demo\sequelize-test\node_modules\mysql2\lib\packet_parser.js:75:16) at Socket.<anonymous> (E:\学习node\teacher-program\nodejs-myblog\code-demo\sequelize-test\node_modules\mysql2\lib\connection.js:92:25) at Socket.emit (node:events:526:28) at addChunk (node:internal/streams/readable:315:12) at readableAddChunk (node:internal/streams/readable:289:9) at Socket.Readable.push (node:internal/streams/readable:228:10) { code: 'ER_TRUNCATED_WRONG_VALUE_FOR_FIELD', errno: 1366, sqlState: 'HY000', sqlMessage: "Incorrect string value: '\\xE5\\x8D\\x9A\\xE5\\xAE\\xA2...' for column 'title' at row 1", sql: 'INSERT INTO `blogs` (`id`,`title`,`content`,`author`,`createdAt`,`updatedAt`) VALUES (DEFAULT,?,?,?,?,?);', parameters: [ '博客标题1', '博客内容1', 'zhangsan', '2023-04-03 08:22:23', '2023-04-03 08:22:23' ] }, original: Error: Incorrect string value: '\xE5\x8D\x9A\xE5\xAE\xA2...' for column 'title' at row 1 at Packet.asError (E:\学习node\teacher-program\nodejs-myblog\code-demo\sequelize-test\node_modules\mysql2\lib\packets\packet.js:728:17) at Execute.execute (E:\学习node\teacher-program\nodejs-myblog\code-demo\sequelize-test\node_modules\mysql2\lib\commands\command.js:29:26) at Connection.handlePacket (E:\学习node\teacher-program\nodejs-myblog\code-demo\sequelize-test\node_modules\mysql2\lib\connection.js:456:32) at PacketParser.onPacket (E:\学习node\teacher-program\nodejs-myblog\code-demo\sequelize-test\node_modules\mysql2\lib\connection.js:85:12) at PacketParser.executeStart (E:\学习node\teacher-program\nodejs-myblog\code-demo\sequelize-test\node_modules\mysql2\lib\packet_parser.js:75:16) at Socket.<anonymous> (E:\学习node\teacher-program\nodejs-myblog\code-demo\sequelize-test\node_modules\mysql2\lib\connection.js:92:25) at Socket.emit (node:events:526:28) at addChunk (node:internal/streams/readable:315:12) at readableAddChunk (node:internal/streams/readable:289:9) at Socket.Readable.push (node:internal/streams/readable:228:10) { code: 'ER_TRUNCATED_WRONG_VALUE_FOR_FIELD', errno: 1366, sqlState: 'HY000', sqlMessage: "Incorrect string value: '\\xE5\\x8D\\x9A\\xE5\\xAE\\xA2...' for column 'title' at row 1", sql: 'INSERT INTO `blogs` (`id`,`title`,`content`,`author`,`createdAt`,`updatedAt`) VALUES (DEFAULT,?,?,?,?,?);', parameters: [ '博客标题1', '博客内容1', 'zhangsan', '2023-04-03 08:22:23', '2023-04-03 08:22:23' ] }, sql: 'INSERT INTO `blogs` (`id`,`title`,`content`,`author`,`createdAt`,`updatedAt`) VALUES (DEFAULT,?,?,?,?,?);', parameters: [ '博客标题1', ,?,?,?,?);', parameters: [ '博客标题1', '博客内容1', 'zhangsan', '2023-04-03 08:22:23', '2023-04-03 08:22:23' ] }, sql: 'INSERT INTO `blogs` (`id`,`title`,`content`,`author`,`createdAt`,`updatedAt`) VALUES (DEFAULT,?,?,?,?,?);', parameters: [ '博客标题1', '博客内容1', 'zhangsan', '2023-04-03 08:22:23', '2023-04-03 08:22:23' ] }
032023-04-04
相似问题