Yarn: Yarn login does not ask for password and does not login

Created on 19 Sep 2018  路  4Comments  路  Source: yarnpkg/yarn

What is the current behavior?

$ yarn logout
yarn logout v1.9.4
success Cleared login credentials

$ yarn login
yarn login v1.9.4
question npm username: foobar
question npm email: [email protected]
Done in 6.35s.

$ yarn publish
[... prepublish output ...]
Done in 8.89s.
error Couldn't publish package: "https://registry.yarnpkg.com/packagename: You must be logged in to publish packages."

What is the expected behavior?

$ yarn login
yarn login v1.9.4
question npm username: foobar
question npm email: [email protected]
question npm password: *****
question otp: 123456
Done in 6.35s.

$ yarn publish
[... prepublish output ...]
Done in 8.89s.

Please mention your node.js, yarn and operating system version.
node: v10.7.0
yarn: 1.9.4
system: windows 10

triaged

Most helpful comment

Same bug when installing scoped packages.
Probably somehow related to #5216 and #4451.

$ yarn init

$ yarn login
yarn login v1.10.1
warning package.json: License should be a valid SPDX license expression
info npm username: ...
info npm email: ...
Done in 0.04s.

$ yarn --verbose add @nangu/hbbtv
yarn add v1.10.1
warning package.json: License should be a valid SPDX license expression
verbose 0.192 Checking for configuration file "/home/nost/projekty/bugs/rdm-408/.npmrc".
verbose 0.193 Checking for configuration file "/home/nost/.npmrc".
verbose 0.193 Checking for configuration file "/usr/etc/npmrc".
verbose 0.193 Checking for configuration file "/home/nost/projekty/bugs/rdm-408/.npmrc".
verbose 0.194 Checking for configuration file "/home/nost/projekty/bugs/.npmrc".
verbose 0.194 Checking for configuration file "/home/nost/projekty/.npmrc".
verbose 0.194 Checking for configuration file "/home/nost/.npmrc".
verbose 0.194 Checking for configuration file "/home/.npmrc".
verbose 0.195 Checking for configuration file "/home/nost/projekty/bugs/rdm-408/.yarnrc".
verbose 0.195 Found configuration file "/home/nost/projekty/bugs/rdm-408/.yarnrc".
verbose 0.195 Checking for configuration file "/home/nost/.yarnrc".
verbose 0.196 Found configuration file "/home/nost/.yarnrc".
verbose 0.196 Checking for configuration file "/usr/etc/yarnrc".
verbose 0.196 Checking for configuration file "/home/nost/projekty/bugs/rdm-408/.yarnrc".
verbose 0.196 Found configuration file "/home/nost/projekty/bugs/rdm-408/.yarnrc".
verbose 0.196 Checking for configuration file "/home/nost/projekty/bugs/.yarnrc".
verbose 0.196 Checking for configuration file "/home/nost/projekty/.yarnrc".
verbose 0.196 Checking for configuration file "/home/nost/.yarnrc".
verbose 0.197 Found configuration file "/home/nost/.yarnrc".
verbose 0.197 Checking for configuration file "/home/.yarnrc".
verbose 0.199 current time: 2018-10-19T08:34:17.451Z
info No lockfile found.
warning [email protected]: License should be a valid SPDX license expression
[1/4] Resolving packages...
verbose 0.292 Performing "GET" request to "https://registry.npmjs.org/@nangu%2fhbbtv".
verbose 2.093 Request "https://registry.npmjs.org/@nangu%2fhbbtv" finished with status code 404.
verbose 2.094 Error: https://registry.npmjs.org/@nangu%2fhbbtv: Not found
    at Request.params.callback [as _callback] (/usr/share/yarn/lib/cli.js:61073:18)
    at Request.self.callback (/usr/share/yarn/lib/cli.js:120166:22)
    at emitTwo (events.js:126:13)
    at Request.emit (events.js:214:7)
    at Request.<anonymous> (/usr/share/yarn/lib/cli.js:121138:10)
    at emitOne (events.js:116:13)
    at Request.emit (events.js:211:7)
    at IncomingMessage.<anonymous> (/usr/share/yarn/lib/cli.js:121060:12)
    at Object.onceWrapper (events.js:313:30)
    at emitNone (events.js:111:20)
