试图将数据库表迁移到heroku,并得到以下错误。
heroku pg:credentials:url
我可以得到连接的URL。但当我尝试运行脚本
"env SSL=true DATABASE_URL=postgres://azgtqialharhur:647e8109bcabdeda90c00f6ca961e603f01529177d2ddefb4f1cf9bf47552653@ec2-54-243-44-102.compute-1.amazonaws.com:5432/df6c2t2q7bb1s4 npm run migrate"
我得到以下错误。
> [email protected] migrate:production C:\Users\User\Desktop\project\fit-tracker-database
> env SSL=true DATABASE_URL=postgres://azgtqialharhur:647e8109bcabdeda90c00f6ca961e603f01529177d2ddefb4f1cf9bf47552653@ec2-54-243-44-102.compute-1.amazonaws.com:5432/df6c2t2q7bb1s4 npm run migrate
> [email protected] migrate C:\Users\User\Desktop\project\fit-tracker-database
> postgrator --config postgrator-config.js
Password:
C:\Users\User\Desktop\project\fit-tracker-database\node_modules\postgrator-cli\postgrator-cli.js:187
rl.history = rl.history.slice(1);
^
TypeError: Cannot read property 'slice' of undefined
at rl.question (C:\Users\User\Desktop\project\fit-tracker-database\node_modules\postgrator-cli\postgrator-cli.js:187:33)
at Interface._onLine (readline.js:288:5)
at Interface._normalWrite (readline.js:433:12)
at Socket.ondata (readline.js:149:10)
at Socket.emit (events.js:189:13)
at addChunk (_stream_readable.js:284:12)
at readableAddChunk (_stream_readable.js:265:11)
at Socket.Readable.push (_stream_readable.js:220:10)
at Pipe.onStreamRead [as onread] (internal/stream_base_commons.js:94:17)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] migrate: `postgrator --config postgrator-config.js`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] 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! C:\Users\User\AppData\Roaming\npm-cache\_logs\2019-10-12T04_14_43_701Z-debug.log
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] migrate:production: `env SSL=true DATABASE_URL=postgres://azgtqialharhur:647e8109bcabdeda90c00f6ca961e603f01529177d2ddefb4f1cf9bf47552653@ec2-54-243-44-102.compute-1.amazonaws.com:5432/df6c2t2q7bb1s4 npm run migrate`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] migrate:production 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! C:\Users\User\AppData\Roaming\npm-cache\_logs\2019-10-12T04_14_43_752Z-debug.log
任何帮助将被感激。
我在不同的项目中看到过这个错误。我看到这个问题是通过安装早期版本的 postgrator-cli 包。
我看到的另一个解决方案是使用 纱线 而不是npm。