Cli: Problem accessing sequelize cli when installed globally

Created on 4 Mar 2015  路  8Comments  路  Source: sequelize/cli

So from a folder like this c:/Documents/Coding/Example
I have installed globally sequelize-cli with npm install -g sequelize-cli, which it did successfully
and i can run sequelize help:init command, no issue
I created another folder c:/Documents/Coding/Test
I try to run sequelize help, it doesn't work this time, I get the following error message:
'Unable to resolve sequelize package in c:/Documents/Coding/Test'

is this an environment variable issue? or something else?
I'm on Windows 7, using Node 0.10.36 CLI: 1.3.1
My Example folder has a few things in it, including, Sequelize installed locally
My Test folder is empty, a brand new project.
Any clues?

Most helpful comment

I had the same issue, after npm install -g sequelize-cli, I got:

Unable to resolve sequelize package in [path]

Running "npm install sequelize" as well fixed it for me.

All 8 comments

So we have two issues here: first of all the cli should not cry because of the missing sequelize package when calling help. Second you have to install sequelize in the directory where you want to use the cli in. Or globally:)

Just to be clear: do you mean that both sequelize and sequelize-cli should be installed globally for the cli to work?

at least with version 1.7.4 installing both sequelize and sequelize-cli globally will result in calls to sequelize failing with the reported error and unless the CWD allows for node_modules/sequelize to be found

I'm experiencing this exact issue. I have intstalled sequelize-clie globally with the command:

npm install  sequelize-cli -g

And no matter what folder I'm in I get the same resonse:

Unable to resolve sequelize package in [current directory name]

I also have gulp installed globally and CAN run sequelise-cli from local folder when I cd into my projects node_modules/sequelize-cli/bin folder. But I cannot do the same thing from where the global one is installed. E.g.:

cd C:\Program Files\nodejs\node_modules\sequelize-cli\bin
位 sequelize
Unable to resolve sequelize package in C:\Program Files\nodejs\node_modules\sequelize-cli\binsequelize

Any ideas?

I'm experiencing the same issue as above.
On a fresh install of nvm, node, npm with a global install of sequelize, I get the following:

Unable to resolve sequelize package in ...

From the local module dir of a project that imports sequelize, I get the CLI:

Sequelize [Node: 5.5.0, CLI: 2.3.1, ORM: 3.18.0]
nvm --version
0.30.1
node -v
v5.5.0
npm --version
3.3.12

I had the same issue, after npm install -g sequelize-cli, I got:

Unable to resolve sequelize package in [path]

Running "npm install sequelize" as well fixed it for me.

Dear All
i run this command and it's run very well
node_modules/.bin/sequelize sequelize

node_modules/.bin/sequelize [any_sequelize_command]

this command is run well

For anyone still having issues, when all of the above hasn't worked, here's what I did to resolve my pathing issue specifically when using macOS and zsh as my default terminal.

1) Follow here: http://ebube.me/blog/sequelize-error-command-not-found-zsh/

  • You'll notice the path needs to be set to export PATH=/usr/local/share/npm/bin:$PATH

2) run these commands in your command line:

npm config set prefix /usr/local

sudo npm install -g sequelize-cli (enter your computer's password when prompted)

test to see if sequelize was installed correctly

sequelize -v

Now if you were trying to originally trying to run sequelize init:models & sequelize init:config make sure to run this command in the correct directory you'd like to work in. Here is a successful command:

Screen Shot 2020-06-27 at 11 35 29 AM

Was this page helpful?
0 / 5 - 0 ratings