我试图在centos 7 OS上运行我的项目,我试图通过编写节点install_server.js来安装我的项目 并且终端返回错误
install_server.js:26
fs.readFile(`${__dirname}/config/config.sql`, (err, data) => {
^
SyntaxError: Unexpected token ILLEGAL
at Module._compile (module.js:439:25)
at Object.Module._extensions..js (module.js:474:10)
at Module.load (module.js:356:32)
at Function.Module._load (module.js:312:12)
at Function.Module.runMain (module.js:497:10)
at startup (node.js:119:16)
at node.js:906:3
此文件的源代码位于
下面const cfg = require('./config/config.json');
const knex = require('knex');
const fs = require('fs');
const mysql = require('mysql');
var db = knex({
client: 'mysql',
pool: {
min: 0,
max: 1
},
connection: {
host: cfg.database.db_server,
user: cfg.database.db_user,
password: cfg.database.db_password
}
});
var myCon = mysql.createConnection({
multipleStatements: true,
host: cfg.database.db_server,
user: cfg.database.db_user,
password: cfg.database.db_password
});
fs.readFile(`${__dirname}/config/config.sql`, (err, data) => {
if (err)
throw err;
myCon.query(data.toString(), function(err, results) {
if (err)
throw err;
console.log('complete')
});
});
似乎无法弄明白,我可以得到帮助吗?