在我的文件app/controllers/activities.coffee
中,我正在尝试加载我的配置文件:
cfg = require '../config/config'
但我一直收到这个错误:
Error: Cannot find module '../config/config'
以下是该文件的外观(/config/config.coffee
):
path = require 'path'
rootPath = path.normalize __dirname + '/..'
env = process.env.NODE_ENV || 'development'
config =
development:
root: rootPath
app:
name: 'app'
port: 3000
db: 'mongodb://localhost/app-development'
test:
root: rootPath
app:
name: 'app'
port: 3000
db: 'mongodb://localhost/app-test'
production:
root: rootPath
app:
name: 'app'
port: 3000
db: 'mongodb://localhost/app-production'
module.exports = config[env]
答案 0 :(得分:1)
如果你尝试怎么办?的 ../../配置/配置强>