Unable to resolve sequelize package
Asked Answered
V

9

19

I'm trying to install sequelize-cli in my Mac OS 10.12.6.

In Terminal, I did

npm install -g sequelize-cli

I got

npm WARN deprecated [email protected]: Please update to minimatch 3.0.2 or higher to avoid a RegExp DoS issue
npm WARN deprecated [email protected]: Please update to minimatch 3.0.2 or higher to avoid a RegExp DoS issue
npm WARN deprecated [email protected]: graceful-fs v3.0.0 and before will fail on node releases >= v7.0. Please update to graceful-fs@^4.0.0 as soon as possible. Use 'npm ls graceful-fs' to find it in the tree.
/usr/local/bin/sequelize -> /usr/local/lib/node_modules/sequelize-cli/bin/sequelize
/usr/local/lib
└── [email protected] 

Then, I tried

sequelize model:create --name User --attributes name:string,complete:boolean

I got

Unable to resolve sequelize package in /Users/bheng/Sites/BASE

I even try with the --save as this post suggested.

npm install -g sequelize-cli --save

I got same result.

npm WARN deprecated [email protected]: Please update to minimatch 3.0.2 or higher to avoid a RegExp DoS issue
npm WARN deprecated [email protected]: Please update to minimatch 3.0.2 or higher to avoid a RegExp DoS issue
npm WARN deprecated [email protected]: graceful-fs v3.0.0 and before will fail on node releases >= v7.0. Please update to graceful-fs@^4.0.0 as soon as possible. Use 'npm ls graceful-fs' to find it in the tree.
/usr/local/bin/sequelize -> /usr/local/lib/node_modules/sequelize-cli/bin/sequelize
/usr/local/lib
└── [email protected] 

sequelize model:create --name User --attributes name:string,complete:boolean

Unable to resolve sequelize package in /Users/bheng/Sites/BASE

What else should I try ?

Vanish answered 30/8, 2017 at 23:54 Comment(1)
If someone faces the same issue make sure you install sequelize firstAinsley
A
55

In sequelize-cli package.json file, sequelize is mentioned as a devdependency which means it does not install it when you do npm install sequelize-cli. My guess is you have not installed sequelize itself and this is what the error says.

Unable to resolve sequelize package in /Users/bheng/Sites/BASE

install sequelize npm install --save sequelize (or global) and things should be good.

PS: Great answer on different dependencies and what they mean

Allegedly answered 31/8, 2017 at 0:49 Comment(0)
V
12

I had the same issue. I installed sequelize-cli forgetting to add sequelize itself:

npm install sequelize

Villatoro answered 17/8, 2020 at 9:21 Comment(0)
F
5

you can try this one

npm install --save-dev sequelize sequelize-cli

npx sequelize-cli init

Once you get models migrations folders, means sequelize is working.

Florella answered 28/11, 2021 at 13:57 Comment(0)
W
2

You will need to install sequelize globally.

npm install -g sequelize

Wamble answered 7/8, 2020 at 11:40 Comment(0)
C
1

First you have need to install sequelize package, after then execute cli command.

Contribute answered 19/2, 2021 at 13:0 Comment(2)
how is your answer different than the accepted one?Riffe
Because it is simple as it is.Contribute
S
1

Yes. This is "normal" the CLI will try to find the sequelize package in your current working directory and/or in the node paths. So you could either install the package in your local dir or in any parent directory or in the global space.

more answers

Scripture answered 15/2, 2022 at 11:29 Comment(0)
V
0

I had a similar case where when I was trying to run any sequelize command.

ie. sequelize init or sequelize --help

I would get the error:

Unable to resolve sequelize package in <my-project-directory>

None of the solutions above where helping my case but after farther digging I found this article talking about the importance of the order in which one installs dependencies.

I had installed my my development dependencies first (sequelize-cli before sequelize) and that's why it wasn't working.

Because this is a new project I just removed my yarn files and the package.json (left my other files untouched) and started over and this time I did:

  1. yarn init
  2. yarn add <my dependencies>
  3. yarn add --dev <my development dependencies>

This solved my issue.

Veterinary answered 25/11, 2021 at 20:15 Comment(0)
P
0

when downloading sequelize and sequlize-cli , you have to install both globally using -g option

npm install -g sequelize

npm install -g sequelize-cli

that's all

Pascal answered 19/4, 2023 at 1:14 Comment(0)
B
0

Before you create the first model you need to create new file .sequelizerc and get the below code:

// .sequelizerc

const path = require('path');

module.exports = {
  config: path.resolve('./src/config', 'config.json'),
  'models-path': path.resolve('./src', 'models'),
  'seeders-path': path.resolve('./src', 'seeders'),
  'migrations-path': path.resolve('./src', 'migrations'),
};

Then you might to run your cmd.

Bribery answered 5/8 at 8:51 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.