This makes troubleshooting rather difficult. Consider this code:

```js
app.use(loopback.timeout);
```

Program crashes because the middleware function is undefined. The developer has no idea what's wrong and how to fix the problem.

A better solution is to create a dummy function that throws a helpful error.

```js
for (var m in middlewareModules) {
  var moduleName = middlewareModules[m];
  middlewares[m] = safeRequire(moduleName) || createMiddlewareNotInstalled(m, moduleName);
}

function createMiddlewareNotInstalled(memberName, moduleName) {
  return function() {
    throw new Error('The middleware loopback.' + memberName + ' is not installed.\n' + 
      'Please run `npm install ' + moduleName + '` to fix the problem.');
  }
}