error: Cannot read property of undefined

I'm trying to configure my app using Express like the following way, but I'm getting errors on doing that:

server.js

var express = require('express');
var env = process.env.NODE_ENV = process.env.NODE_ENV || 'devleopment';
var app = express();
var config = require('./server/config/config')[env];
require('./server/config/express')(app, config);
app.listen(config.port);
console.log('Listening on port ' + config.port + '...');

config.js

var path = require('path');
var rootPath = path.normalize(__dirname + '/../../');

module.exports = {
  development: {
    db: 'localhost',
    rootPath: rootPath,
    port: process.env.PORT || 3003
  },
  production: {
    rootPath: rootPath,
    db: 'localhost',
    port: process.env.PORT || 80
  }
}

But, noding it on console, I get this error message:

    app.set('views', config.rootPath + '/server/views');
                           ^
TypeError: Cannot read property 'rootPath' of undefined
    at module.exports (.\server\config\expr
ess.js:13:28)
    at Object.<anonymous> (.\server.js:9:35
)
    at Module._compile (module.js:456:26)
    at Object.Module._extensions..js (module.js:474:10)
    at Module.load (module.js:356:32)
    at Function.Module._load (module.js:312:12)
    at Function.Module.runMain (module.js:497:10)
    at startup (node.js:119:16)
    at node.js:906:3
23 Jul 10:38:13 - [nodemon] app crashed - waiting for file changes before starti
ng...

I think that it's comming from the initialization of rootPath. But, I wasn't able to find what's wrong. How to fix this, please?

Assuming you aren't setting process.env.NODE_ENV and it's using the default value, then your problem here is a simple spelling mistake

process.env.NODE_ENV || 'devleopment';

should be

process.env.NODE_ENV || 'development';

Your config file doesn't export an object devleopment hence why it returns undefined.