NickNaso / ghostscript4js

Ghostscript4JS binds the Ghostscript C API to the Node.JS world.
http://www.nacios.it
Apache License 2.0
68 stars 19 forks source link

firebase nodejs: /usr/lib/x86_64-linux-gnu/libgs.so: No such file or directory #53

Open arthabus opened 4 years ago

arthabus commented 4 years ago

Hi,

I'm getting this error when I try to deploy to firebase nodejs - any input on what I'm missing is much appreciated:

Deployment error.
Build failed: 
{
  "error": {
    "canonicalCode": "INVALID_ARGUMENT",
    "errorMessage": "`npm_install` had stderr output:
    node-pre-gyp WARN 
    Using request for node-pre-gyp https download 
    g++: error: /usr/lib/x86_64-linux-gnu/libgs.so: No such file or directory
    make: *** [Release/obj.target/ghostscript4js.node] Error 1
    gyp ERR! build error 
    gyp ERR! stack Error: `make` failed with exit code: 2
    gyp ERR! stack     at ChildProcess.onExit (/usr/lib/node_modules/npm/node_modules/node-gyp/lib/build.js:262:23)
    gyp ERR! stack     at emitTwo (events.js:126:13)
    gyp ERR! stack     at ChildProcess.emit (events.js:214:7)
    gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:198:12)
    gyp ERR! System Linux 4.15.0-1044-gcp
    gyp ERR! command \"/usr/bin/node\" \"/usr/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js\" \"rebuild\"
    gyp ERR! cwd /workspace/node_modules/ghostscript4js
    gyp ERR! node -v v8.16.0
    gyp ERR! node-gyp -v v3.8.0
    gyp ERR! not ok 
    npm ERR! code ELIFECYCLE
    npm ERR! errno 1
    npm ERR! ghostscript4js@3.2.1 install: `node-gyp rebuild`
    npm ERR! Exit status 1
    npm ERR! 
    npm ERR! Failed at the ghostscript4js@3.2.1 install script.
    npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

    npm ERR! A complete log of this run can be found in:
    npm ERR!     /builder/home/.npm/_logs/2020-03-09T10_06_18_268Z-debug.log
    error: `npm_install` returned code: 1",
    "errorType": "InternalError",
    "errorId": "F8BCC123"
  }
}

I was trying to override --GS4JS_HOME but then it fails during the npm install ghostscript-js.

NickNaso commented 4 years ago

Hi @arthabus, I don't know firebase, but I think that the problem is that in your production environment you don't have the ghostscript installed. The installation process try to link the ghostscript library using the default path /usr/lib/x86_64-linux-gnu/libgs.so.
You can use two environment variables:

arthabus commented 4 years ago

@NickNaso thanks. Yes, I guess the problem is that it's not installed.

And sorry for the dumb question but how do I install ghostscript to node?

Till today I was only using node with npm - this is how I installed any needed modules so far. Any articles or how to google it would be very helpful ("install new modules to node" or similar returns "use npm"). I know I'm missing something fundamental here...

NickNaso commented 4 years ago

Hi @arthabus, sorry for the late in response to you. To allow you to easily use ghostscript4js on serverless environment I need to make all the tasks that I discussed here: https://github.com/NickNaso/ghostscript4js/issues/55#issuecomment-610359219 Maybe a simple workaround could be to build ghostscript library and put it on ta folder inside of your project then you can set the environment variables GS4JS_HOME e GS4JS_LIB to point to that folder and file library. At that point all should work well. I think that you need to build the library for Linux.

NickNaso commented 2 months ago

This issue relates to https://github.com/NickNaso/ghostscript4js/issues/61