3

Error message in nodejs [nodemon] starting node server.js Error: Error: DPI-1047: Cannot locate a 64-bit Oracle Client library: "dlopen(/Users/pitidev-ldb/Downloads/instantclient_19_8/libclntsh.dylib, 0x0001): tried: '/Users/pitidev-ldb/Downloads/instantclient_19_8/libclntsh.dylib' (mach-o file, but is an incompatible architecture (have 'x86_64', need 'arm64e')), '/Users/pitidev-ldb/Downloads/instantclient_19_8/libclntsh.dylib.19.1' (mach-o file, but is an incompatible architecture (have 'x86_64', need 'arm64e'))". See https://oracle.github.io/node-oracledb/INSTALL.html for help

PitiDev
  • 45
  • 5
  • 3
    Because there is no M1 port of the Oracle client libraries, you will need to use the Intel x86_64 Node.js binary with Oracle's macOS Intel Instant Client libraries. Apple's Rosetta with then kick in. – Christopher Jones Sep 16 '22 at 22:25
  • 1
    pls recommend me what how to – PitiDev Sep 20 '22 at 05:48

1 Answers1

2

I had the same problem and got things to work.

To install Node, Terminal needs to be run using Rosetta during installation. NVM will pick the specified version number as usual but opt for the x86_64 binaries instead of M1.

  1. Installed nvm according to NVMs own site

  2. Followed this stack overflow post. What worked for me (read details in the post if things don't work out for you)

    1. Make terminal/iTerm2 to open in Rosetta mode. Got to Applications (-> utilities) -> right click on terminal app -> get Info -> Select "Open using Rosetta" -> Restart Terminal
    2. In Terminal.app run arch -x86_64 zsh
    3. From here install the Node version you need according to the NVM docs. I simply used nvm install node to install the latest version.
    4. You can reverse step 1 and run the Terminal app without Rosetta support.

You should now be able to run Node with the x86_64 version. (no matter if Terminal is run using Rosetta or not)

tobi-or-not
  • 566
  • 4
  • 13