Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
1.0k views
in Technique[技术] by (71.8m points)

sails.js - the hook orm taking too long to load

i am using two database adapters with sails.

one for mondoDB and second for mysql.whenever i run command "sails lift".once it gives an error

error: Error: The hook `orm` is taking too long to load.
Make sure it is triggering its `initialize()` callback, or else set       `sails.config.orm._hookTimeout to a higher value (currently 20000)
at tooLong [as _onTimeout]   (C:UsersKAMIAppDataRoaming
pm
ode_modulessailslibappprivateloadHooks.js:92:21)
at Timer.listOnTimeout [as ontimeout] (timers.js:110:15

when i rerun sails without changes it gives no error then.how can i avoid this error everytime.this is my 1st experience with sailsjs so any help will be apreciated....

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

I ran into this problem last night because of a slow internet connection between my laptop and the DB server. My solution was to create a new file in the config directory called orm.js (name doesn't really matter).

Then add the following code:

// config/orm.js
module.exports.orm = {
  _hookTimeout: 60000 // I used 60 seconds as my new timeout
};

I also found I had to change my pubsub timeout but that may not be necessary for you.

// config/pubsub.js
module.exports.pubsub = {
  _hookTimeout: 60000 // I used 60 seconds as my new timeout
};

Note: The other answer recommends changing the sails files inside the node_modules folder. This is almost always a bad idea because any npm update could revert your changes.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...