【问题标题】:database migration - TypeError: Cannot read property 'slice' of undefined数据库迁移-TypeError:无法读取未定义的属性“切片”
【发布时间】:2020-02-09 13:10:19
【问题描述】:

尝试将数据库表迁移到 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"

我收到以下错误:


> fit-tracker@1.0.0 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


> fit-tracker@1.0.0 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! fit-tracker@1.0.0 migrate: `postgrator --config postgrator-config.js`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the fit-tracker@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!     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! fit-tracker@1.0.0 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 fit-tracker@1.0.0 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

任何帮助将不胜感激。

【问题讨论】:

  • 请显示您的代码 代码中似乎有错误

标签: node.js heroku npm database-migration


【解决方案1】:

我在各种项目中都看到过这个错误。我已经看到通过安装早期版本的postgrator-cli 软件包解决了这个问题。

我看到的另一个解决方案是使用yarn 而不是 npm。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2018-12-11
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2021-09-26
    • 2019-07-12
    • 2015-08-31
    相关资源
    最近更新 更多