错误:NJS-045:无法加载 Node.js 18.14.0 (win32 x64) 的 node-oracledb 二进制文件

2024-01-06

我在用着 下一个:13.1.6 oracledb:5.5.0

我收到以下错误:

Server Error
Error: NJS-045: cannot load a node-oracledb binary for Node.js 18.14.0 (win32 x64) 
  Looked for 
    C:\path\to\my\project\MyProjectName\.next\server\app\accounts\build\Release\oracledb-5.5.0-win32-x64.node, 
C:\path\to\my\project\MyProjectName\.next\server\app\accounts\build\Release\oracledb.node, 
C:\path\to\my\project\MyProjectName\.next\server\app\accounts\build\Debug\oracledb.node, 
C:\path\to\my\project\MyProjectName\.next\server\app\accounts\editUsernamePassword\node_modules\oracledb\build\Release\oracledb-5.5.0-win32-x64.node, 
C:\path\to\my\project\MyProjectName\.next\server\app\accounts\editUsernamePassword\node_modules\oracledb\build\Release\oracledb.node

  Node-oracledb installation instructions: https://oracle.github.io/node-oracledb/INSTALL.html

我的代码如下所示: \src\app\accounts\editUsernamePassword\page.js

    \\first line of code
    import {oracleDB} from '@/library/database/oracle';
    

\src\library\database\oracle.js

const oracledb = require('oracledb');

//this is how to point to the Oracle Client without editing the PATH variable.
try {
  oracledb.initOracleClient({libDir: "C:\\pathToMyInstantClient\\oracle\\instantclient_21_9"});
} catch (err) {

  console.error('Unable to locate Oracle Instant Client.');
  console.error(err);
  process.exit(1);
} 
/// ... then, go on to use the oracledb object

第一个问题。从错误消息来看,它似乎无法找到 oracledb*.node 文件。那是对的吗?起初,我以为没有找到 Oracle Instant Client,但事实似乎并非如此。相反,问题是它找不到 oracledb*.node 文件。

其次,如果我的假设(1)是正确的,为什么它要寻找相对于应用程序/帐户页面的 oracledb*.node ? 我想我可以将文件复制到那里,但随后我需要将客户端复制到需要它的每个路径。

难道不应该在这里找吗:?我已确认 oracledb*.node 文件位于此处:

C:\path\to\my\project\MyProjectName\node_modules\oracledb\build\Release

让我更加困惑的是,这种导入并不总是失败。 我还有另一个文件: \src\library\oasis\abcHelper.js

    \\first line of code
    import {oracleDB} from '@/library/database/oracle';
    
    //then, it goes on to successfully use the oracle library

我不知道为什么 abcHelper.js 能够加载该库,但 page.js 在错误的位置查找该库?

我确实在 oracledb.js 中看到了这个评论,看起来他们正在讨论这个问题,但我不确定如何实现该解决方案:

  // For Webpack.  A Webpack copy plugin is still needed to copy 'node_modules/oracledb/build/' to the output directory
  // See https://github.com/oracle/node-oracledb/issues/1156

当我做 npm run dev,我收到此警告,但我不确定这是否是根本原因。

wait  - compiling /accounts/editUsernamePassword/page (client and server)...
warn  - ./node_modules/oracledb/lib/oracledb.js
Critical dependency: require function is used in a way in which dependencies cannot be statically extracted

Import trace for requested module:
./node_modules/oracledb/lib/oracledb.js
./node_modules/oracledb/index.js
./src/library/database/oracle.js
./src/app/accounts/editUsernamePassword/page.js

我当前的 next.config.js:

/** @type {import('next').NextConfig} */
const nextConfig = {
  experimental: {
    appDir: true,
  },
}

module.exports = nextConfig


更新:对于 Webpack 和 node-oracledb 6.0,请参阅使用 Webpack 捆绑 node-oracledb JavaScript 应用程序 https://medium.com/oracledevs/bundling-node-oracledb-javascript-apps-with-webpack-597c452f71f.

使用 Webpack 和 node-oracledb 5.5,您需要 webpack.config.js 中的复制插件来复制 node-oracledb 二进制文件:

    plugins: [
        new CopyPlugin([
            {
                // Copy the binary Oracle DB driver to dist.
                from: path.resolve(__dirname, 'node_modules/oracledb/build/Release'),
                to: 'oracledb',
            },
        ]),
        . . .
    ],

提示在https://github.com/oracle/node-oracledb/issues/1156#issuecomment-598017250 https://github.com/oracle/node-oracledb/issues/1156#issuecomment-598017250

本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

