Skip to content
This repository was archived by the owner on Aug 11, 2022. It is now read-only.

Change npm_config_node_gyp to use shell script on Windows #14568

Closed
wants to merge 1 commit into from

Conversation

ghostoy
Copy link

@ghostoy ghostoy commented Nov 9, 2016

On non-Windows platforms, custom node-gyp can be used by npm by
export npm_config_node_gyp=$(which node-gyp). But on Windows,
the implementation expected the real js script of node-gyp rather
than the shell script. So you have to set the environment to
path\to\global\node_modules\node-gyp\bin\node-gyp.js. This patch
changed the launch script of node-gyp by invoking the script set
to npm_config_node_gyp directly instead of invoking as node script.

Fixed #14543

On non-Windows platforms, custom node-gyp can be used by npm by
`export npm_config_node_gyp=$(which node-gyp)`. But on Windows,
the implementation expected the real js script of node-gyp rather
than the shell script. So you have to set the environment to
`path\to\global\node_modules\node-gyp\bin\node-gyp.js`. This patch
changed the launch script of node-gyp by invoking the script set
to `npm_config_node_gyp` directly instead of invoking as node script.

Fixed npm#14543
@legodude17
Copy link
Contributor

I think this should be discussed, because people might want to use the node-gyp.js. Also, this is a breaking change. Your thoughts @kenany?

@kenany
Copy link
Contributor

kenany commented Nov 9, 2016

Not familiar with this. I'll leave it to @othiym23 :)

@othiym23
Copy link
Contributor

See #8324 (and also 9bcf573) for details around the last time we changed this – this points to a couple holes around npm's Windows behavior and testing:

  1. There are people out there, apparently, using node-gyp.js on their Windows systems, enough that they wanted to change 145af65, which invoked node-gyp in a manner identical to the one in this patch. That makes this a breaking change, and also one where different groups have conflicting goals.
  2. The CLI has no tests around how it uses node-gyp, which makes it tough to make changes around how node-gyp is invoked and have any confidence that something isn't going to break in users' production environments. (Hence the needs-tests added to the PR.)

Since #8324 exists, and now this PR also exists, we need to come to a consensus about what the actual desired behavior is. @zkat suggested adding an additional configuration parameter to choose whether to invoke node-gyp directly or to call it via node; I'm not wildly enthusiastic about the idea, because it sort of sweeps the underlying conflict under the rug, but if it turns out that both use cases have passionate advocates, it may be the best solution.

Either way, this is something where the change is small but the additional testing and validation that we're making the right change is large. Sorry for dumping a bunch of extra work in your lap to get this change landed, but thanks for the time you've put into it thus far!

@zkat zkat mentioned this pull request Apr 4, 2017
24 tasks
@iarna
Copy link
Contributor

iarna commented Aug 12, 2017

This still needs tests and as it's been over six months, I'm going to close this. If you do come back to work on it, please feel free to open a new pull request.

@iarna iarna closed this Aug 12, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants