Open msykosch opened 8 years ago
I had the same issue, almost a year later but I assume more people will come here and hope to find a solution. This is how I made it working:
1) download this repo
2) instead of the normal npm install do:
npm install ./node-pdflib-master
Also make sure to copy the ".dylib" files to the right location (/usr/lib on Linux, /usr/local/lib on MacOS)
That approach fixed it for us: https://github.com/NitroPye/node-pdflib/pull/5
npm install pdflib
make: Entering directory `/home/parallels/myPDFlib/node_modules/ffi/build' CC(target) Release/obj.target/ffi/deps/libffi/src/prep_cif.o CC(target) Release/obj.target/ffi/deps/libffi/src/types.o CC(target) Release/obj.target/ffi/deps/libffi/src/raw_api.o CC(target) Release/obj.target/ffi/deps/libffi/src/java_raw_api.o CC(target) Release/obj.target/ffi/deps/libffi/src/closures.o ../deps/libffi/src/closures.c: In function ‘dlmmap_locked’: ../deps/libffi/src/closures.c:421:17: warning: ignoring return value of ‘ftruncate’, declared with attribute warn_unused_result [-Wunused-result] ftruncate (execfd, offset); ^ ../deps/libffi/src/closures.c:433:17: warning: ignoring return value of ‘ftruncate’, declared with attribute warn_unused_result [-Wunused-result] ftruncate (execfd, offset); ^ CC(target) Release/obj.target/ffi/deps/libffi/src/x86/ffi.o CC(target) Release/obj.target/ffi/deps/libffi/src/x86/ffi64.o ../deps/libffi/src/x86/ffi64.c: In function ‘classify_argument’: ../deps/libffi/src/x86/ffi64.c:181:18: warning: suggest braces around empty body in an ‘else’ statement [-Wempty-body] FFI_ASSERT (0); ^ CC(target) Release/obj.target/ffi/deps/libffi/src/x86/unix64.o CC(target) Release/obj.target/ffi/deps/libffi/src/x86/sysv.o AR(target) Release/obj.target/deps/libffi/libffi.a COPY Release/libffi.a CXX(target) Release/obj.target/ffi_bindings/src/ffi.o In file included from ../src/ffi.cc:3:0: ../src/ffi.h:3:0: warning: "__STDC_LIMIT_MACROS" redefined [enabled by default]
define __STDC_LIMIT_MACROS true
^ In file included from /home/parallels/.node-gyp/6.1.0/include/node/v8.h:19:0, from /home/parallels/.node-gyp/6.1.0/include/node/node.h:42, from ../src/ffi.cc:1: /usr/lib/gcc/x86_64-linux-gnu/4.8/include/stdint.h:5:0: note: this is the location of the previous definition
define __STDC_LIMIT_MACROS
^ In file included from ../src/ffi.h:18:0, from ../src/ffi.cc:3: ../../nan/nan.h:324:27: error: redefinition of ‘template v8::Local Nan::imp::NanEnsureHandleOrPersistent(const v8::Local&)’
NAN_INLINE v8::Local NanEnsureHandleOrPersistent(const v8::Local &val) {
^
../../nan/nan.h:319:17: error: ‘template v8::Handle Nan::imp::NanEnsureHandleOrPersistent(v8::Handle&)’ previously declared here
v8::Handle NanEnsureHandleOrPersistent(const v8::Handle &val) {
^
../../nan/nan.h:344:27: error: redefinition of ‘template v8::Local Nan::imp::NanEnsureLocal(v8::Handle&)’
NAN_INLINE v8::Local NanEnsureLocal(const v8::Handle &val) {
^
../../nan/nan.h:334:27: error: ‘template v8::Local Nan::imp::NanEnsureLocal(const v8::Local&)’ previously declared here
NAN_INLINE v8::Local NanEnsureLocal(const v8::Local &val) {
^
../../nan/nan.h:560:20: error: variable or field ‘NanAddGCEpilogueCallback’ declared void
v8::Isolate::GCEpilogueCallback callback
^
../../nan/nan.h:560:7: error: ‘GCEpilogueCallback’ is not a member of ‘v8::Isolate’
v8::Isolate::GCEpilogueCallback callback
^
../../nan/nan.h:561:18: error: expected primary-expression before ‘gc_type_filter’
, v8::GCType gc_type_filter = v8::kGCTypeAll) {
^
../../nan/nan.h:566:20: error: variable or field ‘NanRemoveGCEpilogueCallback’ declared void
v8::Isolate::GCEpilogueCallback callback) {
^
../../nan/nan.h:566:7: error: ‘GCEpilogueCallback’ is not a member of ‘v8::Isolate’
v8::Isolate::GCEpilogueCallback callback) {
^
../../nan/nan.h:571:20: error: variable or field ‘NanAddGCPrologueCallback’ declared void
v8::Isolate::GCPrologueCallback callback
^
../../nan/nan.h:571:7: error: ‘GCPrologueCallback’ is not a member of ‘v8::Isolate’
v8::Isolate::GCPrologueCallback callback
^
../../nan/nan.h:572:18: error: expected primary-expression before ‘gc_type_filter’
, v8::GCType gc_type_filter = v8::kGCTypeAll) {
^
../../nan/nan.h:577:20: error: variable or field ‘NanRemoveGCPrologueCallback’ declared void
v8::Isolate::GCPrologueCallback callback) {
^
../../nan/nan.h:577:7: error: ‘GCPrologueCallback’ is not a member of ‘v8::Isolate’
v8::Isolate::GCPrologueCallback callback) {
^
../../nan/nan.h:757:13: error: ‘node::smalloc’ has not been declared
, node::smalloc::FreeCallback callback
^
../../nan/nan.h:757:35: error: expected ‘,’ or ‘...’ before ‘callback’
, node::smalloc::FreeCallback callback
^
../../nan/nan.h: In function ‘v8::Local NanNewBufferHandle(char, size_t, int)’:
../../nan/nan.h:761:50: error: ‘callback’ was not declared in this scope
v8::Isolate::GetCurrent(), data, length, callback, hint);
^
../../nan/nan.h:761:60: error: ‘hint’ was not declared in this scope
v8::Isolate::GetCurrent(), data, length, callback, hint);
^
../../nan/nan.h: In function ‘v8::Local NanNewBufferHandle(const char , uint32_t)’:
../../nan/nan.h:768:67: error: invalid conversion from ‘const char’ to ‘char’ [-fpermissive]
return node::Buffer::New(v8::Isolate::GetCurrent(), data, size);
^
In file included from ../src/ffi.cc:2:0:
/home/parallels/.node-gyp/6.1.0/include/node/node_buffer.h:46:40: error: initializing argument 2 of ‘v8::MaybeLocal node::Buffer::New(v8::Isolate, char, size_t)’ [-fpermissive]
NODE_EXTERN v8::MaybeLocal New(v8::Isolate isolate,
^
In file included from ../src/ffi.h:18:0,
from ../src/ffi.cc:3:
../../nan/nan.h:768:67: error: could not convert ‘node::Buffer::New(v8::Isolate::GetCurrent(), ((char)data), ((size_t)size))’ from ‘v8::MaybeLocal’ to ‘v8::Local’
return node::Buffer::New(v8::Isolate::GetCurrent(), data, size);
^
../../nan/nan.h: In function ‘v8::Local NanNewBufferHandle(uint32_t)’:
../../nan/nan.h:772:61: error: could not convert ‘node::Buffer::New(v8::Isolate::GetCurrent(), ((size_t)size))’ from ‘v8::MaybeLocal’ to ‘v8::Local’
return node::Buffer::New(v8::Isolate::GetCurrent(), size);
^
../../nan/nan.h: In function ‘v8::Local NanBufferUse(char, uint32_t)’:
../../nan/nan.h:779:12: error: ‘Use’ is not a member of ‘node::Buffer’
return node::Buffer::Use(v8::Isolate::GetCurrent(), data, size);
^
../src/ffi.cc: In function ‘v8::Handle WrapPointer(char , size_t)’:
../src/ffi.cc:25:63: error: no matching function for call to ‘NanNewBufferHandle(char&, size_t&, void (&)(char, void), void&)’
NanNewBufferHandle(ptr, length, wrap_pointer_cb, user_data)
^
../../nan/nan.h:483:68: note: in definition of macro ‘NanEscapeScope’
define NanEscapeScope(val) scope.Escape(Nan::imp::NanEnsureLocal(val))
../src/ffi.cc:25:63: note: candidates are: NanNewBufferHandle(ptr, length, wrap_pointer_cb, user_data) ^ ../../nan/nan.h:483:68: note: in definition of macro ‘NanEscapeScope’
define NanEscapeScope(val) scope.Escape(Nan::imp::NanEnsureLocal(val))
../../nan/nan.h:754:36: note: v8::Local NanNewBufferHandle(char, size_t, int)
NAN_INLINE v8::Local NanNewBufferHandle (
^
../../nan/nan.h:754:36: note: candidate expects 3 arguments, 4 provided
../../nan/nan.h:764:36: note: v8::Local NanNewBufferHandle(const char , uint32_t)
NAN_INLINE v8::Local NanNewBufferHandle (
^
../../nan/nan.h:764:36: note: candidate expects 2 arguments, 4 provided
../../nan/nan.h:771:36: note: v8::Local NanNewBufferHandle(uint32_t)
NAN_INLINE v8::Local NanNewBufferHandle (uint32_t size) {
^
../../nan/nan.h:771:36: note: candidate expects 1 argument, 4 provided
../src/ffi.cc: In static member function ‘static void FFI::FinishAsyncFFICall(uv_work_t)’:
../src/ffi.cc:387:29: warning: ‘void node::FatalException(const v8::TryCatch&)’ is deprecated (declared at /home/parallels/.node-gyp/6.1.0/include/node/node.h:301): Use FatalException(isolate, ...) [-Wdeprecated-declarations]
FatalException(try_catch);
^
../src/ffi.cc: In function ‘v8::Handle WrapPointer(char , size_t)’:
../src/ffi.cc:27:1: warning: control reaches end of non-void function [-Wreturn-type]
}
^
make: *** [Release/obj.target/ffi_bindings/src/ffi.o] Error 1
make: Leaving directory
/home/parallels/myPDFlib/node_modules/ffi/build' 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:276:23) gyp ERR! stack at emitTwo (events.js:106:13) gyp ERR! stack at ChildProcess.emit (events.js:191:7) gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:204:12) gyp ERR! System Linux 3.13.0-34-generic gyp ERR! command "/usr/bin/nodejs" "/usr/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild" gyp ERR! cwd /home/parallels/myPDFlib/node_modules/ffi gyp ERR! node -v v6.1.0 gyp ERR! node-gyp -v v3.3.1 gyp ERR! not ok npm WARN enoent ENOENT: no such file or directory, open '/home/parallels/myPDFlib/package.json' npm WARN myPDFlib No description npm WARN myPDFlib No repository field. npm WARN myPDFlib No README data npm WARN myPDFlib No license field. npm ERR! Linux 3.13.0-34-generic npm ERR! argv "/usr/bin/nodejs" "/usr/bin/npm" "install" "pdflib" npm ERR! node v6.1.0 npm ERR! npm v3.8.6 npm ERR! code ELIFECYCLEnpm ERR! ffi@1.3.2 install:
node-gyp rebuild
npm ERR! Exit status 1 npm ERR! npm ERR! Failed at the ffi@1.3.2 install script 'node-gyp rebuild'. npm ERR! Make sure you have the latest version of node.js and npm installed. npm ERR! If you do, this is most likely a problem with the ffi package, npm ERR! not with npm itself. npm ERR! Tell the author that this fails on your system: npm ERR! node-gyp rebuild npm ERR! You can get information on how to open an issue for this project with: npm ERR! npm bugs ffi npm ERR! Or if that isn't available, you can get their info via: npm ERR! npm owner ls ffi npm ERR! There is likely additional logging output above.npm ERR! Please include the following file with any support request: npm ERR! /home/parallels/myPDFlib/npm-debug.log