Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

npm install/build fail on windows #13

Open
yomansk8 opened this issue Nov 7, 2016 · 8 comments
Open

npm install/build fail on windows #13

yomansk8 opened this issue Nov 7, 2016 · 8 comments

Comments

@yomansk8
Copy link

yomansk8 commented Nov 7, 2016

Hello,

I try to use this module in an electron app with the node-printer module. The node printer module works properly but I have an issue with the install of the node-pdfium module on Windows.

I tried to install the module with
npm install --save pdfium
or
npm install --save pdfium --msvs_version=2015
and
npm install --save pdfium --msvs_version=2015 --runtime=electron --target=1.4.5 --arch=x64

But each time, I got the following error :
image

My node version is 6.9.1 and my npm version is 3.10.8

Any idea why the build fail ?

@ArsNV
Copy link

ArsNV commented Nov 11, 2016

Hi

I have the same error

capture

Thanks

@logidelic
Copy link

Firstly, I believe that you need to be using the patched pdfium, as in:

npm install https://github.com/gaboelnuevo/node-pdfium/tarball/patch-node-version --save

This works for me. However, doing an electron-rebuild or:

npm install --save https://github.com/gaboelnuevo/node-pdfium/tarball/patch-node-version --runtime=electron --target=1.6.5 --arch=x64

Seems to build everything fine but finally fails with the following:

...
PWL_Note.cpp
PWL_ScrollBar.cpp
PWL_Signature.cpp
PWL_SpecialButton.cpp
PWL_Utils.cpp
PWL_Wnd.cpp
win_delay_load_hook.cc
pdfwindow.vcxproj -> C:\Users\uname\dev\App\apps\Thing\node_modules\pdfium\build\Release\\pdfwindow.lib
gyp ERR! build error
gyp ERR! stack Error: `C:\Program Files (x86)\MSBuild\14.0\bin\msbuild.exe` failed with exit code: 1
gyp ERR! stack     at ChildProcess.onExit (C:\Users\uname\AppData\Roaming\npm\node_modules\npm\node_modules\node-gyp\lib\build.js:285: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:215:12)
gyp ERR! System Windows_NT 10.0.15063
gyp ERR! command "C:\\Program Files\\nodejs\\node.exe" "C:\\Users\\uname\\AppData\\Roaming\\npm\\node_modules\\npm\\node_modules\\node-gyp\\bin\\node-gyp.js" "rebuild"
gyp ERR! cwd C:\Users\uname\dev\App\apps\Thing\node_modules\pdfium
gyp ERR! node -v v6.10.2
gyp ERR! node-gyp -v v3.6.0
gyp ERR! not ok
npm WARN [email protected] No description
npm WARN [email protected] No repository field.
npm WARN [email protected] No license field.
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] install: `node-gyp rebuild`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] 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 pdfium 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 pdfium
npm ERR! Or if that isn't available, you can get their info via:
npm ERR!     npm owner ls pdfium
npm ERR! There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\uname\AppData\Roaming\npm-cache\_logs\2017-05-03T17_24_51_056Z-debug.log

@yahyaKacem
Copy link

I'm still having the same error, any updates for this?

@ArsNV
Copy link

ArsNV commented May 11, 2017

Nothing..

@ThomasLamiraud
Copy link

ThomasLamiraud commented Jun 9, 2017

npm install https://github.com/gaboelnuevo/node-pdfium/tarball/patch-node-version --save
^ this works for me, at least the installation went fine.

But when i require the package (var pdfium = require('pdfium');) i got that error :

\\?\C:\Users\thomas\Documents\bergalectron\node_modules\pdfium\build\Release\node_pdfium.node
    at process.module.(anonymous function) [as dlopen] (ELECTRON_ASAR.js:173:20)
    at Object.Module._extensions..node (module.js:598:18)
    at Object.module.(anonymous function) [as .node] (ELECTRON_ASAR.js:173:20)
    at Module.load (module.js:488:32)
    at tryModuleLoad (module.js:447:12)
    at Function.Module._load (module.js:439:3)
    at Module.require (module.js:498:17)
    at require (internal/module.js:20:19)
    at Object.<anonymous> (C:\Users\thomas\Documents\bergalectron\node_modules\pdfium\lib\index.js:8:21)
    at Object.<anonymous> (C:\Users\thomas\Documents\bergalectron\node_modules\pdfium\lib\index.js:16:3)

