Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Yarn config is empty when run from within an npm script #3922

Closed
Waldo000000 opened this issue Jul 13, 2017 · 4 comments
Closed

Yarn config is empty when run from within an npm script #3922

Waldo000000 opened this issue Jul 13, 2017 · 4 comments
Assignees
Labels

Comments

@Waldo000000
Copy link

Waldo000000 commented Jul 13, 2017

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

Bug

What is the current behavior?

The output of yarn config is empty if run from within a yarn script.

If the current behavior is a bug, please provide the steps to reproduce.

  1. Create an empty project with a script in package.json:
"scripts": {
    "debug": "yarn config list"
}
  1. Run the script with yarn run debug.

What is the expected behavior?

Expect yarn run debug to produce the same output as npm run debug or yarn config list.

Please mention your node.js, yarn and operating system version.
node.js v6.11.0
yarn v0.27.5
OS Ubuntu 16.04

Seems this was introduced sometime between v0.24.5 and v0.27.5. We were using this behavior as part of a docker build script that would internally grab an NPM authorization token (from yarn config) to provide it to the docker container being built. Would be nice to see the regression fixed, to bring this back into line with npm's behavior.

@xdumaine
Copy link

This causes authentication errors when install is in a script, if you have private repositories. Example:

"scripts": {
    "startup": "yarn install --pure-lockfile && bower install && ember s"
}

@shousper
Copy link

Confirmed issue still present in 1.0.1.

@BYK BYK added the cat-bug label Sep 12, 2017
@BYK BYK self-assigned this Sep 12, 2017
@BYK
Copy link
Member

BYK commented Sep 12, 2017

Thanks for the report! This is because scripts are run with YARN_SILENT=1 and yarn config list doesn't output anything in silent mode.

Will submit a PR to fix this.

BYK added a commit that referenced this issue Sep 12, 2017
**Summary**

Fixes #3922. Certain commands in yarn should always produce an
output, regardless of the silent status. This makes
`reporter.inspect` for console reporter to always produce an
output. It also forces the output of `yarn config get` to override
silent mode.

**Test plan**

Should add integration tests.
@BYK BYK closed this as completed in #4419 Sep 12, 2017
BYK added a commit that referenced this issue Sep 12, 2017
…4419)

**Summary**

Fixes #3922. Certain commands in yarn should always produce an
output, regardless of the silent status. This makes
`reporter.inspect` for console reporter to always produce an
output. It also forces the output of `yarn config get` to override
silent mode.

**Test plan**

Should add integration tests.
@shousper
Copy link

😄 Thanks @BYK

joaolucasl pushed a commit to joaolucasl/yarn that referenced this issue Oct 27, 2017
…arnpkg#4419)

**Summary**

Fixes yarnpkg#3922. Certain commands in yarn should always produce an
output, regardless of the silent status. This makes
`reporter.inspect` for console reporter to always produce an
output. It also forces the output of `yarn config get` to override
silent mode.

**Test plan**

Should add integration tests.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants