nodejs oracledb我执行代码

时间:2018-01-16 13:11:55

标签: node.js npm-install node-modules

我执行代码时遇到以下错误。 任何人都可以帮我吗?

//error from cmd
D:\E142\NodeWorkspace\Database>node oracledbSample.js
D:\E142\NodeWorkspace\Database\node_modules\oracledb\lib\oracledb.js:38 throw err;
Error: \\?\D:\E142\NodeWorkspace\Database\node_modules\oracledb\build\Release\oracledb.node is not a valid Win32 application.
\\?\D:\E142\NodeWorkspace\Database\node_modules\oracledb\build\Release\oracledb.node
    at Object.Module._extensions..node (module.js:689:18)
    at Module.load (module.js:573:32)  at tryModuleLoad (module.js:513:12)
    at Function.Module._load (module.js:505:3)`enter code here` at   Module.require (module.js:604:17)  at require (internal/module.js:11:18)
    at Object.<anonymous> (D:\E142\NodeWorkspace\Database\node_modules\oracledb\lib\oracledb.js:35:19)
    at Module._compile (module.js:660:30)
    at Object.Module._extensions..js (module.js:671:10)
    at Module.load (module.js:573:32)

1 个答案:

答案 0 :(得分:0)

通常,如果您有32位和64位二进制文​​件,或者您没有安装Oracle客户端库,或者您使用的是Oracle Instant Client且没有正确的VS,则会发生此错误Redistributable已安装。

确保Node.js和Oracle Instant Client都是32位或64位。查看Instant Client下载页面,查看版本和版本。链接到VS Redistributable所需。

我相信您正在使用node-oracledb v1。尝试更新到v2,因为启动错误消息将提供更多信息。