error An unexpected error occurred: "https://registry.npmjs.org/@nangu%2fhbbtv: Not found".
info If you think this is a bug, please open a bug report with the information provided in "/home/nost/projekty/bugs/rdm-408/yarn-error.log".
info Visit https://yarnpkg.com/en/docs/cli/add for documentation about this command.
$ cat .yarnrc 
registry "https://registry.npmjs.org/"
$ cat yarn-error.log 
Arguments: 
  /usr/bin/node /usr/share/yarn/bin/yarn.js --verbose add @nangu/hbbtv

PATH: 
  /home/nost/.rvm/gems/ruby-2.4.0/bin:/home/nost/.rvm/gems/ruby-2.4.0@global/bin:/home/nost/.rvm/rubies/ruby-2.4.0/bin:/usr/share/Modules/bin:/usr/local/bin:/usr/local/sbin:/usr/bin:/usr/sbin:/home/nost/projekty/merge3po:/home/nost/.rvm/bin:/home/nost/WebStorm/bin:/home/nost/.local/bin:/home/nost/bin:/home/nost/projekty/merge3po:/home/nost/.rvm/bin:/home/nost/WebStorm/bin:/home/nost/.local/bin:/home/nost/bin

Yarn version: 
  1.10.1

Node version: 
  8.12.0

Platform: 
  linux x64

Trace: 
  Error: https://registry.npmjs.org/@nangu%2fhbbtv: Not found
      at Request.params.callback [as _callback] (/usr/share/yarn/lib/cli.js:61073:18)
      at Request.self.callback (/usr/share/yarn/lib/cli.js:120166:22)
      at emitTwo (events.js:126:13)
      at Request.emit (events.js:214:7)
      at Request.<anonymous> (/usr/share/yarn/lib/cli.js:121138:10)
      at emitOne (events.js:116:13)
      at Request.emit (events.js:211:7)
      at IncomingMessage.<anonymous> (/usr/share/yarn/lib/cli.js:121060:12)
      at Object.onceWrapper (events.js:313:30)
      at emitNone (events.js:111:20)

npm manifest: 
  {
    "name": "test",
    "version": "1.0.0",
    "description": "Test repo for installation of scoped package",
    "main": "index.js",
    "license": "PUBLIC",
    "dependencies": {
    }
  }

yarn manifest: 
  No manifest

Lockfile: 
  No lockfile

Workaround
Use npm login instead of yarn login, then yarn will use this token when registry URL matches.

All 4 comments

Same bug when installing scoped packages.
Probably somehow related to #5216 and #4451.

$ yarn init

$ yarn login
yarn login v1.10.1
warning package.json: License should be a valid SPDX license expression
info npm username: ...
info npm email: ...
Done in 0.04s.

$ yarn --verbose add @nangu/hbbtv
yarn add v1.10.1
warning package.json: License should be a valid SPDX license expression
verbose 0.192 Checking for configuration file "/home/nost/projekty/bugs/rdm-408/.npmrc".
verbose 0.193 Checking for configuration file "/home/nost/.npmrc".
verbose 0.193 Checking for configuration file "/usr/etc/npmrc".
verbose 0.193 Checking for configuration file "/home/nost/projekty/bugs/rdm-408/.npmrc".
verbose 0.194 Checking for configuration file "/home/nost/projekty/bugs/.npmrc".
verbose 0.194 Checking for configuration file "/home/nost/projekty/.npmrc".
verbose 0.194 Checking for configuration file "/home/nost/.npmrc".
verbose 0.194 Checking for configuration file "/home/.npmrc".
verbose 0.195 Checking for configuration file "/home/nost/projekty/bugs/rdm-408/.yarnrc".
verbose 0.195 Found configuration file "/home/nost/projekty/bugs/rdm-408/.yarnrc".
verbose 0.195 Checking for configuration file "/home/nost/.yarnrc".
verbose 0.196 Found configuration file "/home/nost/.yarnrc".
verbose 0.196 Checking for configuration file "/usr/etc/yarnrc".
verbose 0.196 Checking for configuration file "/home/nost/projekty/bugs/rdm-408/.yarnrc".
verbose 0.196 Found configuration file "/home/nost/projekty/bugs/rdm-408/.yarnrc".
verbose 0.196 Checking for configuration file "/home/nost/projekty/bugs/.yarnrc".
verbose 0.196 Checking for configuration file "/home/nost/projekty/.yarnrc".
verbose 0.196 Checking for configuration file "/home/nost/.yarnrc".
verbose 0.197 Found configuration file "/home/nost/.yarnrc".
verbose 0.197 Checking for configuration file "/home/.yarnrc".
verbose 0.199 current time: 2018-10-19T08:34:17.451Z
info No lockfile found.
warning [email protected]: License should be a valid SPDX license expression
[1/4] Resolving packages...
verbose 0.292 Performing "GET" request to "https://registry.npmjs.org/@nangu%2fhbbtv".
verbose 2.093 Request "https://registry.npmjs.org/@nangu%2fhbbtv" finished with status code 404.
verbose 2.094 Error: https://registry.npmjs.org/@nangu%2fhbbtv: Not found
    at Request.params.callback [as _callback] (/usr/share/yarn/lib/cli.js:61073:18)
    at Request.self.callback (/usr/share/yarn/lib/cli.js:120166:22)
    at emitTwo (events.js:126:13)
    at Request.emit (events.js:214:7)
    at Request.<anonymous> (/usr/share/yarn/lib/cli.js:121138:10)
    at emitOne (events.js:116:13)
    at Request.emit (events.js:211:7)
    at IncomingMessage.<anonymous> (/usr/share/yarn/lib/cli.js:121060:12)
    at Object.onceWrapper (events.js:313:30)
    at emitNone (events.js:111:20)
