sails.js - SailsJs - problems with lifting (orm hook failed to load) -


i having problems running app under windows. normally, developing on macbook temporarly had switch. thing is, app working on windows without problems. here error message:

error: hook (orm) failed load! verbose: lowering sails... verbose: sent kill signal child process (8684)... verbose: shutting down http server... verbose: http server shut down successfully. error: typeerror: cannot read property 'config' of undefined @ validatemodeldef (c:\projects\elearning-builder\node_modules\sails\node_modules\sails-hook-orm\lib \validate-model-def.js:109:84) @ c:\projects\elearning-builder\node_modules\sails\node_modules\sails-hook-orm\lib\initialize.js:218 :36 @ arrayeach (c:\projects\elearning-builder\node_modules\sails\node_modules\lodash\index.js:1289:13) @ function. (c:\projects\elearning-builder\node_modules\sails\node_modules\lodash\index.j s:3345:13) @ array.async.auto._normalizemodeldefs (c:\projects\elearning-builder\node_modules\sails\node_module s\sails-hook-orm\lib\initialize.js:216:11) @ listener (c:\projects\elearning-builder\node_modules\sails\node_modules\sails-hook-orm\node_module s\async\lib\async.js:605:42) @ c:\projects\elearning-builder\node_modules\sails\node_modules\sails-hook-orm\node_modules\async\li b\async.js:544:17 @ _arrayeach (c:\projects\elearning-builder\node_modules\sails\node_modules\sails-hook-orm\node_modu les\async\lib\async.js:85:13) @ immediate.taskcomplete (c:\projects\elearning-builder\node_modules\sails\node_modules\sails-hook-o rm\node_modules\async\lib\async.js:543:13) @ processimmediate [as _immediatecallback] (timers.js:383:17) ps c:\projects\elearning-builder>

i tried check out, happening in \node_modules\sails\node_modules\sails-hook-orm\lib\validate-model-def.js:109:84 added simple console.log temporarly:

  console.log("error in line below", hook);   var normalizeddatastoreconfig = hook.datastores[normalizedmodeldef.connection[0]].config; 

and result see:

error in line below hook {   load: [function: wrapper],   defaults:    { globals: { adapters: true, models: true },      orm: { skipproductionwarnings: false, moduledefinitions: [object] },      models: { connection: 'localdiskdb' },      connections: { localdiskdb: [object] } },   configure: [function: wrapper],   loadmodules: [function: wrapper],   initialize: [function: wrapper],   config: { envs: [] },   middleware: {},   routes: { before: {}, after: {} },   reload: [function: wrapper],   teardown: [function: wrapper],   identity: 'orm',   configkey: 'orm',   models:    { /* models here, removed long /*},   adapters: {},   datastores: {} } 

so, normalizedmodeldef.connection[0] has value development. hook.datastores empty? why there no config property.

but thing is, have connections in config/connections.js

like here:

development: {         module    : 'sails-mysql',         host      : 'localhost',         port      : 3306,         user      : 'ebuilder',         password  : 'ebuilder',         database  : 'ebuilder'     },     production: {         /* details hidden ;) */     },     testing: {         /* details hidden ;) */     } 

any suggestions/tips highly appreciated.

you have connections defined, have default connection defined might specified in config/models.js? if example have:

    module.exports.models = {       connection: 'mysql',       ... 

then 'mysql' needs defined in connections.js


Comments

  1. Did you found the error?
    I have the same issue with an legacy application and I can not update it by business restrictions
    I must resolve the issue.
    Best regards
    erojasoviedo@gmail.com

    ReplyDelete

Post a Comment

Popular posts from this blog

php - Passing multiple values in a url using checkbox -

sql - Postgresql tables exists, but getting "relation does not exist" when querying -

java - nested exception is org.hibernate.exception.SQLGrammarException: could not extract ResultSet Hibernate+SpringMVC -