【发布时间】:2020-12-24 22:56:22
【问题描述】:
错误:
$ heroku run npm run migrate
Running npm run migrate on ⬢ shelly-moth-73910... up, run.3979 (Free)
> noteful-app-server@1.0.0 migrate /app
> postgrator --config postgrator-config.js
sh: 1: postgrator: not found
npm ERR! code ELIFECYCLE
npm ERR! syscall spawn
npm ERR! file sh
npm ERR! errno ENOENT
npm ERR! noteful-app-server@1.0.0 migrate: `postgrator --config postgrator-config.js`
npm ERR! spawn ENOENT
npm ERR!
npm ERR! Failed at the noteful-app-server@1.0.0 migrate script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR! /app/.npm/_logs/2020-09-06T07_52_36_217Z-debug.log
postgrator-cli 版本 4.0.0 安装在 repo 上,运行 npm list postgrator-cli 告诉我。但是在我推到 heroku 之后,好像 postgrator 不存在。 heroku run npm install postgrator-cli 和其他类似的命令不会改变,heroku run npm list postgrator-cli 返回:
$ heroku run npm list postgrator-cli
Running npm list postgrator-cli on ⬢ rocky-garden-73910... up, run.7024 (Free)
noteful-app-server@1.0.0 /app
`-- (empty)
这是我的postgrator-config.js
require('dotenv').config();
module.exports = {
'migrationsDirectory': 'migrations',
'driver': 'pg',
'connectionString':
process.env.NODE_ENV === 'test'
? process.env.TEST_DATABASE_URL
: process.env.DATABASE_URL,
'ssl': !!process.env.SSL,
};
Procfile 包含web: node src/server.js
【问题讨论】:
标签: database express heroku migration migrate