node : 6.10.3
electron : 1.6.10
npm : 3.10.10
Windows 10 running on a virtual machine (virtual box) on MacOS

Any ideas why i can't requite that package since the install is fine ?!

@paulprins
Copy link

paulprins commented Jun 18, 2017

Okay so I have the same problem as @ThomasLamiraud . I was able to get some errors out of node-gyp. You can only see these if you enable them in the output of node-gyp (npm install doesn't do this). Navigate to pdfium within the node_modules directory then execute

You should get it working with this branch ( PR in on @gaboelnuevo branch)
https://github.com/FreshVine/node-pdfium/tree/patch-node-version

node-gyp rebuild --silly --target=1.6.10 --arch=x64 --dist-url=https://atom.io/download/atom-shell --module_path=lib/ --python=python2.7 --msvs_version=2015

It is the --silly parameter that gives you the output. This is what is broken for me:

"......\node_modules\pdfium\build\binding.sln" (default target) (1) ->
"......\node_modules\pdfium\build\third_party\pdfium\javascript.vcxproj" (default target) (14) -> (ClCompile target) ->
  ..\..\..\third_party\pdfium\fpdfsdk\src\javascript\JS_Object.cpp(91): error C2039: 'WeakCallbackData': is not a member of 'v8' [......\node_modules\pdfium\build\third_party\pdfium\javascript.vcxproj]
  ..\..\..\third_party\pdfium\fpdfsdk\src\javascript\JS_Object.cpp(91): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int [......\node_modules\pdfium\build\third_party\pdfium\javascript.vcxproj]
  ..\..\..\third_party\pdfium\fpdfsdk\src\javascript\JS_Object.cpp(91): error C2143: syntax error: missing ',' before '<' [......\node_modules\pdfium\build\third_party\pdfium\javascript.vcxproj]
  ..\..\..\third_party\pdfium\fpdfsdk\src\javascript\JS_Object.cpp(93): error C2065: 'data': undeclared identifier [......\node_modules\pdfium\build\third_party\pdfium\javascript.vcxproj]
  ..\..\..\third_party\pdfium\fpdfsdk\src\javascript\JS_Object.cpp(93): error C2228: left of '.GetParameter' must have class/struct/union [......\node_modules\pdfium\build\third_party\pdfium\javascript.vcxproj]
  ..\..\..\third_party\pdfium\fpdfsdk\src\javascript\JS_Object.cpp(99): error C2065: 'data': undeclared identifier [......\node_modules\pdfium\build\third_party\pdfium\javascript.vcxproj]
  ..\..\..\third_party\pdfium\fpdfsdk\src\javascript\JS_Object.cpp(99): error C2228: left of '.GetValue' must have class/struct/union [......\node_modules\pdfium\build\third_party\pdfium\javascript.vcxproj]
  ..\..\..\third_party\pdfium\fpdfsdk\src\javascript\JS_Object.cpp(120): error C2660: 'v8::PersistentBase<v8::Object>::SetWeak': function does not take 2 arguments [......\node_modules\pdfium\build\third_party\pdfium\javascript.vcxproj]

I thought I would add that I while I was able to get this built, printing using node-printer and the EMF file never worked.

@alexcodelab
Copy link

alexcodelab commented Sep 23, 2017

My solution for all this wasted time on Windows!

var absolutePath = path.resolve(file);

var pfad = "C:\Program Files (x86)\Adobe\Acrobat Reader DC\Reader\AcroRd32.exe";
var parameters = ["/t", absolutePath, printerName];

child_process(pfad, parameters, function(err, data) {
console.log(err)
console.log(data.toString());
});

@mm-ns
Copy link

mm-ns commented Jun 26, 2018

alex your solution has nothing to do with the issue.

AFAIS this is still relevant as I get the same error, no matter which patched repo i try to install from. any idea?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

8 participants