错误:NJS-045:无法加载 Node.js 18.14.0 (win32 x64) 的 node-oracledb 二进制文件 的相关文章

  • Nodejs 中的子域

    如何处理nodejs的子域请求 例如以下代码回显test在控制台中的任何请求http localhost 9876 任何内容 http localhost 9876 5Banything 5D var http require http h
  • webpack中动态加载外部模块失败

    我正在尝试建立以下架构 一个核心 React 应用程序 它具有一些基本功能 并且能够在运行时加载其他 React 组件 这些额外的 React 组件可以按需加载 并且它们在构建核心应用程序时不可用 因此它们不能包含在核心应用程序的捆绑包中
  • 如何为我的整个 Node.js 应用程序使用相同的 MySQL 连接?

    我有一个app js 我从那里运行我的整个应用程序 在 app js 内部 我require许多文件中都有代码 对于每个文件 我都这样做 var mysql require mysql var mclient mysql createCon
  • Jwt 签名和前端登录身份验证

    我有这个特殊的 jwt sign 函数 Backend const token jwt sign id user id process env TOKEN SECRET expiresIn 1m res header auth token
  • 对于实时网站使用 Node.js 或 Ringojs 安全吗?

    正如标题中所述 我想知道使用实际的 omg 平台 即 Node js 和 Ringo js 的实际版本 之一来开发网站是否安全 另外 我想知道他们是否支持cookie sessions以及他们如何处理多字段帖子 PHP中的fieldname
  • npmjs.org - 找不到自述文件

    我是 npm 包的主要作者scramjet 一个月以来 我遇到了关于可视性的问题README md在 npmjs 中 The npm 中的超燃冲压发动机包 https www npmjs com package scramjet shows
  • 使用 React.js + Express.js 发送电子邮件

    我在 ES6 中使用 React js 构建了一个 Web 应用程序 我目前想要创建一个基本的 联系我们 页面并想要发送电子邮件 我是 React 新手 刚刚发现我实际上无法使用 React 本身发送电子邮件 我正在遵循教程nodemail
  • 在旧浏览器上使用 Fetch 的 ReactJS

    我正在使用 Webpack 和 Babel 实现 React JS 但是 我在让 Fetch 与 IE 11 配合使用时遇到问题 我的 babelrc 文件中有以下内容 presets env stage 0 react 以及我的 webp
  • 缺少节点-v59-linux-x64/grpc_node.node

    我正在尝试在我的服务器中使用 Firebase admin SDK 当我部署时 出现错误 我在 firebase admin node module 映射中缺少文件 node v59 linux x64 grpc node node 我在包
  • Node.js 重写 toString

    我试图覆盖我的对象的默认 toString 方法 这是代码和问题 function test this code 0 later on I will set these this name test prototype toString f
  • firebase 和 firebase-admin npm 模块有什么区别?

    我想使用 Firebase 身份验证 数据库和存储 构建 Node js Web 应用程序 但我对应该使用哪个模块感到困惑 firebase or firebase 管理员 或两者 管理 SDK 运行您的代码管理权限 https fireb
  • 如何使用Create React App安装React

    嗨 我对反应真的很陌生 我不知道如何实际安装它 也不知道我需要做什么才能在其中编写代码 我下载了node js并且安装了v12 18 3以及NPM 6 14 6 但是每次我尝试在许多网站上提到的create react app安装方法中输入
  • 如何测试 jest Node JS 中 AWS 内置方法中使用的 .promise() 方法

    我想对其进行完整的单元测试 下面给出了我的函数的代码 function js async function sesSendEmail message var ses new aws SES apiVersion 2020 12 01 var
  • 在回调中使用await(Microsoft Bot Framework v4 Nodejs)

    我正在尝试将回复发送回chatbot emulator从内部回调 async getUserDetails step console log inside get userdetaiuls modeiule this userDBObjec
  • 我在 MacBook M1 max 中的 nodejs 连接到数据库 oracle 时遇到问题帮助我

    Node js 中的错误消息 nodemon 启动node server js错误 错误 DPI 1047 无法找到 64 位 Oracle 客户端库 dlopen Users pitidev ldb Downloads instantcl
  • 使用 Sequelize 实现单表继承

    有没有办法使用sequelize来创建单表继承 我希望有一个用于购买和 PartialPurchase 模型的 STI 其中我将有一个类型字段 该字段为 Purchase 或 PartialPurchase 以及类 Purchasing 和
  • 如何检查请求是否通过 Express 中的 https 发送

    我想强制某些路线始终在我的 Express 应用程序中使用安全连接 我如何检查以确保它使用 https 我在 heroku 上使用搭载 ssl 进行部署 我也在 Heroku 上部署 当他们使用 nginx 进行反向代理时 他们添加了一堆标
  • 如何使用 Antd / Less 和 Sass / CSS 模块配置 Next.js

    我想用Next js https nextjs org 带有 Sass 和 CSS 模块但也想使用蚂蚁设计 https ant design 并希望对较小的建筑尺寸使用 Less 样式 我可以启用 CSS 模块或 Less 加载器 但不能同
  • Nodejs mysql 获取正确的时间戳格式

    我在用着mysqljs https github com mysqljs mysql得到结果后sql我变得不同TimeStamp格式如下 created at Sat Jul 16 2016 23 52 54 GMT 0430 IRDT 但
  • 如何使用 Passport 验证 Supertest 请求?

    我使用 Passport js 进行身份验证 本地策略 并使用 Mocha 和 Supertest 进行测试 如何使用 Supertest 创建会话并发出经过身份验证的请求 正如 zeMirco 指出的那样 底层superagent模块支持

随机推荐