Yarn: Yarn missing python flag

Created on 29 May 2017  路  6Comments  路  Source: yarnpkg/yarn

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

What is the current behavior?
yarn add x --python=2.7 ignores the flag.

What is the expected behavior?
Yarn should use the specified version of python when building modules since npm does.
Yarn should also check the python flag set in the npm config for example running this command doesn't change the python version being used. npm config set python python2.7

Ref: https://github.com/trentm/node-bunyan/issues/216#issuecomment-304639731

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

cat-compatibility good first issue help wanted triaged

Most helpful comment

Seems like the environment variable approach is working for me. On my macOS I have:
export npm_config_python=/usr/bin/python while I meanwhile use python3 with pyenv.

Yarn install fails when I don't have the environment variable and works when I do. This seems consistent with https://github.com/nodejs/node-gyp/tree/05d2002258596a9693d6042d573c7fd20449ad23#configuration which says "node-gyp responds to environment variables or npm configuration".

If it's set right, you should see python when typing npm config list:
image

All 6 comments

Python is not a feature of Yarn, it is used by node-gyp.
You probably can pass python version via environment variables

Since it can be passed in npm it should work the same in yarn. Most users with issues ended up having to move back to npm just to get their deps installed and they really shouldn't have to rely on environment variables when there's a npm setting for this.

Any update????????

Seems like the environment variable approach is working for me. On my macOS I have:
export npm_config_python=/usr/bin/python while I meanwhile use python3 with pyenv.

Yarn install fails when I don't have the environment variable and works when I do. This seems consistent with https://github.com/nodejs/node-gyp/tree/05d2002258596a9693d6042d573c7fd20449ad23#configuration which says "node-gyp responds to environment variables or npm configuration".

If it's set right, you should see python when typing npm config list:
image

this is what i ended up doing npm config --global set python /usr/bin/python

Creating a .npmrc file in the project folder containing python = "/usr/bin/python2.7" works too.

Was this page helpful?
0 / 5 - 0 ratings