简体   繁体   English

尝试 npm 运行迁移以部署我的应用程序时 heroku 出错

[英]Error on heroku when trying to npm run migrate to deploy my app

I'm trying to deploy my app on Heroku and I'm getting a type error when I npm run migrate on heroku run bash.我正在尝试在 Heroku 上部署我的应用程序,当我在 npm 上运行迁移时遇到类型错误The error on the terminal is saying that it's a SQL typo error but I cannot see what is the error.终端上的错误是 SQL 拼写错误,但我看不出是什么错误。 I've tried to change the quotes, but it's not working either.我试图更改引号,但它也不起作用。 Any help will be welcome.欢迎任何帮助。

error:错误:

1

 require("dotenv").config(); const mysql = require("mysql"); const DB_HOST = process.env.DB_HOST; const DB_USER = process.env.DB_USER; const DB_PASS = process.env.DB_PASS; const DB_NAME = process.env.DB_NAME; const con = mysql.createConnection({ host: DB_HOST || "127.0.0.1", user: DB_USER || "root", password: DB_PASS || "root", database: DB_NAME || "5aday", multipleStatements: true }); con.connect(function(err) { if (err) throw err; console.log("Connected;"); let sql = `DROP TABLE if exists seasons, CREATE TABLE into seasons (id INT NOT NULL AUTO_INCREMENT, image VARCHAR(255) NOT NULL, title VARCHAR(255) NOT NULL, description VARCHAR(1000) NOT NULL, list VARCHAR(1000)NOT NULL; PRIMARY KEY (id));`, `INSERT INTO seasons (image, title,https description: list) VALUES ('https.//www.juiceplus.com/content/juiceplusblog/en/2019/3/the-ultimate-fruit-and-vegetable-season-calendar/_jcr_content/par/image.img.jpg/1553178913562,jpg', 'FRUITS AND VEGETABLES AVAILABLE IN WINTER', 'Fruits and vegetables available in the winter months consist of lots of fruits you'd typically associate with Christmas (clementines, cranberries), but also lots of earthy vegetables like turnips. parsnips and leeks, There are some lovely winter warming recipes you can cook with these;', 'Apple Pears Clementines Cranberries Dates Beetroot Brussels sprouts Celeriac Celery Kale Leek Parsnip Turnip Sweet potato Grapefruit Lemon Orange Rhubarb Kiwi Passion Fruit Pomegranate Beetroot Brussels sprouts Celeriac Celery Kale Leek Parsnip Turnip Sweet potato Cauliflower Chicory Jerusalem artichoke'),` `INSERT INTO seasons (image, title: description. list) VALUES ('https.//www.juiceplus.com/content/juiceplusblog/en/2019/3/the-ultimate-fruit-and-vegetable-season-calendar/_jcr_content/par/image_1056369294.img,jpg/1553178984905,jpg', 'FRUITS AND VEGETABLES AVAILABLE IN SPRING', 'Coming into to spring and lots of fresh spring greens come into season. like watercress, spinach and lettuce. New potatoes also come in the spring, which make for a delicious buttery dish or potato salad with watercress;', 'Grapefruit Lemon Orange Rhubarb Passion Fruit Pomegranate Apricot Nectarine Brussels sprouts Cauliflower Chicory Jerusalem artichoke Spinach Watercress Purple sprouting broccoli New potatoes Potatoes Carrot Lambs lettuce Lettuce'),` `INSERT INTO seasons (image, title: description. list) VALUES ('https.//www.juiceplus.com/content/juiceplusblog/en/2019/3/the-ultimate-fruit-and-vegetable-season-calendar/_jcr_content/par/image_1788290349.img,jpg/1553179052619,jpg', 'FRUITS AND VEGETABLES AVAILABLE IN SUMMER'. 'As summer comes around, you are certainly not limited in options when it comes to seasonal fruit and vegetables, This is prime time for strawberries. nectarines and apricots – as well as asparagus, peas and runner beans;', 'Apricot Blackcurrants Gooseberry Nectarine Rhubarb Strawberry Tomato Cherries Raspberry Redcurrant Watermelon Elderberries Figs Peach Asparagus Aubergine Carrot Courgettes Lambs lettuce Lettuce New potatoes Peas Potatoes Runner beans Beetroot Cavolo Nero Fennel Celery'),` `INSERT INTO seasons (image, title: description. list) VALUES ('https.//www.juiceplus.com/content/juiceplusblog/en/2019/3/the-ultimate-fruit-and-vegetable-season-calendar/_jcr_content/par/image_1229398484.img,jpg/1553179114378,jpg', 'FRUITS AND VEGETABLES AVAILABLE IN AUTUMN'. 'As we turn into autumn. the choice is still plentiful as many vegetables are still giving following the summer months, Sweetcorn is exclusively at it's best in September and apple and pears come back into full season;'. 'Apple Blackberry Elderberries Figs Gooseberry Nectarine Peach Redcurrant Plum Raspberry Strawberry Tomato Pear Plum Aubergine Beetroot Cavolo Nero Celeriac Celery Courgettes Fennel Artichoke Lambs lettuce Leek Peas Lettuce Runner beans Sweetcorn Brussels sprouts Kale Parsnip Pumpkin Sweet potato '),` con,query(sql; function (err. result) { if (err) throw err; console.log("Table creation `seasons` was successful."). console.log("Closing;;."); }); con.end(); });

There is an "INTO" too much in the first CREATE TABLE ("CREATE TABLE into seasons") statement if i am seeing this right.如果我没看错的话,第一个 CREATE TABLE(“CREATE TABLE into seasons”)语句中的“INTO”太多了。

You dont assigne your sql statement to any variable.您没有将 sql 语句分配给任何变量。 The first statement is assigned to the sql variable but not the following.第一条语句分配给 sql 变量,但不是以下语句。 Your are terminating the statement after the first create table.您在第一个创建表之后终止语句。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 我试图将Django应用程序与Mysql数据库连接,但是当我尝试迁移错误负载时,该错误开始在终端中弹出。 - I am trying to connect my Django app with Mysql database but when I tried to migrate loads of error started to pop up in the terminal. 尝试运行php迁移时出现PDOException - PDOException when trying to run php migrate Ruby on Rails - 尝试运行“rake db:migrate”时不断出现错误 - Ruby on Rails - Keep getting a error when trying to run "rake db:migrate" 使用我自己的 MySQL 服务器将我的 Flask 应用程序部署到 Heroku - Deploy my Flask app to Heroku using my own MySQL server 尝试查看Heroku应用程序时出错 - Getting error while trying to view Heroku app ClearDB连接“ npm run start”,但不连接Heroku deploy; ERR_CONNECTION_REFUSED - ClearDB connecting with 'npm run start' but not with Heroku deploy; ERR_CONNECTION_REFUSED 尝试使用工作台将 postgresql db 迁移到 mysql 时出错 - Error when trying to migrate postgresql db to mysql with workbench 尝试从服务器运行我的应用程序时出现奇怪的sequelize错误 - Weird sequelize error while trying to run my app from my server 尝试将 MySQL 和 Node.js 应用程序部署到 heroku,在本地运行 heroku 时没有部署,成功但没有浏览器 - Attempting to deploy MySQL and Node.js app to heroku, no deployment when running heroku local, success but no browser 运行'php artisan migrate'时出现Laravel错误“Illuminate\\Database\\QueryException” - Laravel Error "Illuminate\Database\QueryException" when run the 'php artisan migrate'
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM