2017-08-29 27 views
0

返回undefined我使用sequelize的最新版本,我的server/config/config.json文件配置如下:use_env_variable在sequelize

{ 
    "development": { 
     "use_env_variable": "DATABASE_URL", 
     "dialect": "postgres" 
    }, 
    "test": { 
     "use_env_variable": "DATABASE_TEST_URL", 
     "dialect": "postgres" 
    }, 
    "production": { 
     "use_env_variable": "DATABASE_URL", 
     "dialect": "postgres" 
    } 
} 

我.ENV文件配置如下:

DATABASE_URL = "MY database URL Here" 

当我运行sequelize db:migrate我收到以下内容:

Error parsi ng url:undefined

回答

1

您没有定义变量$ DATABASE_URL。

在终端试试这个:

export DATABASE_URL=postgresql://[user[:password]@][netlocation][:port][/dbname]