Comments (43)
Can you tell me what the result of the following commands are looking like?
mkdir tmp
cd tmp
npm install sequelize-cli sequelize mysql
node_modules/.bin/sequelize init
# please edit the config/config.json accordingly
node_modules/.bin/sequelize db:migrate
from cli.
@framled : That happened because sequelize-cli was using the wrong config.json, just make sure all paths in .sequelizerc point to the correct config file and sequelizer folders.
my .sequelizerc
const path = require('path');
module.exports = {
"config": path.resolve('./config', 'config.json'),
"models-path": path.resolve('./models'),
"seeders-path": path.resolve('./seeders'),
"migrations-path": path.resolve('./migrations')
};
from cli.
which version of umzug are you using? This issue should be fixed
from cli.
I just installed the cli earlier in the morning today. Going through the internal node_modules folder for this module, I notice that umzug
is showing as v1.2.2
. Checking the umzug repo, it seems this is the latest build published to npm.
Is there a command-line arg or flag to see stacktrace of an error while running the CLI?
from cli.
I created a tmp
folder, installed all 3 modules like you suggested. Also created a fresh database on MySQL with a dedicated user with password. Updated the config.json file under config/config.json
.
Instead of creating a new migration from scratch, i just copied the file from my other project folder. I then ran the command:
node_modules\.bin\sequelize db:migrate
Here's the output:
E:\tmp>node_modules\.bin\sequelize db:migrate
Sequelize [Node: 0.10.21, CLI: 1.0.0, ORM: 2.0.0-rc3]
Loaded configuration file 'config\config.json'.
EventEmitter#success|ok is deprecated, please use promise-style instead.
[15:31:49] Using sequelizefile E:\tmp\node_modules\sequelize-cli\lib\sequelizefile.js
EventEmitter#failure|fail|error is deprecated, please use promise-style instead.
[15:31:49] Starting 'db:migrate'...
Unable to connect to database: Error: Error: ER_ACCESS_DENIED_ERROR: Access denied for user ''@'localhost' (using password: NO)
E:\tmp>
Can't seem to wrap my head around this. Here's my config.json
file:
{
"development": {
"username": "test",
"password": "test123",
"database": "sequelizeclitest",
"host": "127.0.0.1",
"dialect": "mysql"
},
"test": {
"username": "test",
"password": "test123",
"database": "sequelizeclitest",
"host": "127.0.0.1",
"dialect": "mysql"
},
"production": {
"username": "test",
"password": "test123",
"database": "sequelizeclitest",
"host": "127.0.0.1",
"dialect": "mysql"
}
}
Here's the MySQL commandline output detailing the test database sequelizeclitest
and the user test
:
E:\tmp>mysql -u test -p <~ Username is 'test', as in the config.json file
Enter password: ******* <~ This is 'test123', exactly as it is in the config.json file
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 10928
Server version: 5.6.16-log MySQL Community Server (GPL)
Copyright (c) 2000, 2014, Oracle and/or its affiliates. All rights reserved.
Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
mysql> show databases;
+--------------------+
| Database |
+--------------------+
| information_schema |
| sequelizeclitest | <~ SHOW DATABASES lists the database as in the config.json file
+--------------------+
2 rows in set (0.00 sec)
mysql>
from cli.
Hmm it doesn't seem to use the password, right? I wonder if this problem is related to windows :-/
from cli.
I just tried repeating the same steps on my production server (Amazon EC2 instance with an RHEL AMI). That worked just fine. Here's the output:
[jaggz@xxxzzz temp]# node_modules/.bin/sequelize db:migrate
Sequelize [Node: 0.10.26, CLI: 1.0.0, ORM: 2.0.0-rc3]
Loaded configuration file 'config/config.json'.
Using environment 'development'.
[03:45:25] Using sequelizefile /home/git/temp/node_modules/sequelize-cli/lib/sequelizefile.js
[03:45:25] Starting 'db:migrate'...
EventEmitter#success|ok is deprecated, please use promise-style instead.
EventEmitter#failure|fail|error is deprecated, please use promise-style instead.
[03:45:25] Finished 'db:migrate' after 302 ms
[jaggz@xxxzzz temp]#
You might be right about this problem being related to Windows.
Updating the title of this issue to reflect my windows version. Just for future clarity's sake.
from cli.
Alright will give this a try on windows :)
from cli.
Thanks for the test on a Linux machine!
from cli.
Thanks for the test on a Linux machine!
Oh, don't mention it. It's the least I can do since I am not equipped to suggest a fix for this myself >.<
I really really appreciate the work you and the team are putting into developing and maintaining sequelize and its tools.Thank you so much for making the work of people like me easier!
from cli.
Hmm so this is interesting. I was just running the following stuff on my Win 8.1 machine which uses the github application and its shipped powershell extension (i think its actually just the normal powershell but with some additional paths). I'm running node 0.10.29, cli 1.0.0 and sequelize 2.0.0-rc3. Can you please run the following commands and let me know if you run into any issues?
mkdir tmp
cd tmp
npm install sequelize-cli sequelize mysql
.\node_modules\.bin\sequelize init
# now i changed the config/config.json accordingly
.\node_modules\.bin\sequelize model:create --name foo --attributes name:string
.\node_modules\.bin\sequelize db:migrate
all these commands ran without any issues for me and correctly created two new tables called foos and sequelizemeta.
from cli.
I have the same problem on OSX Yosemite and Mavericks.
sequelize db:migrate --coffee
Sequelize [Node: 0.10.32, CLI: 1.0.0, ORM: 2.0.0-rc3, pg: ^4.1.1]
Loaded configuration file 'config/config.json'.
Using environment 'development'.
[22:08:56] Using sequelizefile /usr/local/lib/node_modules/sequelize-cli/lib/sequelizefile.js
[22:08:56] Starting 'db:migrate'...
[22:08:56] 'db:migrate' errored after 155 ms Unable to resolve the storage: sequelize
But... ./node_modules/.bin/sequelize db:migrate --coffee
works.
from cli.
This surely is getting interesting now. So it works fine on Linux (RHEL tested) & Windows 8.1, but fails on Windows7 & OSX Yosemite.
The plot thickens...
from cli.
Just tried creating a model+migration from the CLI before running db:migrate
. This time, there's no error message.
E:\tmp>.\node_modules\.bin\sequelize model:create --name foo --attributes name:string
Sequelize [Node: 0.10.21, CLI: 1.0.0, ORM: 2.0.0-rc3]
Loaded configuration file 'config\config.json'.
[04:05:29] Using sequelizefile E:\tmp\node_modules\sequelize-cli\lib\sequelizefile.js
[04:05:29] Starting 'model:create'...
[04:05:29] Finished 'model:create' after 19 ms
E:\tmp>.\node_modules\.bin\sequelize db:migrate
Sequelize [Node: 0.10.21, CLI: 1.0.0, ORM: 2.0.0-rc3]
Loaded configuration file 'config\config.json'.
EventEmitter#success|ok is deprecated, please use promise-style instead.
[04:06:51] Using sequelizefile E:\tmp\node_modules\sequelize-cli\lib\sequelizefile.js
EventEmitter#failure|fail|error is deprecated, please use promise-style instead.
[04:06:51] Starting 'db:migrate'...
E:\tmp>
But there's no success message either. No tables were created.
However, the bright side is that this time it seems to have read the config.json authentication data like it always should, unlike what happened earlier with me and the copied migration file.
from cli.
@Pilaas you installed it globally right? Will give that setup a try
from cli.
btw. the fact that it states sequelizefile.js
is a bug which results from replacing the string gulp
with sequelize
from cli.
Sure:
npm ls -g sequelize-cli
/usr/local/lib
└── [email protected]
from cli.
the fact that it states
sequelizefile.js
is a bug which results from replacing the stringgulp
withsequelize
I see. That seems to be affecting regardless of the platform OS. I can see that happening on both my Win7 and Linux boxes and also on OSX Yosemite as @Pilaas
However, I have my doubts regarding the initial problem of the missing sequelize
storage being related to this gulpfile issue. Then again, I might be terribly wrong.
from cli.
no it is not related at all. just wanted to say that
from cli.
hey @jagged3dge @Pilaas: Can you give it another try with the just released v1.0.1?
from cli.
I just checked it out on my local (Win7) machine. I got the AccessDenied Error:
E:\tmp>.\node_modules\.bin\sequelize db:migrate
Sequelize [Node: 0.10.21, CLI: 1.0.1, ORM: 2.0.0-rc4]
Loaded configuration file 'config\config.json'.
EventEmitter#success|ok is deprecated, please use promise-style instead.
[03:11:22] Using sequelizefile E:\tmp\node_modules\sequelize-cli\lib\sequelizefile.js
EventEmitter#failure|fail|error is deprecated, please use promise-style instead.
[03:11:22] Starting 'db:migrate'...
Unable to connect to database: Error: SequelizeAccessDeniedError: ER_ACCESS_DENIED_ERROR: Access denied for user ''@'localhost' (using password: NO)
E:\tmp>
EDIT: Re-checked my config.json. It's still there in config/config.json
as the output above states.
Including a copy of it here:
E:\tmp>dir config
Volume in drive E is Fun
Volume Serial Number is 0862-4G90
Directory of E:\tmp\config
12/20/2014 03:27 PM <DIR> .
12/20/2014 03:27 PM <DIR> ..
12/21/2014 03:42 AM 472 config.json
1 File(s) 472 bytes
2 Dir(s) 24,163,102,720 bytes free
E:\tmp>type config\config.json
{
"development": {
"username": "test",
"password": "test123",
"database": "sequelizeclitest",
"host": "127.0.0.1",
"dialect": "mysql"
},
"test": {
"username": "test",
"password": "test123",
"database": "sequelizeclitest",
"host": "127.0.0.1",
"dialect": "mysql"
},
"production": {
"username": "test",
"password": "test123",
"database": "sequelizeclitest",
"host": "127.0.0.1",
"dialect": "mysql"
}
}
E:\tmp>
from cli.
Can you tell me again which package you installed locally and which globally?
from cli.
sequelize db:migrate --coffee --env test
Sequelize [Node: 0.10.32, CLI: 1.0.1, ORM: 2.0.0-rc4, pg: ^4.1.1]
Loaded configuration file 'config/config.json'.
Using environment 'test'.
[10:04:08] Using sequelizefile /usr/local/lib/node_modules/sequelize-cli/lib/sequelizefile.js
[10:04:08] Starting 'db:migrate'...
EventEmitter#success|ok is deprecated, please use promise-style instead.
EventEmitter#failure|fail|error is deprecated, please use promise-style instead.
[10:04:08] Finished 'db:migrate' after 144 ms
You have to add "coffee-script" to your package.json.
I have "coffee-script" installed and it is placed in "dependencies" and "devDependencies" as well.
from cli.
@Pilaas CLI is installed globally everything else locally right? So I have to add another local package resolution for coffee-script.
from cli.
Yes, my local stack:
"dependencies": {
"coffee-script": "^1.8.0",
"pg": "^4.1.1",
"sequelize": "2.0.0-rc4",
},
"devDependencies": {
"coffee-script": "^1.8.0"
}
And global sequelize-cli:
npm ls -g sequelize-cli
/usr/local/lib
└── [email protected]
from cli.
Can you tell me again which package you installed locally and which globally?
In my test case, I installed all 3 (sequelize
, sequelize-cli
& mysql
) locally. I did have sequelize-cli
installed as global before, but I uninstalled it with npm uninstall -g sequelize-cli
before I ran the test scenario following the steps you mentioned previously. I wanted to make sure there was no conflict between versions that way.
from cli.
@jagged3dge I'm pretty sure that we have 2 different problems here. Your's is somehow related to the CLI not finding your configuration file. And then there is the CLI not finding the coffee-script package
from cli.
@Pilaas Could you give #76 a try? You need to install js2coffee
from cli.
Oh wait I think I missed something
from cli.
@Pilaas alright. fixed the missing piece. Would be cool if you could give it a try
from cli.
npm install -g 'git://github.com/sequelize/cli.git#hotfix/js2coffee'
from cli.
@Pilaas should be fixed in 1.0.2
from cli.
Sorry mate for not responding.
I'll try 1.0.2 later today and give you feedback. I hope it'll work 👍
from cli.
me too :)
from cli.
I've updated global and local sequelize-cli to 1.0.2. I havent't installed js2coffee
.
Should I install it manually ?
Now I have following result:
sequelize db:migrate --coffee
Sequelize [Node: 0.10.32, CLI: 1.0.2, ORM: 2.0.0-rc4, pg: ^4.1.1]
Loaded configuration file 'config/config.json'.
Using environment 'development'.
Unable to find "js2coffee". Please add it to your project.
I'm asking because I wonder if this is what you've wanted.
Shouldn't 10.2 have js2coffee built in ?
from cli.
Everything that is needed to compile from the existing js to something else is now business of the consumer and therefore it is your job to install js2coffee. I think that makes sense.
PS: js2coffee was removed in 1.0.2 as dependency
from cli.
Ok, I've installed js2coffee after my last message and everything works fine.
Will you add info in sequelize-cli's readme.md about necessity of js2coffee installation ?
from cli.
Ah good point. yes will do that!
from cli.
@Pilaas: https://github.com/sequelize/cli/blob/master/README.md#coffeescript-support
from cli.
@jagged3dge: I just gave this thing another try. My steps:
mkdir tmp
cd .\tmp
npm install sequelize sequelize-cli mysql
.\node_modules\.bin\sequelize init
Note: This prints Sequelize [Node: 0.10.29, CLI: 1.0.2, ORM: 2.0.0-rc4]
Note 2: I created a user test
with the password test123
on my windows machine and also database sequelizeclitest
.
Note 3: I copied and pasted the config file from your previous comment into my config/config.json
so I'm using exactly the same file as you do.
.\node_modules\.bin\sequelize model:create --name User --attributes name:string
.\node_modules\.bin\sequelize db:migrate
The last command results in the following output:
Sequelize [Node: 0.10.29, CLI: 1.0.2, ORM: 2.0.0-rc4]
Loaded configuration file 'config\config.json'.
EventEmitter#success|ok is deprecated, please use promise-style instead.
Using environment 'development'.
EventEmitter#failure|fail|error is deprecated, please use promise-style instead.
[21:23:46] Using sequelizefile ~\Documents\GitHub\tmp\node_modules\sequelize-cli\lib\sequelizefile.js
[21:23:46] Starting 'db:migrate'...
[21:23:46] Finished 'db:migrate' after 563 ms
A quick glance into the db results in this:
I'm really not sure what is going but everything works perfectly fine for me. Though I'm using Windows 8.1. Can you please execute each of those steps again and show me the output of each step?
from cli.
I close this ticket for now. Feel free to re-open it if needed.
from cli.
@sdepold I stumbled upon the similar/same issue today:
Sequelize [Node: 0.12.3, CLI: 1.7.0, ORM: 3.1.1]
Loaded configuration file "config/db.json".
Using environment "development".
Using gulpfile /usr/local/lib/node_modules/sequelize-cli/lib/gulpfile.js
Starting 'db:migrate'...
'db:migrate' errored after 17 ms
at new module.exports.Sequelize (/Users/ays/Sites/gift_connect/web/node_modules/sequelize/lib/sequelize.js:183:13)
at getSequelizeInstance (/usr/local/lib/node_modules/sequelize-cli/lib/tasks/db.js:203:10)
at getMigrator (/usr/local/lib/node_modules/sequelize-cli/lib/tasks/db.js:208:21)
at Object.module.exports.db:migrate.task (/usr/local/lib/node_modules/sequelize-cli/lib/tasks/db.js:23:7)
at Gulp.gulp.task.aliases (/usr/local/lib/node_modules/sequelize-cli/lib/helpers/gulp-helper.js:14:14)
at module.exports (/usr/local/lib/node_modules/sequelize-cli/node_modules/gulp/node_modules/orchestrator/lib/runTask.js:34:7)
at Gulp.Orchestrator._runTask (/usr/local/lib/node_modules/sequelize-cli/node_modules/gulp/node_modules/orchestrator/index.js:273:3)
at Gulp.Orchestrator._runStep (/usr/local/lib/node_modules/sequelize-cli/node_modules/gulp/node_modules/orchestrator/index.js:214:10)
at Gulp.Orchestrator.start (/usr/local/lib/node_modules/sequelize-cli/node_modules/gulp/node_modules/orchestrator/index.js:134:8)
at /usr/local/lib/node_modules/sequelize-cli/node_modules/gulp/bin/gulp.js:129:20
at process._tickCallback (node.js:355:11)
at Function.Module.runMain (module.js:503:11)
at startup (node.js:129:16)
at node.js:814:3
My DB is postgres. My config is read fine and it works because I am moving our original, written by hand models, to the migration logic. Thanks for the help man! 😃
from cli.
Same issue over here
Sequelize [Node: 7.10.0, CLI: 2.7.0, ORM: 4.1.0]
{
Error: Access denied for user ''@'localhost' (using password: NO)
...
code: 'ER_ACCESS_DENIED_ERROR',
errno: 1045,
sqlState: '#28000'
}
from cli.
Related Issues (20)
- BulkInsert "relation does not exist" in migration script
- const model = require(path.join(__dirname, file)).default( ^ TypeError: require(...).default is not a function
- const model = require(path.join(__dirname, file)).default( ^ TypeError: require(...).default is not a function HOT 1
- Sequelize CLI Fails to Authenticate with Postgres DB Containing a ':' in Password HOT 4
- CLI is not taking default env like node latest versions have (20.8.0)
- SequelizeMeta structure incompatible with SingleStore/memsql HOT 2
- Problem running migrations with yarn
- When on typescript project, sequelize-cli still generates javascript files. HOT 3
- Running migrations, on Azure database HOT 1
- Seeders state in database with using url option
- Migration undo command didn't work correctly. HOT 1
- where condition in literal HOT 1
- nested dependency es5-ext has a security vulnerability (low) and needs update HOT 1
- Subsequent migrations fail after running db:migrate:schema:timestamps:add command
- Please install sqlite3 package manually
- Incompatibility Error with [email protected] and Node.js 21.7.3 HOT 2
- Error: Dialect needs to be explicitly supplied as of v4.0.0 HOT 2
- npx sequelize-cli db:migrate command don't read the environment variables with PM2 HOT 1
- ERROR: Error reading "config\config.js". Error: undefined. Migracion con sequelize-cli HOT 6
- Dialect options being ignored for mssql named instance
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from cli.