Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

init error when reading from sequelrc file if folder does not exist. #534

Closed
johnslay opened this issue Sep 8, 2017 · 2 comments
Closed

Comments

@johnslay
Copy link

johnslay commented Sep 8, 2017

I get this error whenever I try to run the following command without the existing src/ folder:
./node_modules/.bin/sequelize init
.sequelizerc

const path = require('path');

module.exports = {
  "config": path.resolve('./src/config', 'config.json'),
  "models-path": path.resolve('./src/models'),
  "seeders-path": path.resolve('./src/seeders'),
  "migrations-path": path.resolve('./src/migrations')
};

error:

Sequelize [Node: 8.4.0, CLI: 2.8.0, ORM: 4.8.0]

Successfully created migrations folder at "/home/john/Desktop/Projects/myProject/src/migrations".
Successfully created seeders folder at "/home/john/Desktop/Projects/myProject/src/seeders".
Successfully created models folder at "/home/john/Desktop/Projects/myProjectr/src/models".
    at Object.fs.mkdirSync (fs.js:891:18)
    at Object.writeDefaultConfig (/home/john/Desktop/Projects/myProjectr/node_modules/sequelize-cli/lib/helpers/config-helper.js:97:10)
    at Object.task (/home/john/Desktop/Projects/myProject/node_modules/sequelize-cli/lib/tasks/init.js:68:24)
    at /home/john/Desktop/Projects/myProject/node_modules/sequelize-cli/lib/helpers/gulp-helper.js:17:23
    at tryCatcher (/home/john/Desktop/Projects/myProject/node_modules/bluebird/js/release/util.js:16:23)
    at Promise._settlePromiseFromHandler (/home/john/Desktop/Projects/myProject/node_modules/bluebird/js/release/promise.js:512:31)
    at Promise._settlePromise (/home/john/Desktop/Projects/myProject/node_modules/bluebird/js/release/promise.js:569:18)
    at Promise._settlePromise0 (/home/john/Desktop/Projects/myProject/node_modules/bluebird/js/release/promise.js:614:10)
    at Promise._settlePromises (/home/john/Desktop/Projects/myProject/node_modules/bluebird/js/release/promise.js:693:18)
    at Async._drainQueue (/home/john/Desktop/Projects/myProject/node_modules/bluebird/js/release/async.js:133:16)
    at Async._drainQueues (/home/john/Desktop/Projects/myProject/node_modules/bluebird/js/release/async.js:143:10)
    at Immediate.Async.drainQueues (/home/john/Desktop/Projects/myProject/node_modules/bluebird/js/release/async.js:17:14)
    at runCallback (timers.js:781:20)
    at tryOnImmediate (timers.js:743:5)
    at processImmediate [as _immediateCallback] (timers.js:714:5)

It sucessfully creates the other files, just not the config folder and the config.json file
However, if I create the src folder before hand and then run the command, it'll work just fine and it actually creates the config folder as well as config.json file.

Not sure if this a documented bug or if I'm doing something wrong. Thanks

Ubuntu 16.04
Node 8.4
NPM 5.4.1
Sequelize 4.8

@AkashSouravNayak
Copy link

AkashSouravNayak commented Sep 9, 2017

use the below code

`const path = require('path');

module.exports = {
"config": path.resolve(__dirname,'./src/config/config.json'),
"models-path": path.resolve(__dirname,'./src/models'),
"seeders-path": path.resolve(__dirname,'./src/seeders'),
"migrations-path": path.resolve(__dirname,'./src/migrations')
};`

@sushantdhiman
Copy link
Contributor

Fixed by #539

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants