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 fails at node-pre-gyp #22398

Closed
leo-petrucci opened this issue May 16, 2020 · 4 comments
Closed

npm install fails at node-pre-gyp #22398

leo-petrucci opened this issue May 16, 2020 · 4 comments
Labels
Needs Testing Needs further testing to be confirmed. [Type] Build Tooling Issues or PRs related to build tooling

Comments

@leo-petrucci
Copy link

I'm unsure if this is a bug or my own fault. I'm unsure how to solve it so hopefully someone can give me a hand.

When I run npm install, most of the installation runs fine until it gets to the above mentioned node-pre-gyp. At that point node outputs this error:

gutenberg on  master is 📦 v8.1.0 via ⬢ v13.9.0 took 6s 
➜ npm install

> nodegit@0.26.2 install /home/leonardopetrucci/Desktop/wp-plugins/gutenberg/node_modules/nodegit
> node lifecycleScripts/preinstall && node lifecycleScripts/install

[nodegit] Running pre-install script
[nodegit] Running install script
node-pre-gyp
WARN Using request for node-pre-gyp https download
node-pre-gyp
WARN Tried to download(404): https://axonodegit.s3.amazonaws.com/nodegit/nodegit/nodegit-v0.26.2-node-v79-linux-x64.tar.gz 
node-pre-gyp WARN Pre-built binaries not found for nodegit@0.26.2 and node@13.9.0 (node-v79 ABI, glibc) (falling back to source compile with node-gyp)
/bin/sh: 1: krb5-config: not found
gyp: Call to 'krb5-config gssapi --libs' returned exit status 127 while in binding.gyp. while trying to load binding.gyp
gyp
ERR! configure error
gyp
ERR! stack Error: `gyp` failed with exit code: 1
gyp ERR! stack     at ChildProcess.onCpExit (/usr/lib/node_modules/npm/node_modules/node-gyp/lib/configure.js:351:16)
gyp ERR! stack     at ChildProcess.emit (events.js:321:20)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:275:12)
gyp ERR! System Linux 5.3.0-7629-generic
gyp ERR!
command "/usr/bin/node" "/usr/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "configure" "--fallback-to-build" "--module=/home/leonardopetrucci/Desktop/wp-plugins/gutenberg/node_modules/nodegit/build/Release/nodegit.node" "--module_name=nodegit" "--module_path=/home/leonardopetrucci/Desktop/wp-plugins/gutenberg/node_modules/nodegit/build/Release" "--napi_version=5" "--node_abi_napi=napi" "--napi_build_version=0" "--node_napi_label=node-v79"
gyp ERR! cwd /home/leonardopetrucci/Desktop/wp-plugins/gutenberg/node_modules/nodegit
gyp ERR! node -v v13.9.0
gyp ERR! node-gyp -v v5.0.7
gyp ERR! not ok
node-pre-gyp
ERR! build error
node-pre-gyp
ERR! stack Error: Failed to execute '/usr/bin/node /usr/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js configure --fallback-to-build --module=/home/leonardopetrucci/Desktop/wp-plugins/gutenberg/node_modules/nodegit/build/Release/nodegit.node --module_name=nodegit --module_path=/home/leonardopetrucci/Desktop/wp-plugins/gutenberg/node_modules/nodegit/build/Release --napi_version=5 --node_abi_napi=napi --napi_build_version=0 --node_napi_label=node-v79' (1)
node-pre-gyp ERR! stack     at ChildProcess.<anonymous> (/home/leonardopetrucci/Desktop/wp-plugins/gutenberg/node_modules/node-pre-gyp/lib/util/compile.js:83:29)
node-pre-gyp ERR! stack     at ChildProcess.emit (events.js:321:20)
node-pre-gyp ERR! stack     at maybeClose (internal/child_process.js:1026:16)
node-pre-gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:286:5)
node-pre-gyp ERR! System
Linux 5.3.0-7629-generic
node-pre-gyp ERR! command "/usr/bin/node" "/home/leonardopetrucci/Desktop/wp-plugins/gutenberg/node_modules/.bin/node-pre-gyp" "install" "--fallback-to-build"
node-pre-gyp ERR! cwd /home/leonardopetrucci/Desktop/wp-plugins/gutenberg/node_modules/nodegit
node-pre-gyp ERR!
node -v v13.9.0
node-pre-gyp ERR! node-pre-gyp -v v0.13.0
node-pre-gyp ERR! not ok
Failed to execute '/usr/bin/node /usr/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js configure --fallback-to-build --module=/home/leonardopetrucci/Desktop/wp-plugins/gutenberg/node_modules/nodegit/build/Release/nodegit.node --module_name=nodegit --module_path=/home/leonardopetrucci/Desktop/wp-plugins/gutenberg/node_modules/nodegit/build/Release --napi_version=5 --node_abi_napi=napi --napi_build_version=0 --node_napi_label=node-v79' (1)
[nodegit] ERROR - Could not finish install
[nodegit] ERROR - finished with error code: 1
npm WARN @egoist/vue-to-react@1.1.0 requires a peer of vue@^2.6.10 but none is installed. You must install peer dependencies yourself.
npm WARN axe-puppeteer@1.1.0 requires a peer of puppeteer@^1.10.0 || ^2.0.0 but none is installed. You must install peer dependencies yourself.
npm WARN jest-puppeteer@4.4.0 requires a peer of puppeteer@>= 1.5.0 < 3 but none is installed. You must install peer dependencies yourself.
npm WARN enzyme-to-json@1.6.0 requires a peer of enzyme@^2.7.1 but none is installed. You must install peer dependencies yourself.
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@2.1.3 (node_modules/@jest/core/node_modules/fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@2.1.3: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@2.1.2 (node_modules/@jest/reporters/node_modules/fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@2.1.2: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@2.1.2 (node_modules/@jest/test-sequencer/node_modules/fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@2.1.2: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@2.1.2 (node_modules/babel-jest/node_modules/fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@2.1.2: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@2.1.2 (node_modules/jest-runtime/node_modules/fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@2.1.2: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@2.1.2 (node_modules/jest-runner/node_modules/fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@2.1.2: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@2.1.2 (node_modules/jest/node_modules/fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@2.1.2: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.2.9 (node_modules/fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.2.9: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})

npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! nodegit@0.26.2 install: `node lifecycleScripts/preinstall && node lifecycleScripts/install`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the nodegit@0.26.2 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!     /home/leonardopetrucci/.npm/_logs/2020-05-16T19_27_44_763Z-debug.log

I've noticed this bit in particular:

WARN Tried to download(404): https://axonodegit.s3.amazonaws.com/nodegit/nodegit/nodegit-v0.26.2-node-v79-linux-x64.tar.gz 
node-pre-gyp WARN Pre-built binaries not found for nodegit@0.26.2 and node@13.9.0 (node-v79 ABI, glibc) (falling back to source compile with node-gyp)
/bin/sh: 1: krb5-config: not found
gyp: Call to 'krb5-config gssapi --libs' returned exit status 127 while in binding.gyp. while trying to load binding.gyp
gyp

Which leads me to believe
A) There's no node-pre-gyp version for my Node version (13.9.0)
B) I'm missing krb5-config, which I'm not sure if I should install or not

I do have python installed by the way:

python
Python 2.7.17 (default, Nov  7 2019, 10:07:09) 
[GCC 9.2.1 20191008] on linux2

Is the problem related to my version of Node? Any way to fix it that won't require me to uninstall node entirely?

@gziolo gziolo added [Type] Build Tooling Issues or PRs related to build tooling Needs Testing Needs further testing to be confirmed. labels May 18, 2020
@watofundefined
Copy link

watofundefined commented Jun 26, 2020

Hey @creativiii,

I'm not sure what's your OS, but I had exactly the same problems on my Ubuntu 18.04.
I've got the same Python version, that wasn't the problem for me.
What helped me, was installing Kerberos (krb5) - sudo apt-get install libkrb5-dev.

I'm not an expert, but since I just finished troubleshooting the same/similar problem, I'll dump my notes here and maybe they'll help you or others.

------------------------------- Brain Dump Below -------------------------------

I think the problem is in the machine config or (less likely) upstream in node-gyp.
(Dependencies: gutenberg/packges/env -> nodegit -> node-pre-gyp -> node-gyp)

node-gyp is used for building C++ Node.js addons.

node-pre-gyp makes things easier for majority of users - if someone before you compiled sources for the given combination of OS, architecture (x86, x64,...) and Node.js version, then the binaries are only downloaded from the cloud.
If you're ther first one, then the sources need to be compiled and then they are uploaded for others.

So imho there are two potential sets of problems:

  • machine has problems loading pre-compiled binaries from the cloud
  • machine can't compile the sources

Try:

That still didn't help me so I tried to install bunch of things - the very last package libkrb5-dev (Kerberos) did the trick:

brew reinstall libgcrypt gcc
sudo apt-get install libssl-dev libcurl4-openssl-dev curl libcurl3 libgcrypt-dev libkrb5-dev

Hope it helps somone,
Cheers!

@danieliser
Copy link
Contributor

danieliser commented Aug 8, 2020

@watofundefined - Can confirm that I had the same issue, specifically with npm -g i @wordpress/env on a clean copy of Ubuntu 20.04 via Windows 10 WSL2.

sudo apt-get install libkrb5-dev resolved it for me and let the install complete as intended.

Once I closed and reopened terminal wp-env worked as expected.

@Tichael
Copy link

Tichael commented Nov 9, 2020

I can also confirm that installing libkrb5-dev worked.

I am running Ubuntu 20.04.1 LTS in WSL 2 (Windows Subsystem for Linux) and was struggling with the same problem. I had installed all the dependencies from the above packages (node-gyp, node-pre-gyp and nodegit) and I was starting to lose my mind. I think libkrb5-dev should be added as a dependencies so other people won't have to search for hours.

@mkaz
Copy link
Member

mkaz commented Nov 9, 2020

This was fixed in #26712 - the version of nodegit we were specifying was outdated and needed updated. Using the new version allows to pull pre-built binaries and no extra installs are needed.

Note: There is a side issue in #26660 to move off nodegit to simple-git that would further simplify this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Needs Testing Needs further testing to be confirmed. [Type] Build Tooling Issues or PRs related to build tooling
Projects
None yet
Development

No branches or pull requests

6 participants