gpt4 book ai didi

node.js - 错误 : TypeError: sequelize. 导入不是函数

转载 作者:行者123 更新时间:2023-12-03 22:32:31 25 4
gpt4 key购买 nike

我有这个代码的问题

const { Sequelize } = require('sequelize')
const path = require('path');

const sequelize = new Sequelize({
host: 'localhost',
dialect: 'sqlite',
storage: path.resolve("Storage", "database.sqlite"),
logging: false
});

const Guild = sequelize.import("Guild");

module.exports = {
Guild
};
问题是:“const Guild = sequelize.import("Guild");”
我有这个错误:TypeError: sequelize.import is not a function
(我把我的 index.js 的一小部分)
client.commands = new Discord.Collection
client.aliases = new Discord.Collection
client.cooldowns = new Discord.Collection

client.database = require(require("path").resolve("Database"))
client.database.Guild.sync({force: false})

最佳答案

documentation 说你需要使用 require 而不是 import。
enter image description here

关于node.js - 错误 : TypeError: sequelize. 导入不是函数,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/65530782/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com