Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 675812 - net-libs/nodejs-10.15.0: yarn install for <package> does not see node-gyp in PATH
Summary: net-libs/nodejs-10.15.0: yarn install for <package> does not see node-gyp in ...
Status: RESOLVED WORKSFORME
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: Normal normal (vote)
Assignee: Jeroen Roovers (RETIRED)
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2019-01-18 20:32 UTC by Zac Medico
Modified: 2019-10-02 03:47 UTC (History)
0 users

See Also:
Package list:
Runtime testing required: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Zac Medico gentoo-dev 2019-01-18 20:32:12 UTC
With nodejs-10.15.0, when we run `yarn install` for a package at work, we see it unexpectedly install node-gyp:

>  [4/4] Building fresh packages...
> 
>  info This package requires node-gyp, which is not currently installed. Yarn will attempt to automatically install it. If this fails, you can run "yarn global add node-gyp" to manually install it.
> 
>  [1/4] Resolving packages...
> 
>  [2/4] Fetching packages...
> 
>  [3/4] Linking dependencies...
> 
>  [4/4] Building fresh packages...
> 
>  success Installed "node-gyp@3.8.0" with binaries:
> 
>  - node-gyp

The ebuild installs both /usr/lib64/node_modules/npm/node_modules/node-gyp and /usr/lib64/node_modules/npm/node_modules/node-gyp directories.

If I export PATH=/usr/lib64/node_modules/npm/bin/node-gyp-bin:$PATH then yarn sees /usr/lib64/node_modules/npm/bin/node-gyp-bin/node-gyp and uses it instead of installing it.

We did not notice this issue with nodejs-8.14.0, though I see that it also installs similar /usr/lib64/node_modules/npm/node_modules/node-gyp and /usr/lib64/node_modules/npm/node_modules/node-gyp directories.
Comment 1 Jeroen Roovers (RETIRED) gentoo-dev 2019-01-19 11:58:30 UTC
(In reply to Zac Medico from comment #0)
> With nodejs-10.15.0, when we run `yarn install`

Like sys-apps/yarn, or is that irrelevant in this context?

> The ebuild installs both
> /usr/lib64/node_modules/npm/node_modules/node-gyp
> and
> /usr/lib64/node_modules/npm/node_modules/node-gyp directories.

I think you meant to point out two different directories.
Comment 2 Zac Medico gentoo-dev 2019-01-20 03:42:50 UTC
(In reply to Jeroen Roovers from comment #1)
> (In reply to Zac Medico from comment #0)
> > With nodejs-10.15.0, when we run `yarn install`
> 
> Like sys-apps/yarn, or is that irrelevant in this context?

Yes, we're currently using sys-apps/yarn-1.13.0 with nodejs-10.15.0, and it works fine as long as we add /usr/lib64/node_modules/npm/bin/node-gyp-bin to PATH. We didn't have to make any PATH adjustment when we were using sys-apps/yarn-1.12.3 with nodejs-8.14.0.

> > The ebuild installs both
> > /usr/lib64/node_modules/npm/node_modules/node-gyp
> > and
> > /usr/lib64/node_modules/npm/node_modules/node-gyp directories.
> 
> I think you meant to point out two different directories.

Yes, the other directory is /usr/lib64/node_modules/npm/bin/node-gyp-bin, which contains a node-gyp binary that works perfectly well as long as we add the directory to PATH.
Comment 3 Zac Medico gentoo-dev 2019-10-02 03:40:59 UTC
I think maybe this behavior could actually be intentional, based on what I've read here:

https://github.com/nodejs/node-addon-examples/blob/master/1_hello_world/README.md#step-5

> Compile your addon: if you don't have node-gyp installed, use
> sudo npm install node-gyp -g to install it. It comes bundled
> with npm but is not normally linked as an executable in your
> PATH so it's best to install it separately.