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

fallback to npm config if it exists after getting default yarn config value #871

Merged
merged 1 commit into from
Oct 12, 2016

Conversation

sebmck
Copy link
Contributor

@sebmck sebmck commented Oct 12, 2016

No description provided.

@kyeotic
Copy link

kyeotic commented Oct 12, 2016

Is there a way to tell when this has been released?


// if we have no yarn option for this or have used a default then use the npm
// value if it exists
if (!val || val === DEFAULTS[key]) {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

With this code, if the value is the same as the default, it will favor the npm config even if the user explicitly set it. Shouldn't an explicit setting still take precedence over the npm config value?

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also, we might want to check if it's undefined instead of just falsy, since the user could also explicitly specify a falsy value.

@evil-shrike
Copy link

I'm afraid it's still not working - I'm trying to install a scoped package with a scope registered in my global .npmrc. It doesn't work.
You'd better not to close #606 - it's still actual.

@ysangkok
Copy link

@evil-shrike That issue was closed. Can you provide a more detailed example? Maybe it is a different issue.

@FezVrasta
Copy link

I was using .yarnrc to workaround the problem, but today I noticed the content of .yarnrc has been replaced with:

# THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY.
# yarn lockfile v1


lastUpdateCheck 1488992854257

So, now, where do I put my config if Yarn doesn't read from .npmrc?

@floatdrop
Copy link

@kittens any update on this? Seems logical to read configs from .npmrc, if they are available.

@thescientist13
Copy link

also curious when the version with this fix (looks to be 0.24.2) will get released / published to NPM?

@sarbbottam
Copy link

Is there any update when this fix will get rolled out? I can still find the issue with 0.24.4.

@bchoddny
Copy link

I've got 0.24.5, this issue seem to persist.

@forelabs
Copy link

@bchoddny @sarbbottam have a look if you have this issue with the fallback: #3920
this was the issue we had to struggle with.

@olleicua
Copy link

I'm experiencing this in 1.3.2

$ yarn publish
warning package.json: No license field
warning package.json: No license field
[1/4] Bumping version...
question New version: 0.1.0
[2/4] Logging in...
question npm username: USERNAME
question npm email: [email protected]
question npm password:
success Logged in.
error Couldn't publish package.
info Visit https://yarnpkg.com/en/docs/cli/publish for documentation about this command.

npm publish works though

@euaaron
Copy link

euaaron commented Mar 13, 2023

I'm trying to add a package from a scoped registry that asks for password, username and email. I am able to do this using NPM by setting this up to .npmrc, but I can't find a way to do this with YARN by adding the same config from to .yarnrc.

While searching for solution, I've found issue #606 and also this issue from 2016.
I guess after about 7 years that this feature might be already incorporated to Yarn, right?

If so, could anyone tell me if this is working and what is the right semantic?

This is what I've added to .yarnrc:

registry "https://registry.yarnpkg.com"
"@company:registry" "http://company.domain.com/artifactory/api/npm/packages/"
"//company.domain.com/artifactory/api/npm/packages/:_password" "passwordHASH"
"//company.domain.com/artifactory/api/npm/packages/:username" "me"
"//company.domain.com/artifactory/api/npm/packages/:email" "[email protected]"
"//company.domain.com/artifactory/api/npm/packages/:always-auth" "true"

It understand the scoped registry but it fails to download the package due to not finding any credentials.

I also have a working .npmrc with the same value but using NPM semantic.

Yarn is not reading auth values from either .npmrc or .yarnrc.

Even though I can install with NPM, I prefer to use only Yarn, and not having a .yarn.lock and a package-lock.json in the same project.

@weivegywei
Copy link

weivegywei commented Apr 2, 2024

We tried putting the following in .yarnrc.yml
npmScope: 'company': npmAlwaysAuth: true npmAuthToken: 'YOUR_PERSONAL_ACCESS_TOKEN' npmRegistryServer: https//registry.com
yarn add works

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

Successfully merging this pull request may close these issues.