Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error: NJS-045: cannot load a node-oracledb binary for Node.js 12.4.0 (darwin x64) #1253

Closed
fgprodigal opened this issue May 21, 2020 · 5 comments

Comments

@fgprodigal
Copy link

process.platform: darwin
process.version: v12.16.3
process.arch: x64
require('oracledb').versionString: 4.2.0
require('oracledb').oracleClientVersionString: 19.3.0.0.0

This is my repo:
https://github.com/fgprodigal/oracledb-test

It is initialed by vue-cli and vue add electron, I added require("oracledb") in background.js, when i run 'yarn run electron:serve', the error mentioned above appears.

I've read some earlier issues, I added copy-webpack-plugin but still not work, so please help me, what is going wrong with electron or webpack?

@cjbj
Copy link
Member

cjbj commented May 21, 2020

What's the OS version?

@fgprodigal
Copy link
Author

This error appears on both macOS 10.14.6 and windows 10 x64 1909

@cjbj
Copy link
Member

cjbj commented May 21, 2020

Last time I tried electron, I think I used https://github.com/n-riesco/oracledb-electron-builder

To use webpack you need to patch the lib/oracledb.js file, or build the current master branch. See #1156 (comment) But I don't see webpack in your example?

Neither Electron or Webpack will package Instant Client, so you will need to install that separately.

@fgprodigal
Copy link
Author

ok, I'll try oracledb-electron-builder.

my project was created by vue-cli, webpack can be configured by vue.config.js
https://cli.vuejs.org/guide/webpack.html#inspecting-the-project-s-webpack-config

vue.config.js

const CopyWebpackPlugin = require('copy-webpack-plugin')
const path = require("path")

function resolve (dir) {
  return path.join(__dirname, dir);
}

module.exports = {
  publicPath: "./",
  devServer: {
    // can be overwritten by process.env.HOST
    host: "0.0.0.0",
    port: 8080
  },
  configureWebpack: config => {
    config.plugins.push(
      new CopyWebpackPlugin({
        patterns: [
          {
            from: resolve('node_modules/oracledb/build'),
            to: 'node_modules/oracledb/build'
          }
        ]
      })
    )
  },
  chainWebpack: config => {
    config.resolve.alias
      .set("@", resolve("src"))
      .set("src", resolve("src"))
      .set("common", resolve("src/common"))
      .set("components", resolve("src/components"));
  }
};

@cjbj
Copy link
Member

cjbj commented Jun 29, 2020

Try node-oracledb 5. See #1156 (comment)

Also check out the new macOS installation doc and new initialization doc.

@cjbj cjbj closed this as completed Jun 29, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants