'error:a hook ('orm') failed to load when lifting sails app using mongo DB

I get this error: a hook ('orm') failed to load when trying to lift a sails app using mongoDB. This my connections.js file:

module.exports.connections = {
  mongodb: {
    adapter   : 'sails-mongo',
    host      : 'localhost',
    port      : 27017,
    database  : 'mydb1'
  }
};

And this is my models.js file:

module.exports.models = {
  connection: 'mongodb'
};

And this is my local.js file:

module.exports = {
  connections: {
    mongodb: {
      host      : 'localhost',
      port      : 27017,
      database  : 'mydb1'
    }
  }
}

Sails v 0.10.1

Any idea why this could be happening?

Thanks



Solution 1:[1]

Add

models: {
    connect: 'your_mongod_db_adapter_name'
}

in both env/development and env/production fixed the problem for me

Solution 2:[2]

For those if it didn't work in heroku after deploying, try to change the node js, sails, sails-mongo versions and check.

It worked for me after changing the versions to the below:

1.nodejs - 14.15.1

2.sails - ^1.5.2

3.sails-mongo - ^2.0.0

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Mars Zhu
Solution 2 adi