Closed lsby closed 2 years ago
npm i oracledb oracledb: https://www.npmjs.com/package/oracledb
code:
import oracledb from 'oracledb' var oracledb2 = require('oracledb') console.log(oracledb.getConnection == oracledb2.getConnection) oracledb.getConnection({ user: 'xxx', password: 'xxx', connectString: 'xxx/xxx', }, (err, conn) => { console.log(err, conn) })
error:
$ node -r esm index.js true C:\Users\hby\Desktop\test\node_modules\oracledb\lib\oracledb.js:1 Error: Invalid argument at Proxy.getConnection (C:\Users\hby\Desktop\test\node_modules\oracledb\lib\oracledb.js:287:10) at Proxy.<anonymous> (C:\Users\hby\Desktop\test\node_modules\oracledb\lib\util.js:185:19) at Object.<anonymous> (C:\Users\hby\Desktop\test\index.js:6:10) at Generator.next (<anonymous>)
But if I write:
// import oracledb from 'oracledb' var oracledb2 = require('oracledb') // console.log(oracledb.getConnection == oracledb2.getConnection) oracledb2.getConnection({ user: 'xxx', password: 'xxx', connectString: 'xxx/xxx', }, (err, conn) => { console.log(err, conn) })
run:
$ node index.js
it work
I think it has something to do with esm
Preliminary operation
npm i oracledb oracledb: https://www.npmjs.com/package/oracledb
operating
code:
error:
But if I write:
run:
it work
I think it has something to do with esm