Unable to resolve sequelize package
Nobody has claimed this yet.
Assessment
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Newbie friendliness
- 48/100
- Issue type
- Bug
- Clarity
- Mostly clear
- Activity status
- Quiet
- Tech stack
- javascript
Research direction
Start with the migration:generate command and the package manifest, then compare the installed Sequelize package names with what sequelize-cli expects. Check database/sequelize.ts and models/item.model.ts to confirm the application uses Sequelize v7; done when the CLI resolves the package and generates a migration.
Written by the indexing model from the issue text.
Description
Hello. I am switching from Prisma to Sequelize v7 because Prisma does not support in-memory databases, which are useful in testing. I have defined Sequelize client and some models.
database/sequelize.ts:
import { Sequelize } from "@sequelize/core";
import { PostgresDialect } from "@sequelize/postgres";
import { Item, Listing, Terms, User } from "../models";
const sequelize = new Sequelize({
dialect: PostgresDialect,
database: "realestateexpress",
user: "postgres",
password: "root",
host: "localhost",
port: 5432,
ssl: true,
clientMinMessages: "notice",
models: [Item, Listing, Terms, User]
});
export default sequelize;
models/item.model.ts:
import { CreationOptional, DataTypes, InferAttributes, InferCreationAttributes, Model, NonAttribute } from "@sequelize/core";
import { Attribute, NotNull, Unique, Table, BelongsToMany } from "@sequelize/core/decorators-legacy";
import { Listing } from ".";
@Table({ timestamps: false })
class Item extends Model<InferAttributes<Item>, InferCreationAttributes<Item>> {
declare id: CreationOptional<number>;
@Attribute(DataTypes.STRING)
@Unique
@NotNull
declare name: string;
@BelongsToMany(() => Listing, { through: "ListingItem" })
declare listings?: NonAttribute<Listing[]>;
public toString(): string {
return this.name;
}
}
export default Item;
I entered npx seqeulize-cli migration:generate in terminal and pressed enter, but the sequelize package cannot be resolved.
PS D:\Documents\_Dokumenti\Projekti\_Master\Real Estate App\Node\secure\realestate> npx sequelize-cli migration:generate
Unable to resolve sequelize package in D:\Documents\_Dokumenti\Projekti\_Master\Real Estate App\Node\secure\realestate
Yet the packages are literally installed packages.json:
{
// ...
"dependencies": {
"@sequelize/core": "^7.0.0-alpha.42",
"@sequelize/postgres": "^7.0.0-alpha.48",
// ...
},
"devDependencies": {
"sequelize-cli": "^6.6.5",
// ...
}
}
- Dominant language
- JavaScript
- Stars
- 2.6k
- Forks
- 524
- PR merge metrics
- No merged PRs in 30d
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from sequelize/cli
-
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
-
Difficulty 3/5 1-2 days Newbie friendliness 68/100
-
Difficulty 3/5 1-2 days Newbie friendliness 55/100
-
Difficulty 3/5 1-2 days Newbie friendliness 45/100
-
Difficulty 5/5 Over a week Newbie friendliness 15/100
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
HarperFast/skills#96 ·
-
[Block] Latest Posts [Type] Bug
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
Automattic/studio#4908 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 74/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 86/100
sugarlabs/musicblocks#8847 ·