Почему я получаю сообщение об ошибке «синтаксическая ошибка на уровне * или около него» при запуске?|Heroku pg: psql " - PullRequest
0 голосов
/ 04 декабря 2018

Я пытаюсь развернуть приложение узла с базой данных Postgres в Heroku, когда я добираюсь до шага, на котором мне нужно выполнить эту команду type <file_name> | heroku pg:psql или type db.js | heroku pg:psql HEROKU_POSTGRESQL_CYAN, если быть точным, я получаю этоошибка: syntax error at or near *.db.js - это мой файл миграции, и я запустил компакт-диск, в котором находится этот файл, до запуска команды.Я написал код es6 в папке SERVER и скомпилировал его в es5 в папку сборки.Ниже приведены ошибки, которые я получаю.

Сообщение об ошибке после запуска:

type db.js | heroku pg:psql HEROKU_POSTGRESQL_CYAN
--> Connecting to postgresql-asymmetrical-70043
ERROR:  syntax error at or near "const"
LINE 4: const _pg = require('pg');
        ^
ERROR:  syntax error at or near "const"
LINE 1: const _dotenv = require('dotenv');
        ^
ERROR:  syntax error at or near "//"
LINE 1: // eslint-disable-next-line no-use-before-define
        ^
ERROR:  syntax error at or near "function"
LINE 1: function _interopRequireDefault(obj) { return obj && obj.__e...
        ^
ERROR:  syntax error at or near "}"
LINE 1: }
        ^
ERROR:  syntax error at or near "const"
LINE 1: const pool = new _pg.Pool({
        ^
ERROR:  syntax error at or near "pool"
LINE 1: pool.on('connect', () => {
        ^
ERROR:  syntax error at or near "const"
LINE 2: const createOrderTable = function createOrderTable() {
        ^
ERROR:  syntax error at or near "pool"
LINE 1: pool.query(queryText).then((res) => {
        ^
ERROR:  syntax error at or near "}"
LINE 1: };
        ^
ERROR:  syntax error at or near "const"
LINE 2: const createUserTable = function createUserTable() {
        ^
ERROR:  syntax error at or near "pool"
LINE 1: pool.query(queryText).then((res) => {
        ^
ERROR:  syntax error at or near "}"
LINE 1: };
        ^
ERROR:  syntax error at or near "const"
LINE 2: const createMenuTable = function createMenuTable() {
        ^
ERROR:  syntax error at or near "pool"
LINE 1: pool.query(queryText).then((res) => {
        ^
ERROR:  syntax error at or near "}"
LINE 1: };
        ^
ERROR:  syntax error at or near "const"
LINE 2: const dropOrderTable = function dropOrderTable() {
        ^
ERROR:  syntax error at or near "pool"
LINE 1: pool.query(queryText).then((res) => {
        ^
ERROR:  syntax error at or near "}"
LINE 1: };
        ^
ERROR:  syntax error at or near "const"
LINE 2: const dropUserTable = function dropUserTable() {
        ^
ERROR:  syntax error at or near "pool"
LINE 1: pool.query(queryText).then((res) => {
        ^
ERROR:  syntax error at or near "}"
LINE 1: };
        ^
ERROR:  syntax error at or near "const"
LINE 2: const dropMenuTable = function dropMenuTable() {
        ^
ERROR:  syntax error at or near "pool"
LINE 1: pool.query(queryText).then((res) => {
        ^
ERROR:  syntax error at or near "}"
LINE 1: };
        ^
ERROR:  syntax error at or near "const"
LINE 2: const createAllTables = function createAllTables() {
        ^
ERROR:  syntax error at or near "createOrderTable"
LINE 1: createOrderTable();
        ^
ERROR:  syntax error at or near "createMenuTable"
LINE 1: createMenuTable();
        ^
ERROR:  syntax error at or near "}"
LINE 1: };
        ^
ERROR:  syntax error at or near "const"
LINE 2: const dropAllTables = function dropAllTables() {
        ^
ERROR:  syntax error at or near "dropOrderTable"
LINE 1: dropOrderTable();
        ^
ERROR:  syntax error at or near "dropMenuTable"
LINE 1: dropMenuTable();
        ^
ERROR:  syntax error at or near "}"
LINE 1: };
        ^
ERROR:  syntax error at or near "pool"
LINE 1: pool.on('remove', () => {
        ^
ERROR:  syntax error at or near "module"
LINE 1: module.exports = {
        ^
ERROR:  syntax error at or near "require"
LINE 1: require('make-runnable');
        ^

Хотя мое приложение было опубликовано через URL-адрес Heroku для приложения, строки таблицы Postgres дляАПИС пусты.

{
rows: [ ],
rowCount: 0
}
Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...