'-bash: sequelize: command not found
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?
Solution 1:[1]
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
Solution 2:[2]
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
Solution 3:[3]
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.
Solution 4:[4]
Had the same issue, then noted that sequelize-cli
is the way to go ahead.
npm install -g sequelize-cli
Solution 5:[5]
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.
Solution 6:[6]
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
Solution 7:[7]
I also got the message: zsh: command not found: sequelize and npx sequelize init instead of sequelize init solved the problem for me
Solution 8:[8]
Problem : Unknown command: "sequelize" Solve : npx sequelize init
Solution 9:[9]
The following steps worked on Pop!_OS 20.10 & ubuntu 20.04
npm install -g sequelize-cli
Solution 10:[10]
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.
Solution 11:[11]
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......
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow