我在节点js npm包node-adodb中遇到问题-(node:13328)UnhandledPromiseRejectionWarning:错误:生成C:\ Windows \ SysWOW64 \ cscript.exe错误

时间:2019-04-29 05:30:45

标签: node.js npm

我有一个使用node-adodb包读取访问文件的代码,但是我有这样的错误。下面是我的代码。我尝试使用一些简单的选择查询从访问文件中读取数据。

(node:13328) UnhandledPromiseRejectionWarning: Error: Spawn C:\Windows\SysWOW64\cscript.exe error
    at ChildProcess.child.on.exitCode (C:\projects\partdcScaffold\node_modules\node-adodb\lib\spawn.js:120:37)
    at ChildProcess.emit (events.js:197:13)
    at maybeClose (internal/child_process.js:978:16)
    at Process.ChildProcess._handle.onexit (internal/child_process.js:265:5)




async function f() {

  let file = await fs.appendFile(inputFileName, data, async function (err) {
    if (err)
    {
      console.log(err);
    }else {
      console.log('Saved!');
      let extracted = await unrar(inputFileName, './output');
      console.log("created!");
      await updateInvesmentsInfo();
    }
  });
}

f();

async function updateInvesmentsInfo() {
  fs.copyFile('./output/mutualfunds.accdb', './output/node-adodb.mdb', (err) => {
    if (err) throw err;
    console.log('mutualfunds.accdb was copied to node-adodb.mdb');
  });
  const connection = ADODB.open('Provider=Microsoft.ACE.OLEDB.12.0;Data Source=./output/Database.accdb;');
  await initializer.initMongo();
  let data = await connection.query('select some table');
  console.log(JSON.stringify(data, null, 2));
}

0 个答案:

没有答案