Yarn: node-gyp builds fail on bundled yarn

Created on 15 Dec 2016  ยท  10Comments  ยท  Source: yarnpkg/yarn

Do you want to request a feature or report a bug?
Bug

What is the current behavior?

bestander-mbp:bignum bestander$ node ~/work/yarn/artifacts/yarn-0.17.10.js add base85
yarn add v0.17.10
info No lockfile found.
[1/4] ๐Ÿ”  Resolving packages...
[2/4] ๐Ÿšš  Fetching packages...
[3/4] ๐Ÿ”—  Linking dependencies...
[4/4] ๐Ÿ“ƒ  Building fresh packages...
โ 
โ 
โ 
โ 
error /Users/bestander/work/temp/bignum/node_modules/bignum: Command failed.
Exit code: 127
Command: sh
Arguments: -c node-gyp configure build
Directory: /Users/bestander/work/temp/bignum/node_modules/bignum
Output:
sh: node-gyp: command not found
info Visit https://yarnpkg.com/en/docs/cli/add for documentation about this command.

Please mention your node.js, yarn and operating system version.

Node 6.9.1, Yarn 0.17.10

cat-bug

Most helpful comment

Based on https://github.com/nodejs/docker-node/issues/346, it sounds like running yarn global add node-gyp is a viable workaround for now. Running that before doing yarn install should fix the issue.

Paging @Daniel15 since he seems like a cool guy ;)

๐Ÿ˜Š

All 10 comments

Reason - we use path.join(__dirname, '..', '..', 'bin', 'node-gyp-bin')) in source.
When everything is bundled in one file __dirname is incorrect.

  • needed tests to prevent from __dirname breaking bundled builds later

This is currently causing issues for our build, anything I can do to assist?

Our build has been broken since docker started including this and we stopped running npm install -g yarn. I understand that it is not recommended, but at least it actually worked.

Paging @Daniel15 since he seems like a cool guy ;)

Thanks the team is in the loop, we'll figure something out

Cool, just wanted to make sure. We have a workaround in place, but it was pretty bad/interesting/weird/fun to have our build and dev workflow break when it wasn't our fault.

Based on https://github.com/nodejs/docker-node/issues/346, it sounds like running yarn global add node-gyp is a viable workaround for now. Running that before doing yarn install should fix the issue.

Paging @Daniel15 since he seems like a cool guy ;)

๐Ÿ˜Š

 RUN rm -rf node_modules/

+# This line should be removed when the included version of yarn in the container
+# is no longer broken https://github.com/yarnpkg/yarn/issues/2266
+RUN yarn global add node-gyp
+
 RUN yarn

:wink:

The bundled build could include a small bootstrap section that would do yarn global add node-gyp and also generate node-gyp-bin folder.
If node-gyp is not in the PATH

Oh, and as always, this could be a cool contribution to send a PR for!

Was this page helpful?
0 / 5 - 0 ratings