error An unexpected error occurred: "https://registry.npmjs.org/@nangu%2fhbbtv: Not found".
info If you think this is a bug, please open a bug report with the information provided in "/home/nost/projekty/bugs/rdm-408/yarn-error.log".
info Visit https://yarnpkg.com/en/docs/cli/add for documentation about this command.
$ cat .yarnrc 
registry "https://registry.npmjs.org/"
$ cat yarn-error.log 
Arguments: 
  /usr/bin/node /usr/share/yarn/bin/yarn.js --verbose add @nangu/hbbtv

PATH: 
  /home/nost/.rvm/gems/ruby-2.4.0/bin:/home/nost/.rvm/gems/ruby-2.4.0@global/bin:/home/nost/.rvm/rubies/ruby-2.4.0/bin:/usr/share/Modules/bin:/usr/local/bin:/usr/local/sbin:/usr/bin:/usr/sbin:/home/nost/projekty/merge3po:/home/nost/.rvm/bin:/home/nost/WebStorm/bin:/home/nost/.local/bin:/home/nost/bin:/home/nost/projekty/merge3po:/home/nost/.rvm/bin:/home/nost/WebStorm/bin:/home/nost/.local/bin:/home/nost/bin

Yarn version: 
  1.10.1

Node version: 
  8.12.0

Platform: 
  linux x64

Trace: 
  Error: https://registry.npmjs.org/@nangu%2fhbbtv: Not found
      at Request.params.callback [as _callback] (/usr/share/yarn/lib/cli.js:61073:18)
      at Request.self.callback (/usr/share/yarn/lib/cli.js:120166:22)
      at emitTwo (events.js:126:13)
      at Request.emit (events.js:214:7)
      at Request.<anonymous> (/usr/share/yarn/lib/cli.js:121138:10)
      at emitOne (events.js:116:13)
      at Request.emit (events.js:211:7)
      at IncomingMessage.<anonymous> (/usr/share/yarn/lib/cli.js:121060:12)
      at Object.onceWrapper (events.js:313:30)
      at emitNone (events.js:111:20)

npm manifest: 
  {
    "name": "test",
    "version": "1.0.0",
    "description": "Test repo for installation of scoped package",
    "main": "index.js",
    "license": "PUBLIC",
    "dependencies": {
    }
  }

yarn manifest: 
  No manifest

Lockfile: 
  No lockfile

Workaround
Use npm login instead of yarn login, then yarn will use this token when registry URL matches.

Workaround sadly does not work for us. We needed to change to npm again 馃槩

same here

yarn loginis not working. YOu have to use npm login instead. It looks like, yarn is not capable to create auth tokens!

You can check by using yarn config list you should have an auth token for you registry

Was this page helpful?
0 / 5 - 0 ratings