mapbox / mapbox/node-pre-gyp

node-gyp failure with npm 5.8.0

Open
#362 7 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
JavaScript
Stars
1.2k
Forks
271
Avg merge
23h 40m
Merged PRs (30d)
2

Description

node-pre-gyp fails in the node-gyp step with the following error (example using the vtquery module):

```
Error: Failed to execute 'node-gyp configure ...
```

Stack trace
```
V=1 ./node_modules/.bin/node-pre-gyp configure build --error_on_warnings=true --loglevel=error
NPM BASE /Users/mapsam/.nvm/versions/node/v6.13.0/lib/node_modules/npm/
NPM GYP BIN /Users/mapsam/.nvm/versions/node/v6.13.0/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js
node-pre-gyp ERR! configure error
node-pre-gyp ERR! stack Error: Failed to execute 'node-gyp configure --error_on_warnings=true --loglevel=error --module=/Users/mapsam/mapbox/vtquery/lib/binding/vtquery.node --module_name=vtquery --module_path=/Users/mapsam/mapbox/vtquery/lib/binding' (Error: spawn node-gyp ENOENT)
node-pre-gyp ERR! stack at ChildProcess. (/Users/mapsam/mapbox/vtquery/node_modules/node-pre-gyp/lib/util/compile.js:80:29)
node-pre-gyp ERR! stack at emitOne (events.js:96:13)
node-pre-gyp ERR! stack at ChildProcess.emit (events.js:188:7)
node-pre-gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:217:12)
node-pre-gyp ERR! stack at onErrorNT (internal/child_process.js:376:16)
node-pre-gyp ERR! stack at _combinedTickCallback (internal/process/next_tick.js:80:11)
node-pre-gyp ERR! stack at process._tickCallback (internal/process/next_tick.js:104:9)
node-pre-gyp ERR! stack at Module.runMain (module.js:613:11)
node-pre-gyp ERR! stack at run (bootstrap_node.js:387:7)
node-pre-gyp ERR! stack at startup (bootstrap_node.js:153:9)
node-pre-gyp ERR! System Darwin 17.4.0
node-pre-gyp ERR! command "/Users/mapsam/.nvm/versions/node/v6.13.0/bin/node" "/Users/mapsam/mapbox/vtquery/node_modules/.bin/node-pre-gyp" "configure" "build" "--error_on_warnings=true" "--loglevel=error"
node-pre-gyp ERR! cwd /Users/mapsam/mapbox/vtquery
node-pre-gyp ERR! node -v v6.13.0
node-pre-gyp ERR! node-pre-gyp -v v0.6.39
node-pre-gyp ERR! not ok
Failed to execute 'node-gyp configure --error_on_warnings=true --loglevel=error --module=/Users/mapsam/mapbox/vtquery/lib/binding/vtquery.node --module_name=vtquery --module_path=/Users/mapsam/mapbox/vtquery/lib/binding' (Error: spawn node-gyp ENOENT)
```

* node version: v6.13.0
* npm version: 5.8.0

It appears this is an issue with the most recent npm release, version 5.8.0, which was released on 03/08/2018 and removed the node-gyp module unexpectedly. https://github.com/npm/npm/issues/20163. The following path is [created in node-pre-gyp](https://github.com/mapbox/node-pre-gyp/blob/cf559670e6a59768437bd35229cdd06988e4748e/lib/util/compile.js#L48-L51) with the assumption that node-gyp exists in npm.

```
/Users/mapsam/.nvm/versions/node/v6.13.0/lib/node_modules/npm/node_modules/node-gyp/bin/
```

We'll continue to monitor over there to learn whether we need a fix here or if we can just update to a future version.

cc @springmeyer @millzpaugh

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with lib/util/compile.js at the linked lines and compare its node-gyp path assumption with the npm issue linked in the report. Reproduce the failure with Node v6.13.0 and npm 5.8.0, then determine whether node-pre-gyp needs a fix or whether an upstream npm release resolves it.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, node.js
Domain
build-system, tooling
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
28/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.