18

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 minimatch@2.0.10: Please update to minimatch 3.0.2 or higher to avoid a RegExp DoS issue
npm WARN deprecated minimatch@0.2.14: Please update to minimatch 3.0.2 or higher to avoid a RegExp DoS issue
npm WARN deprecated graceful-fs@1.2.3: 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
└── sequelize-cli@2.8.0 

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 minimatch@2.0.10: Please update to minimatch 3.0.2 or higher to avoid a RegExp DoS issue
npm WARN deprecated minimatch@0.2.14: Please update to minimatch 3.0.2 or higher to avoid a RegExp DoS issue
npm WARN deprecated graceful-fs@1.2.3: 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
└── sequelize-cli@2.8.0 

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 ?

code-8
  • 54,650
  • 106
  • 352
  • 604

8 Answers8

53

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

AbhinavD
  • 6,892
  • 5
  • 30
  • 40
11

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

npm install sequelize

Victor Karangwa
  • 1,679
  • 20
  • 16
3

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.

Jayant
  • 280
  • 2
  • 6
2

You will need to install sequelize globally.

npm install -g sequelize

vendeeshwaran Chandran
  • 1,383
  • 1
  • 13
  • 13
1

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

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.

Dharman
  • 30,962
  • 25
  • 85
  • 135
Nico_dev
  • 51
  • 4
0

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

MD SHAYON
  • 7,001
  • 45
  • 38
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

Minato
  • 21
  • 2