I just ran npm install --save sequelize pg pg-hstore in my project root directory and now I am unable to invoke sequelize init. I get the error: -bash: sequelize: command not found. What am I doing wrong?
-
3Possible duplicate of [How do I install the sequelize.js binary?](http://stackoverflow.com/questions/18168312/how-do-i-install-the-sequelize-js-binary) – dparoli Mar 29 '17 at 19:54
15 Answers
The reason is: sequelize is not installed globally on your cli. To get sequelize access to all your cli just do.
npm install -g sequelize-cli
The '-g' means global this will allow you to access sequelize command anywhere in your app directory.
After that you can do eg: sequelize model:generate --name User --attributes firstName:string,lastName:string,email:string,password:string

- 323
- 4
- 18

- 1,552
- 15
- 13
I prefer to avoid installing global npm packages. If you have sequelize
as a dependency in your package.json
, you can utilize sequelize-cli
via npx
.
$ npx sequelize-cli <command>
.
For example, you could do $ npx sequelize-cli migration:generate --name add-a-column
to create a migration file.

- 6,895
- 5
- 45
- 43
Had the same issue, then noted that sequelize-cli
is the way to go ahead.
npm install -g sequelize-cli

- 2,237
- 27
- 30
- 38

- 441
- 4
- 10
I would like to answer my own question. The global npm install path was wrong for my computer.
npm config get prefix
Then I ran to put the path where it should be. This problem gave me a lot of head aches. Hope it helps someone.
npm config set prefix /usr/local

- 1,897
- 2
- 17
- 31
I had this problem and solved it by running
nvm install node --reinstall-packages-from=node
and then reinstalling
npm install -g sequelize-cli
Before doing this I had an unfortunate Node Version Manager setup. My computer was running something like version 10, but installing sequelize in the path used by version 8.
Now everything is updated and works.

- 28,498
- 28
- 50
- 59

- 131
- 1
- 4
if you want to use sequelize-cli
without install it globally , you need to run it from node_modules
folder in your root project. that is node_modules/.bin/sequelize
. try to run node_modules/.bin/sequelize help
for more information about sequelize command line

- 121
- 5
The following steps worked on Pop!_OS 20.10 & ubuntu 20.04
npm install -g sequelize-cli

- 621
- 5
- 6
Problem : Unknown command: "sequelize" Solve : npx sequelize init

- 21
- 1
-
As it’s currently written, your answer is unclear. Please [edit] to add additional details that will help others understand how this addresses the question asked. You can find more information on how to write good answers [in the help center](/help/how-to-answer). – Community Apr 21 '22 at 16:01
first install npm install sequelize sequelize-cli After that run npx sequelize init instead of sequelize init That works for me

- 41
- 3
I also got the message: zsh: command not found: sequelize and npx sequelize init instead of sequelize init solved the problem for me

- 11
- 3
I had same problem. I cd to
<proj_dir>\node_modules\sequelize-automate\bin
from there I ran
node sequelize-automate -t js -h localhost -d <proj_dir> -u postgres -p ****** -P 5432 -e postgres -o root to \src\models
command. It worked like charm.

- 217,595
- 99
- 455
- 496

- 1
- 1
worked on windows os
open powershell as an admistrator after that run following commands:
Set-ExecutionPolicy RemoteSigned Get-ExecutionPolicy -List LSet-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope LocalMachine after step 3 press A for all
work for me......

- 728
- 1
- 5
- 12
if you're using Yarn
yarn global add sequelize-cli --prefix /usr/local
And run
sequelize init