corymickelson / NoPoDoFo

node pdf native bindings
GNU Affero General Public License v3.0
26 stars 6 forks source link

Problem Installing on MacOS #96

Closed ionizer closed 5 years ago

ionizer commented 5 years ago

Please accept my apologies as this seems to have been asked multiple times (#77, #91) but I'm having lots trouble installing the whole stuff properly on my Mac, and the solution will later be deployed to Linux. I'm using NoPoDoFo v0.8.0 as distributed from NPM, and currently on MacOS Mojave 10.14.4 with Node v8.9.3.

Now, I tried installing using MacPorts using sudo port install podofo, then I installed NoPoDoFo (v0.8.0) to my Node project using yarn add nopodofo. But upon importing this library using require('nopodofo'), the following error shows:

/Users/ionizer/Desktop/podofo-sign-poc/node_modules/bindings/bindings.js:121
        throw e;
        ^

Error: dlopen(/Users/ionizer/Desktop/podofo-sign-poc/node_modules/nopodofo/build/Release/nopodofo.node, 1): no suitable image found.  Did find:
        /Users/ionizer/Desktop/podofo-sign-poc/node_modules/nopodofo/build/Release/nopodofo.node: unknown file type, first eight bytes: 0x7F 0x45 0x4C 0x46 0x02 0x01 0x01 0x00
        /Users/ionizer/Desktop/podofo-sign-poc/node_modules/nopodofo/build/Release/nopodofo.node: unknown file type, first eight bytes: 0x7F 0x45 0x4C 0x46 0x02 0x01 0x01 0x00
    at Object.Module._extensions..node (module.js:664:18)
    at Module.load (module.js:554:32)
    at tryModuleLoad (module.js:497:12)
    at Function.Module._load (module.js:489:3)
    at Module.require (module.js:579:17)
    at require (internal/module.js:11:18)
    at bindings (/Users/ionizer/Desktop/podofo-sign-poc/node_modules/bindings/bindings.js:112:48)
    at Object.<anonymous> (/Users/ionizer/Desktop/podofo-sign-poc/node_modules/nopodofo/index.js:1:101)
    at Module._compile (module.js:635:30)
    at Object.Module._extensions..js (module.js:646:10)

I also tried to install PoDoFo using Homebrew but to only meet the same error and could not figure out what to fix.

Correct me if I'm wrong, but referring to the previous issues, this seem to indicate that NoPoDoFo can't find the installed PoDoFo. Unfortunately for me, I could not figure out what's wrong and how to resolve this with NoPoDoFo v0.8.0.

Does anyone have a pointer to this issue? Thanks!

gentios commented 5 years ago

Hi @ionizer

You are having the same issue as I had, the 0.8.0 version published of Nopodofo still doesn't have the ENV variables configured to get the /opt/ path which Macports installs Podofo in it.

I recommend you clone the master branch, and install the module from it, this way you will have the latest changes until @corymickelson publishes the new version.

ionizer commented 5 years ago

Looks like my other option is to use vcpkg instead but I can't figure out how to point NoPoDoFo there. Do you happen to know how to achieve this?

gentios commented 5 years ago

Actually that didn't worked for me too.

What I did was:

  1. I forked the repo
  2. I cloned it
  3. Installed podofo using Homebrew as brew install podofo
  4. Export PODOFO_LIBRARY and PODOFO_INCLUDE_DIR as environment variables to use homebrew Podofo installation which is '/usr/local/Cellar/podofo/0.9.6 '
  5. run npm run build
  6. If the build is successful
  7. Push to a branch in your fork along with the /build folder
  8. Install in your project in the package.json you can include "nopodofo": "git+`repo#branch"

and it should work like this, I hope so

Regarding this doc for Mac I will open a PR soon

corymickelson commented 5 years ago

@gentios Thank you, and @ionizer the vcpkg mac podofo package seems to have some issues at the moment, plus it is lacking libidn which is used for aes 256 encryption. If you can use brew that appears to be the best option for mac today.

corymickelson commented 5 years ago

@gentios @ionizer Im closing this issue, if mac install issues persist please comment on #91