question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

node-pre-gyp Appveyor build failing for Windows x86 using Node 4.4.3

See original GitHub issue

I was having trouble building for Windows x86 using Node.js 4.4.3, when I noticed that the Appveyor build for node-pre-gyp itself is failing for the same reason:

ENOENT: no such file or directory in readCAFile

The failed build can be seen here:

https://ci.appveyor.com/project/Mapbox/node-pre-gyp/build/1.0.373/job/h12w3ymhbyg6ltq6#L481

The build for Windows x64 using Node 4.4.3 succeeds, however.

I see that the node-gyp command is failing, but I thought perhaps node-pre-gyp might be missing something for the setup for the 4.4.3 release.

Any thoughts as to what is missing here? Now that 4.4.3 is the LTS version, it would be great to be able to have nice precompiled binaries for it.

Thank you!

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:16 (10 by maintainers)

github_iconTop GitHub Comments

2reactions
wilhelmbergcommented, Aug 26, 2016

Hm, this is getting stranger.

The error is intermittent, sometimes it occurs and sometimes it does not.

I’ve only been able to reproduce it with npm test which sometimes errors like on AppVeyor (sometimes not):

Error: Command failed: C:\WINDOWS\system32\cmd.exe /s /c 
"node-pre-gyp rebuild -C c:\mb\node-pre-gyp\test\app2 --clang=1 --msvs_version=2015  --custom_include_path=../include --toolset=cpp11 --loglevel=error"
gyp ERR! configure error 
gyp ERR! stack Error: ENOENT: no such file or directory, open 'c:\mb\node-pre-gyp\test\app2\undefined'
gyp ERR! stack     at Error (native)
gyp ERR! stack     at Object.fs.openSync (fs.js:549:18)
gyp ERR! stack     at Object.fs.readFileSync (fs.js:397:15)
gyp ERR! stack     at readCAFile (C:\Program Files (x86)\nodejs\node_modules\npm\node_modules\node-gyp\lib\install.js:466:15)
gyp ERR! stack     at download (C:\Program Files (x86)\nodejs\node_modules\npm\node_modules\node-gyp\lib\install.js:438:22)
gyp ERR! stack     at C:\Program Files (x86)\nodejs\node_modules\npm\node_modules\node-gyp\lib\install.js:185:19
gyp ERR! stack     at C:\Program Files (x86)\nodejs\node_modules\npm\node_modules\mkdirp\index.js:48:26
gyp ERR! stack     at FSReqWrap.oncomplete (fs.js:82:15)
gyp ERR! System Windows_NT 10.0.14905

If I run the same command

node bin\node-pre-gyp rebuild -C c:\mb\node-pre-gyp\test\app2 --clang=1 --msvs_version=2015  --custom_include_path=../include --toolset=cpp11 --loglevel=error

directly from the command line it always succeeds:

[node-pre-gyp-test-app2] Removing "c:\mb\node-pre-gyp\test\app2\lib\binding\Release\node-pre-gyp-test-app2"
gyp info it worked if it ends with ok
gyp info using node-gyp@3.4.0
gyp info using node@4.4.7 | win32 | ia32
gyp info ok
Building the projects in this solution one at a time. To enable parallel build, please add the "/m" switch.
  app2.cc
  win_delay_load_hook.cc
     Creating library c:\mb\node-pre-gyp\test\app2\build\Release\app2.lib and object c:\mb\node-pre-gyp\test\app2\build\Release\app2.exp
  Generating code
  Finished generating code
  app2.vcxproj -> c:\mb\node-pre-gyp\test\app2\build\Release\\app2.node
  app2.vcxproj -> c:\mb\node-pre-gyp\test\app2\build\Release\app2.pdb (Full PDB)
  Copying c:\mb\node-pre-gyp\test\app2\build\Release\/app2.node to c:/mb/node-pre-gyp/test/app2/lib/binding/Release/node-pre-gyp-test-app2/app2.node
          1 file(s) copied.

My current hunch is that the problem just occurs with the tests and not with node-pre-gyp/node-gyp/gyp per se, as mocha shells out to node-pre-gyp which shells out to pre-gyp which shells out to gyp.

I think somewhere on the way the environment gets screwed (sometimes, don’t know yet when and why) and thus results in failures.

This shelling-out structure also makes this problem a nightmare to debug: If I attach to and step through the mocha process I cannot continue to step into node-pre-gyp when it gets executed. Same if I attach to node-pre-gyp and pre-gyp gets called, and so on.

2reactions
reconbotcommented, May 8, 2016

I’ve got a two step work around and I filed a bug with node-gyp.

The error we see is that the string undefined isn’t a file. I’m only seeing this on 32bit windows machines with node 4.3 and 4.4. I haven’t checked others.

The work around is to set the cafile option to a real file, I chose package.json. Then we get a second bug where even though it hasn’t found a cert in package.json it still tries to use one. So you have to disable strict-ssl. We get some warnings but it works and doesn’t seem to affect other node versions.

I added these to install phase in appveyor.yml

  # work around an issue with node-gyp v3.3.1 and node 4x
  # package.json has no certificates in it so we're cool
  # https://github.com/nodejs/node-gyp/issues/921
  - cmd: npm config set -g cafile=package.json
  - cmd: npm config set -g strict-ssl=false
Read more comments on GitHub >

github_iconTop Results From Across the Web

Please install Nodejs v18 - new builds are failing, looks like ...
Exception calling "DownloadFile" with "2" argument(s): "The remote server returned an error: (404) Not Found." At C:\Program Files\AppVeyor\ ...
Read more >
node.js - Error with npm install - a pre-gyp error - Stack Overflow
build error node-pre-gyp ERR! stack Error: Failed to execute 'C:\Program Files\nodejs\node.exe C:\Users\simon\node_modules\ ...
Read more >
node-pre-gyp - npm
Appveyor can build binaries and publish the results per commit and supports: Windows Visual Studio 2013 and related compilers; Both 64 bit (x64) ......
Read more >
node_modules/node-pre-gyp · master - Gitlab @ CCI
For a hello world example of a module packaged with node-pre-gyp see ... See Appveyor Automation for how to auto-publish builds on Windows....
Read more >
3954c74e54719c6ab73b..
0ad-0.0.18-mga-system-valgrind.patch 0ad-0.0.23b-alpha-unix-build.tar.xz ... In-tests-show-the-exception-on-failure.patch apache-mod_auth_gssapi.spec ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found