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

ghostscript4js and docker compatibility #28

Closed briva closed 6 years ago

briva commented 7 years ago

This is my docker file :

FROM ubuntu:latest

RUN apt-get update RUN apt -y install curl RUN curl -sL https://deb.nodesource.com/setup_8.x | bash - RUN apt-get -y install nodejs RUN apt-get -y install make RUN apt-get -y install sudo RUN sudo apt-get -y install ghostscript RUN sudo apt-get -y install libgs-dev

VOLUME ["/data"]

ADD . /data RUN cd /data && npm install

EXPOSE 8080

WORKDIR /data

CMD ["npm", "start"]

I got this message when i launch the container.

node dist

/data/node_modules/bindings/bindings.js:88 throw e ^

Error: /data/node_modules/ghostscript4js/build/Release/ghostscript4js.node: invalid ELF header 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 (/data/node_modules/bindings/bindings.js:81:44) at Object. (/data/node_modules/ghostscript4js/lib/ghostscript4js.js:25:31) at Module._compile (module.js:635:30) at Object.Module._extensions..js (module.js:646:10)

I try the install in a clean Ubuntu VM and i didnt get this message. It works well.

NickNaso commented 7 years ago

Hi @briva , before the execution of npm install try to install node-gyp globally as reported below:

npm install -g node-gyp

Hope that this will work for you.

Nick

briva commented 7 years ago

Just added that but i got this when i build the docker container :

Removing intermediate container 586fa9f2a459 Step 12/18 : RUN npm install ghostscript4js --save ---> Running in a49c000b74b4

ghostscript4js@2.0.7 install /node_modules/ghostscript4js node-gyp rebuild

make: Entering directory '/node_modules/ghostscript4js/build' CXX(target) Release/obj.target/ghostscript4js/src/ghostscript4js.o SOLINK_MODULE(target) Release/obj.target/ghostscript4js.node COPY Release/ghostscript4js.node make: Leaving directory '/node_modules/ghostscript4js/build' npm WARN saveError ENOENT: no such file or directory, open '/package.json' npm notice created a lockfile as package-lock.json. You should commit this file. npm WARN enoent ENOENT: no such file or directory, open '/package.json' npm WARN !invalid#1 No description npm WARN !invalid#1 No repository field. npm WARN !invalid#1 No README data npm WARN !invalid#1 No license field.

briva commented 7 years ago

Still the same issue :

node dist

/data/node_modules/bindings/bindings.js:88 throw e ^

Error: /data/node_modules/ghostscript4js/build/Release/ghostscript4js.node: invalid ELF header at Object.Module._extensions..node (module.js:670:18) at Module.load (module.js:560:32) at tryModuleLoad (module.js:503:12) at Function.Module._load (module.js:495:3) at Module.require (module.js:585:17) at require (internal/module.js:11:18) at bindings (/data/node_modules/bindings/bindings.js:81:44) at Object. (/data/node_modules/ghostscript4js/lib/ghostscript4js.js:25:31) at Module._compile (module.js:641:30) at Object.Module._extensions..js (module.js:652:10) npm ERR! code ELIFECYCLE npm ERR! errno 1 npm ERR! express-es6-rest-api@0.3.0 start: node dist npm ERR! Exit status 1 npm ERR! npm ERR! Failed at the express-es6-rest-api@0.3.0 start script. npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

NickNaso commented 6 years ago

@briva Sorry if I didn't update this issue, but now there's a guide on documentation to use the module with docker. See: https://github.com/NickNaso/ghostscript4js#docker Now I will provide to close the issue, but feel free to reopen if you have other problems.