<p>yarn์€ .npmrc์˜ ์ธ์ฆ ์„ค์ •์„ ๋”ฐ๋ฅด์ง€ ์•Š์Šต๋‹ˆ๋‹ค.</p>

์— ๋งŒ๋“  2017๋…„ 09์›” 14์ผ  ยท  86์ฝ”๋ฉ˜ํŠธ  ยท  ์ถœ์ฒ˜: yarnpkg/yarn

๊ธฐ๋Šฅ ์„ ์š”์ฒญํ•˜๊ฑฐ๋‚˜ ๋ฒ„๊ทธ๋ฅผ๋ณด๊ณ  ํ•˜์‹œ๊ฒ ์Šต๋‹ˆ๊นŒ?
๊ณค์ถฉ
ํ˜„์žฌ ํ–‰๋™์€ ๋ฌด์—‡์ž…๋‹ˆ๊นŒ?
์› ์‚ฌ๋Š” .npmrc๋ฅผ ์กด์ค‘ํ•˜์ง€ ์•Š์Šต๋‹ˆ๋‹ค.
ํ˜„์žฌ ๋™์ž‘์ด ๋ฒ„๊ทธ ์ธ ๊ฒฝ์šฐ ์žฌํ˜„ ๋‹จ๊ณ„๋ฅผ ์ œ๊ณตํ•˜์‹ญ์‹œ์˜ค.
๋ฆฌํฌ์ง€ํ† ๋ฆฌ ์ค‘ ํ•˜๋‚˜์— ๋Œ€ํ•œ ์ธ์ฆ์ด ํ•„์š”ํ•˜๋ฉฐ .npmrc์— ์ธ์ฆ์„ ์ง€์ •ํ•˜์—ฌ์ด๋ฅผ ์ˆ˜ํ–‰ํ–ˆ์Šต๋‹ˆ๋‹ค. ์ด๊ฒƒ์€ 0.28.4๊นŒ์ง€ ์ž‘๋™ํ–ˆ์ง€๋งŒ 1.0.0์—์„œ ๊นจ์กŒ์Šต๋‹ˆ๋‹ค.

์˜ˆ์ƒ๋˜๋Š” ๋™์ž‘์€ ๋ฌด์—‡์ž…๋‹ˆ๊นŒ?
.npmrc์˜ ์ธ์ฆ ์„ค์ • ์ค€์ˆ˜

node.js, yarn ๋ฐ ์šด์˜ ์ฒด์ œ ๋ฒ„์ „์„ ์–ธ๊ธ‰ํ•˜์‹ญ์‹œ์˜ค.
yarn์„ 1.0.0 / 1.0.1๋กœ ์—…๊ทธ๋ ˆ์ด๋“œ ํ•œ ํ›„์— ๋ฐœ์ƒํ•ฉ๋‹ˆ๋‹ค (๋‘ ๋ฒ„์ „์„ ๋ชจ๋‘ ์‹œ๋„). OS ๋ฐ nodejs ๋ฒ„์ „์— ๊ด€๊ณ„์—†์ด.

cat-bug help wanted

๊ฐ€์žฅ ์œ ์šฉํ•œ ๋Œ“๊ธ€

์ด๋Š” 2017 ๋…„์—๋ณด๊ณ ๋˜์—ˆ์œผ๋ฉฐ ํ˜„์žฌ 2019 ๋…„์ด๋ฉฐ์ด ๋ฌธ์ œ๋Š” ์—ฌ์ „ํžˆ ์กด์žฌํ•ฉ๋‹ˆ๋‹ค.

๋ชจ๋“  86 ๋Œ“๊ธ€

์ด๊ฒƒ์€ ์–ด์ œ ๋ฆด๋ฆฌ์Šค ๋œ 1.0.2์—์„œ ์ˆ˜์ •๋˜์–ด์•ผํ•ฉ๋‹ˆ๋‹ค. ์Šคํ•€์„ ์ค„ ์ˆ˜ ์žˆ์Šต๋‹ˆ๊นŒ?

@BYK ๋‚˜๋Š” ์œ„์™€ ๊ฐ™์€ ๋ฌธ์ œ๋ฅผ ๊ฒช๊ณ  ์žˆ์œผ๋ฉฐ # 4157์˜ ๋์— ์–ธ๊ธ‰ํ–ˆ์Šต๋‹ˆ๋‹ค. 1.0.2 ์‹คํ–‰์„ ์‹œ๋„ํ–ˆ์ง€๋งŒ 404 ์‹คํŒจํ–ˆ์Šต๋‹ˆ๋‹ค. 0.27.5 ์—์„œ ์‹คํ–‰ํ•˜๋ฉด ์˜ˆ์ƒ๋Œ€๋กœ ์ž‘๋™ํ•ฉ๋‹ˆ๋‹ค.

๋ณต์ œ๋ฅผ ์‹œ๋„ ํ•  ์ˆ˜ ์žˆ๋„๋ก ์—ฌ๊ธฐ์— npmrc ํŒŒ์ผ์„ ๋ถ™์—ฌ ๋„ฃ์„ ์ˆ˜ ์žˆ์Šต๋‹ˆ๊นŒ (๋ถ„๋ช…ํžˆ ๋น„๋ฐ€ ๋˜๋Š” ๊ธฐํƒ€ ๊ฐœ์ธ ์ •๋ณด๋ฅผ ํŽธ์ง‘)

@KidkArolis ๋‚ด ์ž‘์—… ๋””๋ ‰ํ† ๋ฆฌ๋ฅผ ๊ฐ€๋Šฅํ•œ ํ•œ ๊นจ๋—ํ•˜๊ฒŒ ์–ป์œผ๋ ค๊ณ  ์‹œ๋„ํ•˜๋Š” ๋™์•ˆ ์–ด๋–ป๊ฒŒ ๋“  ๋ฌธ์ œ๊ฐ€ ํ•ด๊ฒฐ ๋˜์—ˆ์Šต๋‹ˆ๊นŒ? ๐Ÿ™ƒ

๋‚ด๊ฐ€ ์ทจํ•œ ๋‹จ๊ณ„ :

  • yarn.lock ๋ฐ ๋ชจ๋“  yarn-error.log ํŒŒ์ผ ์‚ญ์ œ
  • node_modules/ ์‚ญ์ œ
  • brew link yarn ๋ฐ yarn --version ๋กœ 1.0.2
  • yarn

ํšจ๊ณผ๊ฐ€์žˆ๋Š” ๊ฒƒ ๊ฐ™์Šต๋‹ˆ๋‹ค. ์ €๋Š” ์ด๊ฒƒ์„ ์ €์™€ ์ œ ํŒ€์˜ ์‚ฌ์šฉ์ž ์˜ค๋ฅ˜๋กœ ๋ถ„๋ฅ˜ ํ•  ๊ฒƒ์ž…๋‹ˆ๋‹ค.

@beardedtim ๋ฌด์—‡์— ๋Œ€ํ•ด ๋‹น์‹ ์€ ์ง€๊ธˆ ๋‚ ๋ ค ๊ฒฝ์šฐ node_modules ํ•˜์ง€๋งŒ, ๊ณ„์† yarn.lock ๋‹ค์Œ ์‹คํ–‰ yarn install ? ๊ทธ๋Ÿฌ๋ฉด ๋ชจ๋‘ ์ž‘๋™ํ•ฉ๋‹ˆ๊นŒ? ์ด๊ฒƒ์€ ๋ถ€๋ถ„์ ์œผ๋กœ # 4157 ํŠธ๋ž™์ด์ง€๋งŒ ๋” ํฐ ๋ฌธ์ œ์™€ ๊ด€๋ จ์ด์žˆ์„ ์ˆ˜ ์žˆ์Šต๋‹ˆ๊นŒ?

์›์‚ฌ ๋ฒ„์ „ 1.0.1 ๋ฐ 1.0.2์— ๋Œ€ํ•ด์ด ๋ฌธ์ œ (๋‚ด๊ฐ€ ์‚ฌ์šฉํ•˜๋Š” ๋ ˆ์ง€์ŠคํŠธ๋ฆฌ์— ๊ด€๊ณ„์—†์ด ๊ฐœ์ธ ๋ฒ”์œ„ ์ €์žฅ์†Œ์˜ 404)๊ฐ€ ๋ฐœ์ƒํ•ฉ๋‹ˆ๋‹ค. ๋ฒ„์ „ 0.27.5๋Š” ์ผ๋ถ€ ์•„ํ‹ฐํŒฉํŠธ๋ฅผ ์ง€์šด ํ›„์— ์ž‘๋™ํ–ˆ์Šต๋‹ˆ๋‹ค.

https://github.com/yarnpkg/yarn/issues/4157 ์—์„œ ๋…ผ์˜ ๋œ ๋ชจ๋“  ํ•ด๊ฒฐ ๋ฐฉ๋ฒ•์„ ์‹œ๋„ํ–ˆ์Šต๋‹ˆ๋‹ค

@stieg ์˜ค๋Š˜ ๋Šฆ๊ฒŒ ์ ์‹ฌ ์‹œ๊ฐ„์— ๋ฌด๋ฃŒ ์‹œ๊ฐ„์„ ์–ป๊ณ  ๊ฒฐ๊ณผ๋ฅผ ๊ฒŒ์‹œ ํ•  ๋•Œ ์‹œ๋„ํ•ด

๋ˆ„๊ตฌ๋“ ์ง€ ์ด๊ฒƒ์— ๋Œ€ํ•œ ํ•ด๊ฒฐ์ฑ…์„ ์ฐพ์•˜์Šต๋‹ˆ๊นŒ?

FWIW : ๋‹ค์Œ๊ณผ ๊ฐ™์ด ์‹œ๋„ํ–ˆ์Šต๋‹ˆ๋‹ค.

  • ๋‚ด node_modules ์ดˆ๊ธฐํ™”
  • ~/.yarn ์ดˆ๊ธฐํ™”
  • curl -o- -L https://yarnpkg.com/install.sh | bash -yarn 1.0.2 ์žฌ์„ค์น˜
  • yarn install -_ ์˜ค๋ฅ˜ ์—†์Œ _, ๋ชจ๋“  ๊ฒƒ์„ ์™„๋ฒฝํ•˜๊ฒŒ ์„ค์น˜ํ–ˆ์Šต๋‹ˆ๋‹ค.

๋‚ด ~/.yarnrc :

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


registry "https://registry.npmjs.org"
email [email protected]
lastUpdateCheck 1505977814820
username some-user
````

And my `~/.npmrc`:

//registry.npmjs.org/:_authToken=a-valid-uuid

The `yarn.lock` references look like this in my particular case:

" https://registry.npmjs.org/@acme/some -module /-/ some-module-0.1.1.tgz # valid-git-sha"ํ•ด๊ฒฐ๋จ
```

ํฅ๋ฏธ ๋กญ๊ตฐ. .yarnrc ํŒŒ์ผ์— ๋ ˆ์ง€์ŠคํŠธ๋ฆฌ๋ฅผ ๋„ฃ์€ ํ›„ ํŒจํ‚ค์ง€๋ฅผ ์„ค์น˜ํ•  ์ˆ˜์žˆ์—ˆ์Šต๋‹ˆ๋‹ค. ๊ทธ๋Ÿฌ๋‚˜ ๊ทธ๊ฒƒ์ด ๋ฒ”์ธ์ธ์ง€ ํ™•์ธํ•˜๊ธฐ ์œ„ํ•ด ์ œ๊ฑฐํ–ˆ์ง€๋งŒ ์—ฌ์ „ํžˆ ์„ฑ๊ณตํ–ˆ์Šต๋‹ˆ๋‹ค (Yarn์ด ๊ทธ๊ฒƒ์„ ๋‹ค์šด๋กœ๋“œํ•ด์•ผํ–ˆ๊ธฐ ๋•Œ๋ฌธ์— ์บ์‹œ๋ฅผ ์‚ญ์ œํ–ˆ์œผ๋ฉฐ ์˜ฌ๋ฐ”๋ฅด๊ฒŒ ์ˆ˜ํ–‰ํ–ˆ์Šต๋‹ˆ๋‹ค).

์ƒˆ๋กœ ์„ค์น˜ (์ด๋ฒˆ์—๋Š” ๋ฐ๋น„์•ˆ, ๋‹ค๋ฅธ ํ•˜๋‚˜๋Š” macOS)๋ฅผ ์‹œ๋„ํ–ˆ๊ณ  ~/.npmrc ๋ฐ ~/.yarnrc ์—์„œ ์ด๋Ÿฌํ•œ ์„ค์ •์ด ๋˜‘๊ฐ™์ด ์ž˜ ์ž‘๋™ํ–ˆ์Šต๋‹ˆ๋‹ค. (์ฐธ๊ณ  : npm login ๋˜๋Š” yarn login ์‹œ๋„ํ•˜์ง€ ์•Š์•˜์Šต๋‹ˆ๋‹ค.)

์ด ๋ฌธ์ œ๋ฅผ๋ณด๊ณ ํ•˜๋Š” ์‚ฌ๋žŒ๋“ค์ด ํ•ด๊ฒฐ๋จ์— ๋”ฐ๋ผ ๋‹ซํž™๋‹ˆ๋‹ค. @carlosduclos๊ฐ€ ํ•ด๊ฒฐ๋˜์ง€ ์•Š์œผ๋ฉด ๊ตฌ์ฒด์ ์ธ ์žฌํ˜„ ๋‹จ๊ณ„๋กœ ๋‹ค์‹œ ์—ฝ๋‹ˆ ๋‹ค.

@BYK ๋‚˜๋Š” ๊ฐ™์€ ๋ฌธ์ œ๊ฐ€ ์žˆ์—ˆ๋‹ค.
์ตœ์‹  ์›์‚ฌ ๋ฒ„์ „์˜ ์ƒˆ๋กœ ์„ค์น˜๋ฅผ ์‚ฌ์šฉํ–ˆ์Šต๋‹ˆ๋‹ค.
๊ทธ๋ฆฌ๊ณ  ~/.yarnrc ์— registry "https://registry.npmjs.org" ์„ ์ถ”๊ฐ€ํ•˜๋ฉด ์ž‘๋™ํ•˜๊ธฐ ์‹œ์ž‘ํ•ฉ๋‹ˆ๋‹ค.
๋ฒ„๊ทธ๋ผ๊ณ  ์ƒ๊ฐํ•˜๋ฉฐ ์ˆ˜๋™์ด ์•„๋‹ˆ๋ผ ์ž๋™์œผ๋กœ ํ•ด๊ฒฐํ•ด์•ผํ•ฉ๋‹ˆ๋‹ค.

@BYK "ํ•ด๊ฒฐ ๋œ ๊ฒƒ์œผ๋กœ๋ณด๊ณ "ํ•œ ๋ชจ๋“  ์‚ฌ๋žŒ์ด yarn์ด https://registry.npmjs.org ๋ ˆ์ง€์ŠคํŠธ๋ฆฌ๋ฅผ ์‚ฌ์šฉํ•˜๋„๋ก ๊ฐ•์ œํ•˜๋Š” ํ•ด๊ฒฐ ๋ฐฉ๋ฒ•์„ ์‚ฌ์šฉํ–ˆ๋‹ค๋Š” ์ ์„ ์•Œ์•„ ๋‘๋ฉด ๋„์›€์ด ๋  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.

https://registry.yarnpkg.com ๋ ˆ์ง€์ŠคํŠธ๋ฆฌ์—์„œ ๊ฐœ์ธ ํŒจํ‚ค์ง€๋ฅผ ๊ฒ€์ƒ‰ํ•˜๋Š” ๋ฐ ์—ฌ์ „ํžˆ ๋ฌธ์ œ๊ฐ€ ์žˆ๋‹ค๊ณ  ์ƒ๊ฐํ•˜์ง€๋งŒ ์ด๊ฒƒ์€ yarn์—์„œ ์‚ฌ์šฉํ•˜๋Š” ๊ธฐ๋ณธ ๋ ˆ์ง€์ŠคํŠธ๋ฆฌ์ž…๋‹ˆ๋‹ค (์—ฌ์ „ํžˆ ์—ญ๋ฐฉํ–ฅ ํ”„๋ก์‹œ ์ž…๋‹ˆ๊นŒ? ์•„๋งˆ ์ธ์ฆ ํ—ค๋”๋ฅผ ์กด์ค‘ํ•˜์ง€ ์•Š์Šต๋‹ˆ๊นŒ? ).

๊ตฌ์ฒด์ ์ธ ์žฌ์ƒ์‚ฐ ๋‹จ๊ณ„

  1. yarn์ด ๊ธฐ๋ณธ ๊ตฌ์„ฑ์„ ์‚ฌ์šฉํ•˜๋„๋ก .npmrc ๋ฐ .yarnrc ํŒŒ์ผ์„ ์‚ญ์ œ / ์ด๋™ํ•ฉ๋‹ˆ๋‹ค.
  2. npm ๋ ˆ์ง€์ŠคํŠธ๋ฆฌ์— ๋น„๊ณต๊ฐœ๋กœ ๊ฒŒ์‹œ ๋œ ํŒจํ‚ค์ง€๋ฅผ ์ฐพ์Šต๋‹ˆ๋‹ค.
    1a. yarn์„ ํ…Œ์ŠคํŠธํ•˜๋Š” ๋™์ผํ•œ ์‹œ์Šคํ…œ์—์„œ ๋‹ค์šด๋กœ๋“œ / ๊ฒŒ์‹œ ํ•œ ๊ฒฝ์šฐ npm ๋ฐ yarn ์บ์‹œ๋ฅผ ์ง€ ์›๋‹ˆ๋‹ค.
  3. npm login ๋˜๋Š” yarn login ๋ฅผ ์‹คํ–‰ํ•˜์—ฌ ์ธ์ฆ ํ† ํฐ์„ ์ฑ„ ์›๋‹ˆ๋‹ค.
  4. 0.27.5 ์ดํ›„์˜ ์–€ ๋ฒ„์ „์„ ์‚ฌ์šฉํ•˜์—ฌ์ด ํŒจํ‚ค์ง€๋ฅผ ์„ค์น˜ํ•ด๋ณด์‹ญ์‹œ์˜ค.
์˜ˆ์ƒ ๊ฒฐ๊ณผ

ํŒจํ‚ค์ง€๊ฐ€ ์„ฑ๊ณต์ ์œผ๋กœ ์„ค์น˜๋ฉ๋‹ˆ๋‹ค.

์‹ค์ œ ๊ฒฐ๊ณผ
โค <strong i="26">@up</strong> โžœ  REPO git:(master) โ˜… yarn add @SCOPE/PACKAGE 
yarn add v1.1.0
info No lockfile found.
[1/5] Validating package.json...
[2/5] Resolving packages...
error An unexpected error occurred: "https://registry.npmjs.org/@SCOPE%2fPACKAGE: Not found".
info If you think this is a bug, please open a bug report with the information provided in "/home/katy/dev/REPO/yarn-error.log".
info Visit https://yarnpkg.com/en/docs/cli/add for documentation about this command.

ํ”„๋กœ์ ํŠธ ๊ด€๋ฆฌ์ž๊ฐ€ @kmoe ์˜ ์ง€์นจ์ด ์žฌํ˜„ ๊ฐ€๋Šฅํ•˜๋‹ค๊ณ  ํŒ๋‹จ๋˜๋ฉด์ด ํ‹ฐ์ผ“์„ ๋‹ค์‹œ ์—ด์–ด์•ผํ•ฉ๋‹ˆ๋‹ค (์ ์–ด๋„ ๊ธฐ์กด ๊ตฌ๋…์ž๋ฅผ ์œ„ํ•ด).

@kmoe ๋™์˜ํ•ฉ๋‹ˆ๋‹ค. ์ตœ๊ทผ ๋ฒ„์ „์˜ ์›์‚ฌ์—์„œ๋„ ๊ทผ๋ณธ์ ์ธ ๋ฌธ์ œ๊ฐ€ ํ•ด๊ฒฐ ๋˜์ง€ ์•Š์•˜์Šต๋‹ˆ๋‹ค . ๋ฌธ์ œ๋ฅผ ๋‹ค์‹œ์—ฌ์‹ญ์‹œ์˜ค. ์˜ˆ, ํ•ด๊ฒฐ ๋ฐฉ๋ฒ•์ด ์žˆ์ง€๋งŒ์ด ๊ฒฝ์šฐ ํ•ด๊ฒฐ ๋ฐฉ๋ฒ•! = ํ•ด๊ฒฐ ๋ฐฉ๋ฒ•์ž…๋‹ˆ๋‹ค.

FWIW, ์ด๊ฒƒ์€ 1.1.0์—์„œ ์—ฌ์ „ํžˆ ๋ฌธ์ œ์ž…๋‹ˆ๋‹ค. ๋ฐฉ๊ธˆ ํ™•์ธํ–ˆ์Šต๋‹ˆ๋‹ค (ํ•ด๊ฒฐ ๋ฐฉ๋ฒ•์„ ์œ„ํ•ด ์—ฌ๊ธฐ๋กœ ๋Œ์•„ ์™”์Šต๋‹ˆ๋‹ค. ์ฆ‰ registry "https://registry.npmjs.org" ์— ์ถ”๊ฐ€๋˜๋Š” ~/.yarnrc )

์›์‚ฌ 1.3.2์—์„œ์ด ๋ฌธ์ œ๊ฐ€ ๋ฐœ์ƒํ•˜๊ณ  ์žˆ์œผ๋ฉฐ ํ˜„์žฌ ๋นŒ๋“œ๊ฐ€ ์†์ƒ๋˜๊ณ  ์žˆ์Šต๋‹ˆ๋‹ค. 0.27.5 ์‹ค์—์„œ ์ž˜ ์ž‘๋™ํ–ˆ์Šต๋‹ˆ๋‹ค.

Artifactory ๋น„๊ณต๊ฐœ ๋ ˆ์ง€์ŠคํŠธ๋ฆฌ์—์„œ ํŒจํ‚ค์ง€๋ฅผ ์„ค์น˜ํ•˜๋ ค๋ฉด .npmrc ํŒŒ์ผ์˜ ์ธ์ฆ ํ† ํฐ์ด ํ•„์š”ํ•ฉ๋‹ˆ๋‹ค.

๋ณต์ œ ๋‹จ๊ณ„ :

  1. ๋‹ค์Œ๊ณผ ๊ฐ™์€ ์ธ์ฆ ์ •๋ณด๊ฐ€ ํฌํ•จ ๋œ .npmrc ํŒŒ์ผ์ด ์žˆ์Šต๋‹ˆ๋‹ค.
registry=https://artifactory.mycompany.com/artifactory/api/npm/npm-virtual
_auth = myAuthTokenHere
always-auth = true
email = [email protected]
  1. yarn install
  2. yarn์ด ๊ฐœ์ธ ๋ ˆ์ง€์ŠคํŠธ๋ฆฌ์—์„œ ํ•ญ๋ชฉ์„ ์„ค์น˜ํ•˜๋ ค๊ณ  ํ•  ๋•Œ HTTP 401 ์˜ค๋ฅ˜๊ฐ€ ๋ฐœ์ƒํ•ฉ๋‹ˆ๋‹ค.
error An unexpected error occurred: "https://artifactory.mycompany.com/api/npm/npm-virtual/@angular/compiler/-/compiler-4.3.1.tgz: Request failed \"401 Unauthorized\"".

๊ด€๋ จ : # 4672

@stewx 1.3.2์—์„œ๋„ ๋™์ผํ•œ ๋ฌธ์ œ๊ฐ€ ๋ฐœ์ƒํ•ฉ๋‹ˆ๋‹ค. ํ•ด๊ฒฐ ๋ฐฉ๋ฒ•์ด๋‚˜ ํ•ด๊ฒฐ ๋ฐฉ๋ฒ•์„ ์ฐพ์•˜์Šต๋‹ˆ๊นŒ?

@jamesone ์•„๋‹ˆ์š”, 0.27๊ณผ ๊ฐ™์€ ๊ฒƒ์œผ๋กœ ๋‹ค์šด ๊ทธ๋ ˆ์ด๋“œํ–ˆ์Šต๋‹ˆ๋‹ค. ๊ทธ๊ฒƒ์€ ์šฐ๋ฆฌ ํ”„๋กœ์ ํŠธ์˜ ๊ฑฐ๋ž˜๋ฅผ ๊นจ๋œจ๋ฆฌ๋Š” ์š”์†Œ์ž…๋‹ˆ๋‹ค.

ํŠธ์œ— ๋‹ด์•„ ๊ฐ€๊ธฐ
.yarnrc์— registry "https://registry.npmjs.org" ์„ ์ถ”๊ฐ€ํ•˜๊ณ  ๊ฐœ์ธ ํŒจํ‚ค์ง€๋ฅผ ๋‹ค์‹œ ์„ค์น˜ํ•˜์‹ญ์‹œ์˜ค.
yarn์—๊ฒŒ npmjs ๋ ˆ์ง€์ŠคํŠธ๋ฆฌ์™€ ์ง์ ‘ ์ž‘์—…ํ•˜๋„๋ก ์ง€์‹œํ•˜๊ณ  ๋ฌธ์ œ๋ฅผ ํ•ด๊ฒฐํ•ฉ๋‹ˆ๋‹ค.

์ด ๋ฌธ์ œ๋ฅผ ์šฐํšŒํ•˜๊ธฐ ์œ„ํ•ด 0.27.5 ์—์„œ ๋ฒ„์ „ ์ž ๊ธˆ์ด ๋„ˆ๋ฌด ์ž˜๋ชป๋˜์—ˆ๋‹ค๊ณ  ์ƒ๊ฐํ•˜์ง€๋งŒ ๋งŽ์€ ์‚ฌ๋žŒ๋“ค์ด registry ๊ตฌ์„ฑ์„ ๋ฆฌ๋””๋ ‰์…˜ํ•˜๋Š” _or_ ์ž‘์—…์„ ์ˆ˜ํ–‰ํ•˜๋Š” ๊ฒƒ์ฒ˜๋Ÿผ ๋ณด์ž…๋‹ˆ๋‹ค ( @stewx ๊ฐ€ ์ž์ฒด ํ˜ธ์ŠคํŒ… ๋ฌธ์ œ๋ฅผ ํ•ด๊ฒฐํ•˜์ง€ ๋ชปํ•จ์„๋ณด๊ณ ํ•˜์ง€๋งŒ ๊ฐœ์ธ ๋ ˆ์ง€์ŠคํŠธ๋ฆฌ).

๋นˆ๋ฒˆํ•œ ํ”„๋กœ์ ํŠธ ๊ธฐ์—ฌ์ž๊ฐ€ ๋‹จ๊ธฐ๊ฐ„์—์ด ๋ฌธ์ œ๋ฅผ ํ•ด๊ฒฐํ•  ์‹œ๊ฐ„์ด ์—†๋‹ค๋ฉด ๋ˆ„๊ตฐ๊ฐ€ ์ปค๋ฎค๋‹ˆํ‹ฐ PR์ด ์—ด๋ฆฌ๊ธฐ๋ฅผ ๋ฐ”๋ผ๋ฉด์„œ ์ˆ˜์ •์ด ์„ฑ๊ณตํ•  ๊ฐ€๋Šฅ์„ฑ์ด ๊ฐ€์žฅ ๋†’์€ ์ฝ”๋“œ๋ฒ ์ด์Šค ์œ„์น˜๋ฅผ ๊ธฐ๊บผ์ด ์ œ์•ˆํ• ๊นŒ์š”? ๐Ÿค”

/ cc @kittens @bestander @BYK @arcanis @ rally25rs @kaylieEB

@Bnaya ์žฌ์„ค์น˜๋ผ๊ณ ํ•˜๋ฉด ํ”„๋กœ์ ํŠธ์—์„œ node_modules ๋ฅผ ์ œ๊ฑฐํ•˜๊ฑฐ๋‚˜ ์›์‚ฌ ์บ์‹œ๋ฅผ ์ง€์šฐ๋Š” ๊ฒƒ์„ ์˜๋ฏธํ•ฉ๋‹ˆ๊นŒ?

์› ์‚ฌ๋Š” yourprivatepackage๋ฅผ ์ œ๊ฑฐํ•ฉ๋‹ˆ๋‹ค. ์›์‚ฌ ์ถ”๊ฐ€ yourprivatepackage

๊ทธ๋ฆฌ๊ณ  ์ž ๊ธˆ ํŒŒ์ผ์— https://registry.yarnpkg *** ์•„๋‹Œ https://registry.npmjs.org/*** url์ด ํ‘œ์‹œ๋ฉ๋‹ˆ๋‹ค.

package.json ์˜†์— .yarnrc๋ฅผ ์ถ”๊ฐ€ํ•˜๋Š” ๊ฒƒ์ด ์ข‹์Šต๋‹ˆ๋‹ค.

์‹ค์ œ๋กœ registry "https://registry.npmjs.org" ๋ฅผ ~/.yarnrc ์— ๋„ฃ์–ด์„œ ์ž‘๋™ํ•˜๋„๋ก ๋งŒ๋“ค์—ˆ์Šต๋‹ˆ๋‹ค. ์ฆ‰, ํŒจํ‚ค์ง€ ๋กœ์ปฌ .yarnrc ํ•„์š”ํ•˜์ง€ ์•Š์Šต๋‹ˆ๋‹ค.

๋‚˜๋ฅผ ์œ„ํ•ด ์˜ค๋ฅ˜๋ฅผ ์žฌํ˜„ํ•˜๋Š” ๋‹จ๊ณ„ :

  • ์ˆ˜์ • ๋œ ~/.yarnrc
  • ์ƒˆ ํ”„๋กœ์ ํŠธ ์ƒ์„ฑ
  • ์›์‚ฌ ์บ์‹œ ์ฒญ์†Œ
  • yarn add privatemodule-> ์‹คํŒจ

์œ„์—์„œ ์–ธ๊ธ‰ ํ•œ๋Œ€๋กœ ~/.yarnrc ๋ฅผ ์ˆ˜์ •ํ•˜๋ฉด ๋‹จ๊ณ„์—์„œ ์˜ค๋ฅ˜๊ฐ€ ๋ฐœ์ƒํ•˜์ง€ ์•Š์Šต๋‹ˆ๋‹ค.

์‹คํŒจํ•œ ํ”„๋กœ์ ํŠธ๋ฅผ ์‚ดํŽด๋ณด๋ฉด yarn.lock ์— https://registry.yarnpkg.com/@myscope/mypackage/ ํฌํ•จ๋˜์–ด ์žˆ์Œ์„ ์•Œ ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค. ์ด๋Ÿฌํ•œ ํ”„๋กœ์ ํŠธ๋ฅผ ์ž‘๋™ ์‹œํ‚ค๋ ค๋ฉด ./.yarnrc ์—…๋ฐ์ดํŠธ ํ•œ ํ›„ yarn.lock ๋ฅผ ์ œ๊ฑฐํ•˜๊ณ  ๋‹ค์‹œ ์ƒ์„ฑํ•ด์•ผํ•ฉ๋‹ˆ๋‹ค.

์ด๊ฒƒ์€ ์–ด๋–ค ์‚ฌ๋žŒ๋“ค์ด ๋‹ค๋ฅธ ์‚ฌ๋žŒ๋“ค์—๊ฒŒ ํšจ๊ณผ๊ฐ€์žˆ๋Š” ๊ฒƒ์„ ์‹œ๋„ํ•˜๋”๋ผ๋„ ์—ฌ์ „ํžˆ ์˜ค๋ฅ˜๊ฐ€์žˆ๋Š” ์ด์œ ๋ฅผ ์„ค๋ช…ํ•˜๋Š” ๊ฒƒ ๊ฐ™์Šต๋‹ˆ๋‹ค.

๊ฒฐ๋ก ์ ์œผ๋กœ ํ•ด๊ฒฐํ•˜๋Š” ๋ฐฉ๋ฒ• :

  • ~ / .yarnrc์— registry "https://registry.npmjs.org" ์ถ”๊ฐ€
  • ์‹คํŒจํ•œ ํ”„๋กœ์ ํŠธ์— ๋Œ€ํ•ด yarn.lock ์ œ๊ฑฐ ๋ฐ ์žฌ์ƒ์„ฑ

@TheLudd ์ฒ˜์Œ๋ถ€ํ„ฐ ๋ฌด๋„ˆ ์ง‘๋‹ˆ๋‹ค.

๋Œ€์‹ , ํ”„๋กœ์ ํŠธ ๊ด€๋ฆฌ์ž๋Š” ํ˜„์žฌ ์ž ๊ธˆ ํŒŒ์ผ ์ƒํƒœ๋ฅผ ์œ ์ง€ํ•˜๋ฉด์„œ yarnpkg.com ์—์„œ npmjs.org ๊ฒ€์ƒ‰ / ๋ฐ”๊พธ๊ธฐ๋ฅผ ๊ณ ๋ คํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.

@awkaiser ๊ธ€์Ž„, ๋‹น์‹ ์˜ ํ…Œ์ŠคํŠธ๊ฐ€ ํ†ต๊ณผํ•˜๋Š” ํ•œ ๋‹น์‹ ์€ ๊ทธ๊ฒƒ์„ ์ปค๋ฐ‹ ํ•  ์ˆ˜ ์žˆ๊ณ  ๋‹ค๋ฅธ ๋ชจ๋“  ํ˜‘๋ ฅ์ž๋“ค์€ ๋‹น์‹ ๊ณผ ๊ฐ™์€ ํ™˜๊ฒฝ์„ ๊ฐ–๊ฒŒ ๋  ๊ฒƒ์ž…๋‹ˆ๋‹ค. ๊ทธ๋ž˜์„œ ๊ทธ ๋ชฉ์  IMO๋ฅผ ์‹ค์ œ๋กœ ๊บพ์ง€ ์•Š์Šต๋‹ˆ๋‹ค.
ํ•˜์ง€๋งŒ ๋„ค, ๊ฒ€์ƒ‰ ๊ต์ฒด๋„ ๊ฐ€๋Šฅํ•ฉ๋‹ˆ๋‹ค.

๊ทธ๋Ÿฌ๋‚˜ ๊ทœ์น™์€ ๋˜ํ•œ ์ˆ˜๋™์œผ๋กœ yarn.lock์„ ์ˆ˜์ •ํ•ด์„œ๋Š” ์•ˆ๋œ๋‹ค๋Š” ๊ฒƒ์ž…๋‹ˆ๋‹ค.)

package.json ์š”๊ตฌ ์‚ฌํ•ญ์„ ์ถฉ์กฑํ•˜๋Š” ์ ˆ๋Œ€ ์ตœ์‹  ํŒจํ‚ค์ง€๋ฅผ ๊ฐ€์ ธ ์˜ค๋Š” ๊ฒƒ์ด ํ•ญ์ƒ ์•ˆ์ „ํ•˜๋‹ค๋ฉด ์ž ๊ธˆ ํŒŒ์ผ์ด ์ „ํ˜€ ํ•„์š”ํ•˜์ง€ ์•Š์„ ๊ฒƒ์ž…๋‹ˆ๋‹ค. ๐Ÿ˜œ

์ผ๋ฐ˜์ ์œผ๋กœ ์˜ˆ, ์šฐ๋ฆฌ๋Š” ์ง์ ‘ yarn.lock ์„ ์ˆ˜์ •

์ „์ฒด ์ž ๊ธˆ ํŒŒ์ผ์„ ๋‹ค์‹œ ์ƒ์„ฑ ํ•  ํ•„์š”๊ฐ€ ์—†์—ˆ์Šต๋‹ˆ๋‹ค.
๊ฐœ์ธ ํŒจํ‚ค์ง€๋ฅผ ์ œ๊ฑฐํ•˜๊ณ  ์„ค์น˜ํ•˜๊ธฐ ์œ„ํ•ด

@awkaiser ๋˜๋Š” ์Šค๋ ˆ๋“œ์˜ ๋‹ค๋ฅธ ์‚ฌ๋žŒ-๋‹น์‹ ์ด ๋„์šธ ์ˆ˜์žˆ๋Š” ํ•œ ๊ฐ€์ง€ ๋ฐฉ๋ฒ•์€ ์žฌํ˜„ ๊ฐ€๋Šฅํ•œ ์˜ˆ์ œ๋ฅผ ๋งŒ๋“œ๋Š” ๊ฒƒ์ž…๋‹ˆ๋‹ค. ์˜ˆ๋ฅผ ๋“ค์–ด์ด repo https://github.com/KidkArolis/yarn-scopes-issue๋ฅผ ๊ธฐ๋ฐ˜์œผ๋กœํ•ฉ๋‹ˆ๋‹ค yarn ์ด ์‹คํŒจํ•˜๋Š” ๋ฆฌํฌ์ง€ํ† ๋ฆฌ๋ฅผ ์ƒ์„ฑ ํ•  ์ˆ˜ ์žˆ๋‹ค๋ฉด (ํŠน์ • ๋ ˆ์ง€์ŠคํŠธ๋ฆฌ ์‘๋‹ต, ํŠน์ • ์–€ ๊ตฌ์„ฑ, ํŠน์ • package.json ๋“ฑ) ๋ฌธ์ œ ํ•ด๊ฒฐ์„ ํ™•์‹คํžˆ ์‚ดํŽด๋ณผ ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.

์ผ๋ฐ˜์ ์œผ๋กœ:

  1. .yarnrc ํŒŒ์ผ์ด ํ•„์š”ํ•˜์ง€ ์•Š์Šต๋‹ˆ๋‹ค.
  2. ๋‹น์‹ ์€ ํ•„์š”๊ฐ€ ์—†์Šต๋‹ˆ๋‹ค .yarnrc ํฌํ•จ registry "https://registry.npmjs.org"
  3. registry.npmjs.org ๋น„๊ณต๊ฐœ ๋ชจ๋“ˆ์ด ์ž‘๋™ํ•ฉ๋‹ˆ๋‹ค.
  4. custom.registry.org ๋น„๊ณต๊ฐœ ๋ชจ๋“ˆ์ด ์ž‘๋™ํ•ฉ๋‹ˆ๋‹ค.

@KidkArolis ์‹คํŒจ๋Š” ๋ฌด์ž‘์œ„์ž…๋‹ˆ๋‹ค. ๊ทธ๋Ÿฌ๋‚˜ ๊ทธ๋“ค์€ ๊ฑฐ๊ธฐ์— ์žˆ์Šต๋‹ˆ๋‹ค.
๋‚ด๊ฐ€ ๋‹ค๋ฅธ ๊ด€๋ จ ๋ฌธ์ œ์— ๋Œ€ํ•ด ์ผ ๋“ฏ์ด ์›์‚ฌ ๋ ˆ์ง€์ŠคํŠธ๋ฆฌ ๋ฌธ์ œ (์บ์‹ฑ ์‹คํŒจ, ํ”„๋ก์‹œ์˜ ์ž˜๋ชป๋œ Vary ํ—ค๋”, ๋ฌด์—‡์ด๋“ ) ๋˜๋Š” ์›์‚ฌ ๋ ˆ์ง€์ŠคํŠธ๋ฆฌ์—์„œ๋งŒ ๋ฐœ์ƒํ•˜๋Š” ์›์‚ฌ ๋‚ด๋ถ€์˜ ๋ณต์žกํ•œ ๊ฐ€์žฅ์ž๋ฆฌ ์ผ€์ด์Šค.

@kmoe ๊ฐ€ 2017 ๋…„ 9 ์›” 25 ์ผ์— ์“ด ๊ธ€์ด ๋ถ€์กฑํ•œ๊ฐ€์š”? ๐Ÿค”

์ด ๋ฌธ์ œ์˜ ์žฌ๊ฐœ๋ฅผ ์ด‰๊ตฌํ–ˆ์œผ๋ฉฐ, ์ด๋Š” ๊ธฐ์—ฌ์ž์— ์˜ํ•œ ๋ณต์ œ๋ฅผ ์˜๋ฏธํ•ฉ๋‹ˆ๋‹ค.

@KidkArolis ๊ฐœ์ธ ๋ชจ๋“ˆ๊ณผ ๊ด€๋ จ์ด ์žˆ๊ณ  ๋”ฐ๋ผ์„œ ๋ˆ„๊ฐ€ ์–€์„ ์‹คํ–‰ํ•˜๋Š”์ง€์— ๋”ฐ๋ผ ๋‹ค๋ฅด๊ธฐ ๋•Œ๋ฌธ์— ๋ฆฌํฌ์ง€ํ† ๋ฆฌ์—์„œ ์žฌํ˜„ ๊ฐ€๋Šฅํ•œ ์˜ˆ์ œ๋ฅผ ์–ด๋–ป๊ฒŒ ๋งŒ๋“ค ์ˆ˜ ์žˆ๋Š”์ง€ ์ž˜ ๋ชจ๋ฅด๊ฒ ์Šต๋‹ˆ๋‹ค. ๊ทธ๋Ÿฌ๋‚˜ ์˜ค๋ฅ˜๋ฅผ ์žฌํ˜„ํ•˜๋Š” ๋‹จ๊ณ„๋Š” ์—ฌ๊ธฐ https://github.com/yarnpkg/yarn/issues/4451#issuecomment -355248563์ด๋ฉฐ @kmoe๊ฐ€ ์ž‘์„ฑํ•œ ๋‚ด์šฉ์œผ๋กœ๋„ ์ถฉ๋ถ„ํ•ฉ๋‹ˆ๋‹ค.

.yarnrc ์ˆ˜์ •ํ•˜์ง€ ์•Š๊ณ  ๊ฐœ์ธ ํŒจํ‚ค์ง€๋ฅผ ์„ค์น˜ํ•˜๋ ค๊ณ ํ•˜๋ฉด ์˜ค๋ฅ˜๊ฐ€ ๋ฐœ์ƒํ•ฉ๋‹ˆ๋‹ค.

์˜ˆ๊ธฐ์น˜ ์•Š์€ ์˜ค๋ฅ˜๊ฐ€ ๋ฐœ์ƒํ–ˆ์Šต๋‹ˆ๋‹ค : " https://registry.yarnpkg.com

์ด๊ฒƒ์€ npm์ด ์•„๋‹Œ yarn ๋ ˆ์ง€์ŠคํŠธ๋ฆฌ์—์„œ ๊ฒ€์ƒ‰๋œ๋‹ค๋Š” ๊ฒƒ์„ ์˜๋ฏธํ•ฉ๋‹ˆ๋‹ค. ์ด ๋ฒ„๊ทธ๋ฅผ ์ผ์œผํ‚ค๋Š” ์˜ค๋ฅ˜๊ฐ€ ์•„๋‹™๋‹ˆ๊นŒ?

์ข‹์Šต๋‹ˆ๋‹ค. ์žฌ์ƒ์‚ฐ ๋‹จ๊ณ„๋ฅผ ์žฌ ํฌ์žฅ ํ•ด ์ฃผ์…”์„œ ๊ฐ์‚ฌํ•ฉ๋‹ˆ๋‹ค. ๋‚˜๋Š” ์‹œ๋„ํ•˜๊ณ  ๋ณผ ๊ฒƒ์ด๋‹ค.

์–ด๋–ค ์ด์œ ๋กœ ๋“ ์ด ๋ช…์‹œ ์  ์œ„์น˜๋ฅผ .npmrc์— ์ถ”๊ฐ€ํ•˜์—ฌ ๋‚ด ๊ฐœ์ธ ํŒจํ‚ค์ง€๋ฅผ ์ฐพ์„ ์œ„์น˜๋กœ ์ธํ•ด ๋ฌธ์ œ๋ฅผ ์ผ์œผํ‚ค๋Š” ๋ชจ๋“  ์ €์žฅ์†Œ์—์„œ 404 ์˜ค๋ฅ˜๊ฐ€ ๋ฐœ์ƒํ•˜์ง€ ์•Š๊ฒŒ๋˜์—ˆ์Šต๋‹ˆ๋‹ค.

@npm-username:registry=https://registry.yarnpkg.com/

๋ˆ„๊ตฌ๋“ ์ง€ ๋‚˜๋ฅผ ์ถ”๊ฐ€ ํ•  ์ˆ˜์žˆ๋Š” ๋น„๊ณต๊ฐœ npm ํŒจํ‚ค์ง€๊ฐ€ ์žˆ์Šต๋‹ˆ๊นŒ? ์‚ฌ์šฉ์ž ์ด๋ฆ„ : kidkarolis .

์œ ๋ฃŒ ๊ณ„์ •์„ ์–ป๊ธฐ ์œ„ํ•ด ๊ณ ๊ตฐ๋ถ„ํˆฌํ•˜๊ณ  ์žˆ์Šต๋‹ˆ๋‹ค. ๊ฒฐ์ œ / ๊ณ„์ • ์‹œ์Šคํ…œ์ด atm์—์„œ ์ž‘๋™ํ•˜์ง€ ์•Š๋Š” ๊ฒƒ ๊ฐ™์Šต๋‹ˆ๋‹ค (๋น„์šฉ์ด ์ฒญ๊ตฌ๋˜์—ˆ์ง€๋งŒ 402 Payment Required ๋ฅผ๋ฐ›์Šต๋‹ˆ๋‹ค. ๋ˆ„๊ตฐ๊ฐ€ ๋‚˜๋ฅผ ๊ฐœ์ธ ํŒจํ‚ค์ง€์— ์ถ”๊ฐ€ํ•˜๋ฉด (๊ฐ€๋Šฅํ•˜๋‹ค๋ฉด) ์†๋„๊ฐ€ ๋นจ๋ผ์งˆ ๊ฒƒ์ž…๋‹ˆ๋‹ค.

์ข‹์•„, ๋‚˜๋Š” ๊ทธ๊ฒƒ์ด ๋‹จ์ง€ .. ์ตœ์ข… ์ผ๊ด€์„ฑ์ด๋ผ๊ณ  ์ƒ๊ฐํ•œ๋‹ค. ๋‚˜์˜ ๊ฐœ์ธ npm ๊ณ„์ •์€ ์ด์ œ ์ž‘๋™ํ•œ๋‹ค.

๊ทธ๋Ÿฌ๋‚˜ ์•„์ง ๋ฌธ์ œ๋ฅผ ์žฌํ˜„ ํ•  ์ˆ˜ ์—†์Šต๋‹ˆ๋‹ค.

@kmoe๊ฐ€ ์ œ๊ณต ํ•œ ๋‹จ๊ณ„๋ฅผ

  1. rm ~/.yarnrc && rm ~/.npmrc
  2. yarn cache clean && npm cache clean --force
  3. npm login
  4. yarn add @scope/pkg

๊ทธ๊ฒƒ์€ ์ž˜ ์„ค์น˜๋ฉ๋‹ˆ๋‹ค ( npm login ํ•˜์ง€ ์•Š์œผ๋ฉด ์„ค์น˜๋˜์ง€ ์•Š์Šต๋‹ˆ๋‹ค). ์ฆ‰, ์˜ˆ์ƒ๋Œ€๋กœ ์ž‘๋™ํ•ฉ๋‹ˆ๋‹ค.

๊ทธ๋ฆฌ๊ณ  yarn.lock์œผ๋กœ ํŒ๋‹จํ•˜๋ฉด ๋‚ด ์„ค์น˜๊ฐ€ https://registry.yarnpkg.com ๊ฑฐ์น˜๊ณ  ์˜ˆ์ƒ๋Œ€๋กœ ์ธ์ฆ์„ ์‚ฌ์šฉํ•˜๋Š” ๊ฒƒ ๊ฐ™์Šต๋‹ˆ๋‹ค. ๊ณผ๊ฑฐ์— ์„œ๋ฒ„์— ๋ฌธ์ œ๊ฐ€ ์žˆ์—ˆ๋Š”๋ฐ ์ด์ œ ํ•ด๊ฒฐ ๋˜์—ˆ๋‚˜์š”?

์ข‹์•„, ๋ญ”๊ฐ€๋ฅผ ์žฌํ˜„ํ–ˆ๋‹ค๊ณ  ์ƒ๊ฐํ•ฉ๋‹ˆ๋‹ค.

<strong i="6">@qubit</strong>:registry=https://registry.npmjs.org/ ์„ .npmrc ํ•˜๋ฉด ์„ค์น˜๊ฐ€ ๋” ์ด์ƒ ์ž‘๋™ํ•˜์ง€ ์•Š์Šต๋‹ˆ๋‹ค.
๋‚œ ๋‹น์‹ ์ด ๋กœ๊ทธ์ธํ•˜๋ฉด ํ•ด๋‹น ํ–‰์ด ์ถ”๊ฐ€๋ฉ๋‹ˆ๋‹ค ์ƒ๊ฐ npm login --scope=@qubit ๋ฐฉ๊ธˆ ๋กœ๊ทธ์ธ ๊ฒฝ์šฐ๋Š” ์ถ”๊ฐ€๋˜์ง€ ์•Š์Šต๋‹ˆ๋‹ค npm login . ๋‹ค์Œ์—์ด ๋ฌธ์ œ๋ฅผ ํ•ด๊ฒฐํ•˜๋Š” ๋ฐฉ๋ฒ•์„ ์‚ดํŽด ๋ณด๊ฒ ์Šต๋‹ˆ๋‹ค.

@KidkArolis ํ•ด๋‹น ๊ตฌ์„ฑ์„ ์„ค์ •ํ•˜๋Š” ๋‹ค๋ฅธ ์ผ๋ฐ˜์ ์ธ ๋ฐฉ๋ฒ•์€ ๋‹ค์Œ๊ณผ ๊ฐ™์Šต๋‹ˆ๋‹ค.

npm config set <strong i="8">@qubit</strong>:registry https://registry.npmjs.org

PR-# 5162 ํ”ผ๋“œ๋ฐฑ (๋˜๋Š” QA) ํ™˜์˜ํ•ฉ๋‹ˆ๋‹ค.

@KidkArolis PR์— ๊ฐ์‚ฌ๋“œ๋ฆฝ๋‹ˆ๋‹ค. ๊ทธ๋Ÿฌ๋‚˜ ๋ฌธ์ œ๋Š” "--scope"๊ฒฝ์šฐ๋ฟ๋งŒ ์•„๋‹ˆ๋ผ ๊ฐœ์ธ ์ €์žฅ์†Œ๊ฐ€ ์ธ์ฆ์„ ์‚ฌ์šฉํ•˜์—ฌ ๊ณต๊ฐœ ํŒจํ‚ค์ง€๋ฅผ ๋ฏธ๋Ÿฌ๋งํ•˜๋Š”๋ณด๋‹ค ์ผ๋ฐ˜์ ์ธ ๊ฒฝ์šฐ์—๋„ ์žˆ๋‹ค๊ณ  ์ƒ๊ฐํ•ฉ๋‹ˆ๋‹ค.

๊ทธ๊ฑด ๊ทธ๋ ‡๊ณ , @ bytheway875 , https://registry.yarnpkg.com/ ๋ ˆ์ง€์ŠคํŠธ๋ฆฌ๋กœ ์‚ฌ์šฉํ•˜๋Š” ํŠธ๋ฆญ์ด ์ €์—๊ฒŒ ํšจ๊ณผ์  ์ด์—ˆ์Šต๋‹ˆ๋‹ค.

๋‚ด ์ƒํ™ฉ :

  • ๋ชฉํ‘œ : CI ๋นŒ๋“œ (GitLab) ์ค‘์— ๋กœ์ปฌ .npmrc ํŒŒ์ผ์˜ authToken ๋ฅผ ์‚ฌ์šฉํ•˜์—ฌ npmjs.com์˜ ์กฐ์ง (@ org-name)์—์„œ yarn ๋กœ ๊ฐœ์ธ ํŒจํ‚ค์ง€๋ฅผ ์„ค์น˜ํ•ฉ๋‹ˆ๋‹ค. ๊ทธ๋ž˜์„œ npm ๋กœ๊ทธ์ธํ•˜์ง€ ์•Š์•˜์Šต๋‹ˆ๋‹ค.
  • npm
  • dev ์ปดํ“จํ„ฐ (mac)์— ๋ฌธ์ œ๊ฐ€ ์—†์Šต๋‹ˆ๋‹ค. npm login ๋ฐ yarn ๊ทธ๋ƒฅ ์ž‘๋™ํ•˜๊ฑฐ๋‚˜ npm์—์„œ ๋กœ๊ทธ ์•„์›ƒ ํ•  ์ˆ˜ ์žˆ์ง€๋งŒ ์ˆ˜๋™์œผ๋กœ ๋กœ์ปฌ / HOME dir .npmrc ํŒŒ์ผ์„ ๋งŒ๋“ค ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค. ํ•œ ์ค„ : //registry.npmjs.org/:_authToken=token ๋ฐ yarn ๊ทธ๋ƒฅ ์ž‘๋™ํ•ฉ๋‹ˆ๋‹ค (๋‘ ๋ฒˆ์งธ ๋ฐฉ๋ฒ•์€ ๋กœ์ปฌ ์บ์‹œ์˜ ์›์ธ ์ผ ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค. ์‚ญ์ œ๋ฅผ ์‹œ๋„ํ•˜์ง€ ์•Š์•˜์Šต๋‹ˆ๋‹ค).
  • ์œ„์—์„œ .yarnrc ํŠธ๋ฆญ์ด ์ž‘๋™ํ•˜์ง€ ์•Š์•˜์Šต๋‹ˆ๋‹ค.

_์ด ์ž‘์—…์„ ์ˆ˜ํ–‰ ํ•  ์ˆ˜์žˆ๋Š” ์œ ์ผํ•œ ๋ฐฉ๋ฒ•์€ CI์—์„œ yarn install ๋ฅผ ์‹คํ–‰ํ•˜๊ธฐ ์ „์— ์•„๋ž˜ ๋กœ์ปฌ .npmrc ํŒŒ์ผ์„ ๋งŒ๋“œ๋Š” ๊ฒƒ์ž…๋‹ˆ๋‹ค ._

@org-name:registry=https://registry.yarnpkg.com/
always-auth=true
_authToken=token

.npmrc ํŒŒ์ผ๊ณผ ๋น„์Šทํ•œ ๋ฌธ์ œ๊ฐ€ ์žˆ์Šต๋‹ˆ๋‹ค. ๋‚ด๊ฐ€ํ•ด์•ผ ํ•  ์ผ์€ .npmrc ํŒŒ์ผ์˜ ์ธ์ฝ”๋”ฉ์„ ANSI๋กœ ์„ค์ •ํ•˜๋Š” ๊ฒƒ๋ฟ์ž…๋‹ˆ๋‹ค (Windows์—์„œ๋Š” notepad.exe> โ€‹โ€‹๋‹ค๋ฅธ ์ด๋ฆ„์œผ๋กœ ์ €์žฅ ...์„ ์‚ฌ์šฉํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค).
yarn config list ์‚ฌ์šฉํ•˜์—ฌ yarn์ด .npmrc ํŒŒ์ผ ์ฝ˜ํ…์ธ ๋ฅผ ๋ณด๋Š” ๋ฐฉ๋ฒ•์„ ํ…Œ์ŠคํŠธ ํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.

v1.4.1 ์™€ ํ•จ๊ป˜ ์ž‘๋™ํ•˜๋„๋ก ํ•  ์ˆ˜ ์—†์Šต๋‹ˆ๋‹ค. ๊ฐœ์ธ Nexus ์ €์žฅ์†Œ๊ฐ€ ์žˆ์œผ๋ฉฐ ์บ์‹œ / ํ”„๋ก์‹œ๋กœ ์‚ฌ์šฉํ•ฉ๋‹ˆ๋‹ค ( ์ด์™€ ๊ฐ™์ด ). ํ™•์‹คํ•œ ์ง€์นจ์„ ์ฐพ์„ ์ˆ˜์—†๋Š” ๊ฒƒ ๊ฐ™์•„์„œ ๋‚ด๊ฐ€ ๋ญ”๊ฐ€ ์ž˜๋ชปํ•˜๊ณ ์žˆ์„ ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค. ์—ฌ๊ธฐ์„œ๋Š” yarn config ๊ตฌ๋ฌธ์„, ์—ฌ๊ธฐ ์—์„œ๋Š” yarn login ๊ตฌ๋ฌธ์„ ๊ฐ€์ ธ ์™”์Šต๋‹ˆ๋‹ค .

ํŽธ์ง‘ : ๋‚˜๋Š” yarn ์‹œ๋„ํ•˜๊ธฐ ์ „์— ํ•„์š”ํ•œ .npmrc ๋ฅผ ์–ป๊ธฐ ์œ„ํ•ด NPM์„ ํ†ตํ•ด ๋จผ์ € ๋กœ๊ทธ์ธ์„ ์‹œ๋„ํ–ˆ๋‹ค๊ณ  ์–ธ๊ธ‰ ํ–ˆ์–ด์•ผํ–ˆ์Šต๋‹ˆ๋‹ค.

์•„๋ž˜๋Š” ์ •ํ™•ํžˆ ๋‚ด๊ฐ€ ํ…Œ์ŠคํŠธํ•˜๋Š” ๊ฒƒ์ž…๋‹ˆ๋‹ค.

๋ณ‘ํ•ฉ ์ปค๋ฐ‹ ํ™•์ธ (dc705768)

git tag --contains dc705768
v1.4.0
v1.4.1

์„ค์ •

Dockerfile์„ ์ƒ์„ฑํ•˜์—ฌ ํ…Œ์ŠคํŠธ๋ฅผ์œ„ํ•œ ์ผ๊ด€๋œ ๊ธฐ์ค€ ํ™˜๊ฒฝ์„ ์ œ๊ณตํ•ฉ๋‹ˆ๋‹ค.

# Build
#  docker build -t yarn-private-registry-test .
# Run
#  docker run -it --rm yarn-private-registry-test

FROM debian:9.3-slim

WORKDIR /projects

RUN apt-get update \
  && apt-get --yes install curl gnupg \
  && curl -sL https://deb.nodesource.com/setup_8.x | bash - \
  && apt-get install --yes nodejs \
  && curl -OL https://github.com/yarnpkg/yarn/releases/download/v1.4.1/yarn_1.4.1_all.deb \
  && find . -name yarn*.deb -exec dpkg --install {} \; \
  && find . -name yarn*.deb -exec rm {} \;

Docker ์ด๋ฏธ์ง€ ๋นŒ๋“œ

docker build -t yarn-private-registry-test .

์›์‚ฌ ํ…Œ์ŠคํŠธ

ํžŒํŠธ : ๊นจ๋—ํ•œ ํ™˜๊ฒฝ์„ ์–ป์œผ๋ ค๋ฉด Docker ์ปจํ…Œ์ด๋„ˆ๋ฅผ ๊ณ„์† ์ข…๋ฃŒํ•˜๊ณ  ๋‹ค์‹œ ์‹œ์ž‘ํ•˜์‹ญ์‹œ์˜ค.

๊ตฌ์„ฑ ์—†์Œ

๊ตฌ์„ฑ์„ ๋ณ€๊ฒฝํ•˜์ง€ ์•Š๊ณ  ํ”„๋กœ์ ํŠธ๋ฅผ ์ดˆ๊ธฐํ™”ํ•˜๊ณ  ์ข…์†์„ฑ์„ ์ถ”๊ฐ€ํ•˜์—ฌ ํ™˜๊ฒฝ์ด ์ž‘๋™ํ•˜๋Š”์ง€ ํ™•์ธํ•ฉ๋‹ˆ๋‹ค.

Docker ์ปจํ…Œ์ด๋„ˆ ์‹คํ–‰

docker run -it --rm yarn-private-registry-test

ํ…Œ์ŠคํŠธ

left-pad ์ข…์†์„ฑ์„ ์ถ”๊ฐ€ํ•ฉ๋‹ˆ๋‹ค.

mkdir yarn \
  && cd yarn \
  && yarn init --yes \
  && yarn add left-pad
yarn init v1.4.1
warning The yes flag has been set [...snip...]
success Saved package.json
Done in 0.03s.
yarn add v1.4.1
info No lockfile found.
[1/4] Resolving packages...
[2/4] Fetching packages...
[3/4] Linking dependencies...
[4/4] Building fresh packages...
success Saved lockfile.
success Saved 1 new dependency.
โ””โ”€ [email protected]
Done in 0.52s.

๋น„๊ณต๊ฐœ ๋ ˆ์ง€์ŠคํŠธ๋ฆฌ ๊ตฌ์„ฑ

Docker ์ปจํ…Œ์ด๋„ˆ ์‹คํ–‰

docker run -it --rm yarn-private-registry-test

ํ…Œ์ŠคํŠธ

mkdir yarn \
  && cd yarn \
  && yarn init --yes \
  && yarn config set registry https://example.com/repository/npm-group/ \
  && yarn login
yarn init v1.4.1
warning The yes flag has been set [...snip...]
success Saved package.json
Done in 0.03s.
yarn config v1.4.1
success Set "registry" to "https://example.com/repository/npm-group/".
Done in 0.04s.
yarn login v1.4.1
question npm username: myusername
question npm email: [email protected]
Done in 6.25s.

left-pad ์ข…์†์„ฑ์„ ์ถ”๊ฐ€ํ•ฉ๋‹ˆ๋‹ค.

yarn --verbose add left-pad
yarn add v1.4.1
verbose 0.349 Checking for configuration file "/projects/yarn/.npmrc".
verbose 0.35 Checking for configuration file "/usr/local/share/.npmrc".
verbose 0.35 Checking for configuration file "/usr/etc/npmrc".
verbose 0.352 Checking for configuration file "/root/.npmrc".
verbose 0.353 Checking for configuration file "/projects/yarn/.npmrc".
verbose 0.353 Checking for configuration file "/projects/.npmrc".
verbose 0.355 Checking for configuration file "/projects/yarn/.yarnrc".
verbose 0.355 Checking for configuration file "/usr/local/share/.yarnrc".
verbose 0.357 Found configuration file "/usr/local/share/.yarnrc".
verbose 0.358 Checking for configuration file "/usr/etc/yarnrc".
verbose 0.358 Checking for configuration file "/root/.yarnrc".
verbose 0.359 Checking for configuration file "/projects/yarn/.yarnrc".
verbose 0.359 Checking for configuration file "/projects/.yarnrc".
verbose 0.365 current time: 2018-01-25T21:55:48.886Z
info No lockfile found.
verbose 0.405 Performing "GET" request to "https://yarnpkg.com/latest-version".
[1/4] Resolving packages...
verbose 0.48 Performing "GET" request to "https://example.com/repository/npm-group/left-pad".
verbose 0.52 Request "https://example.com/repository/npm-group/left-pad" finished with status code 401.
verbose 0.522 Error: Couldn't find package "left-pad" on the "npm" registry.
    at new MessageError (/usr/share/yarn/lib/cli.js:186:110)
    at NpmResolver.<anonymous> (/usr/share/yarn/lib/cli.js:50354:15)
    at Generator.next (<anonymous>)
    at step (/usr/share/yarn/lib/cli.js:98:30)
    at /usr/share/yarn/lib/cli.js:109:13
    at <anonymous>
    at process._tickCallback (internal/process/next_tick.js:188:7)
error An unexpected error occurred: "Couldn't find package \"left-pad\" on the \"npm\" registry.".
info If you think this is a bug, please open a bug report with the information provided in "/projects/yarn/yarn-error.log".
info Visit https://yarnpkg.com/en/docs/cli/add for documentation about this command.
verbose 0.809 Request "https://yarnpkg.com/latest-version" finished with status code 200.

.yarnrc

cat /usr/local/share/.yarnrc
# THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY.
# yarn lockfile v1


registry "https://example.com/repository/npm-group/"
email [email protected]
lastUpdateCheck 1516917349331
username myusername

NPM ํ…Œ์ŠคํŠธ

์ž‘๋™ํ•˜๋ฏ€๋กœ ์›ํ•˜๋Š” ๊ตฌ์„ฑ์œผ๋กœ ๋ฐ”๋กœ ๊ฑด๋„ˆ ๋œ๋‹ˆ๋‹ค.

๋น„๊ณต๊ฐœ ๋ ˆ์ง€์ŠคํŠธ๋ฆฌ ๊ตฌ์„ฑ

Docker ์ปจํ…Œ์ด๋„ˆ ์‹คํ–‰

docker run -it --rm yarn-private-registry-test

ํ…Œ์ŠคํŠธ

mkdir npm \
  && cd npm \
  && npm init --yes \
  && npm config set registry https://example.com/repository/npm-group/ \
  && npm login
Wrote to /projects/npm/package.json:

{
  "name": "npm",
  "version": "1.0.0",
  "description": "",
  "main": "index.js",
  "scripts": {
    "test": "echo \"Error: no test specified\" && exit 1"
  },
  "keywords": [],
  "author": "",
  "license": "ISC"
}


Username: myusername
Password:
Email: (this IS public) [email protected]
Logged in as myusername on https://example.com/repository/npm-group/.

left-pad ์ข…์†์„ฑ์„ ์ถ”๊ฐ€ํ•ฉ๋‹ˆ๋‹ค.

npm --verbose install left-pad
npm info it worked if it ends with ok
npm verb cli [ '/usr/bin/node',
npm verb cli   '/usr/bin/npm',
npm verb cli   '--verbose',
npm verb cli   'install',
npm verb cli   'left-pad' ]
npm info using [email protected]
npm info using [email protected]
npm verb npm-session 0ed36c84804378c8
npm http fetch GET 200 https://example.com/repository/npm-group/left-pad 78ms
npm http fetch GET 200 https://example.com/repository/npm-group/left-pad/-/left-pad-1.2.0.tgz 28ms
npm verb correctMkdir /root/.npm/_locks correctMkdir not in flight; initializing
npm verb makeDirectory /root/.npm/_locks creation not in flight; initializing
npm verb lock using /root/.npm/_locks/staging-2f9f45630e5bbb1a.lock for /projects/npm/node_modules/.staging
npm info lifecycle [email protected]~preinstall: [email protected]
npm info linkStuff [email protected]
npm verb linkBins [email protected]
npm verb linkMans [email protected]
npm info lifecycle [email protected]~install: [email protected]
npm info lifecycle [email protected]~postinstall: [email protected]
npm verb unlock done using /root/.npm/_locks/staging-2f9f45630e5bbb1a.lock for /projects/npm/node_modules/.staging
npm verb saving [ { name: 'left-pad', spec: '^1.2.0', save: 'dependencies' } ]
npm info lifecycle undefined~preshrinkwrap: undefined
npm info lifecycle undefined~shrinkwrap: undefined
npm notice created a lockfile as package-lock.json. You should commit this file.
npm info lifecycle undefined~postshrinkwrap: undefined
npm WARN [email protected] No description
npm WARN [email protected] No repository field.

+ [email protected]
added 1 package in 0.398s
npm verb exit [ 0, true ]
npm info

@ryanjaeb ์ž์„ธํ•œ ๋ณด๊ณ ์„œ๋ฅผ ๋ณด๋‚ด ์ฃผ์…”์„œ ๊ฐ์‚ฌํ•ฉ๋‹ˆ๋‹ค. ์—ฌ๊ธฐ์—์„œ ๋ฌด์—‡์ด ์ž˜๋ชป ๋  ์ˆ˜ ์žˆ๋Š”์ง€ ์•Œ๋ ค ๋“œ๋ฆฌ๊ธฐ ์œ„ํ•ด ์ œ๊ฐ€ ๋†“์นœ ๊ฒƒ์€ ~/.npmrc ๋ฐ ~/.yarnrc ํŒŒ์ผ์˜ ๋‚ด์šฉ์ž…๋‹ˆ๋‹ค. .yarnrc ๋ถ™์—ฌ ๋„ฃ์—ˆ์ง€๋งŒ ๋น„๋ฐ€๋ฒˆํ˜ธ๊ฐ€ ํฌํ•จ๋˜์–ด ์žˆ์ง€ ์•Š์Šต๋‹ˆ๋‹ค. ๋˜ํ•œ ๋น„๊ต๋ฅผ ์œ„ํ•ด .npmrc ํŒŒ์ผ์ด ์—†์œผ๋ฉด ๋ฌธ์ œ๋ฅผ ์ •ํ™•ํžˆ ์ง€์ ํ•˜๊ธฐ๊ฐ€ ์–ด๋ ต์Šต๋‹ˆ๋‹ค.

์‚ฌ์šฉ ์‚ฌ๋ก€๋Š” ^ 1.4.0์—์„œ ์ž˜ ์ž‘๋™ํ•˜์ง€๋งŒ ๊ตฌ์„ฑ ํŒŒ์ผ์ด ์–ด๋–ป๊ฒŒ ๋ณด์ด๋Š”์ง€์— ๊ด€ํ•œ ๊ฒƒ์ž…๋‹ˆ๋‹ค.

๋‹น์‹ ๊ณผ ํ•จ๊ป˜ Tbh, ๋‚˜๋Š” yarn login ์‚ฌ์šฉํ•˜์ง€ ์•Š๊ณ  ๋จผ์ € npm login ์„ ์‚ฌ์šฉํ•œ ๋‹ค์Œ yarn ํ•ฉ๋‹ˆ๋‹ค. ๋‹น์‹ ์˜ ์œ„์˜ ์˜ˆ์—์„œ, ๋จผ์ € ํ•  ๊ฒฝ์šฐ npm set config registry ... && npm login ๋‹ค์Œ ์‹คํ–‰ add left-pad - ๊ทธ๊ฒƒ์€ ์ž‘๋™ํ•ฉ๋‹ˆ๊นŒ? npm์ด ์ž‘๋™ํ•˜๋ฉด ์‹ค๋„ ๋งˆ์ฐฌ๊ฐ€์ง€์ž…๋‹ˆ๋‹ค. ๊ทธ๋ž˜์„œ yarn login ๋ช…๋ น์ด ๊นจ ์กŒ๋Š”์ง€ ๊ถ๊ธˆํ•ฉ๋‹ˆ๋‹ค.

๋ฌด์‹œ @KidkArolis yarn login ํ•˜๊ณ  ์ˆ˜ ์žˆ๊ธฐ๋ฅผ ๊ธฐ๋Œ€ ๊ทธ๊ฒƒ์€ ๋‹จ์ง€ ์ž‘์—…์„ ์–ป์„ npm login , ๋‚˜๋Š” ์•ฝ๊ฐ„์˜ ์ง„์ „์„ ํ•  ์ˆ˜ ์žˆ์—ˆ๋‹ค. ๋‚˜๋Š” ๋‘ ๊ฐ€์ง€๋ฅผ๋ณด๊ณ ์žˆ๋‹ค.

.npmrc

npm-login์— ๋Œ€ํ•œ ๋ฌธ์„œ๊ฐ€ ์‹ค์ œ๋กœ .npmrc ์—์„œ ๋ณด๋Š” ๊ฒƒ๊ณผ ์ผ์น˜ํ•˜์ง€ ์•Š๋Š” ๊ฒƒ ๊ฐ™์Šต๋‹ˆ๋‹ค. ํŠนํžˆ npm login ๋ช…๋ น์— ๋Œ€ํ•œ --always-auth ์ธ์ˆ˜๋Š” ๋ฌธ์„œ์—์„œ ๋‹ค์Œ๊ณผ ๊ฐ™์ด ๋งํ•˜๋”๋ผ๋„ ๊ตฌ์„ฑ์— ์˜ํ–ฅ์„์ฃผ์ง€ ์•Š์Šต๋‹ˆ๋‹ค.

--registry ๋ฐ / ๋˜๋Š” --scope์™€ ํ•จ๊ป˜ ์‚ฌ์šฉํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.
...
always-auth์˜ ๋ ˆ์ง€์ŠคํŠธ๋ฆฌ ๋ณ„ ๊ตฌ์„ฑ์€ ๋ชจ๋“  ์ „์—ญ ๊ตฌ์„ฑ๋ณด๋‹ค ์šฐ์„ ํ•ฉ๋‹ˆ๋‹ค.

๊ทธ๋Ÿฌ๋‚˜ ํ•ด๋‹น ์ธ์ˆ˜๋ฅผ ์‚ฌ์šฉํ•˜๋Š”์ง€ ์—ฌ๋ถ€์— ๊ด€๊ณ„์—†์ด ํ•ญ์ƒ ๋™์ผํ•œ .npmrc ๋๋‚ฉ๋‹ˆ๋‹ค. ์–‘์ž ๋ชจ๋‘:

npm config set registry https://example.com/repository/npm-group/ \
  && npm login --registry=https://example.com/repository/npm-group/

๊ณผ

npm config set registry https://example.com/repository/npm-group/ \
  && npm login --registry=https://example.com/repository/npm-group/ --always-auth

.npmrc :

registry=https://example.com/repository/npm-group/
//example.com/repository/npm-group/:_authToken=NpmToken.XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

๋‚ด ๋ ˆ์ง€์ŠคํŠธ๋ฆฌ๋กœ ์ด๋™ํ•˜๋Š” ํŠธ๋ž˜ํ”ฝ์„ ์Šค๋‹ˆํ•‘ํ•˜๋ฉด NPM์ด ๋‹ค์Œ๊ณผ ์ƒ๊ด€์—†์ด ์ธ์ฆ ํ† ํฐ์„ ๋ณด๋‚ธ๋‹ค๋Š” ๊ฒƒ์„ ๋ณด์—ฌ์ค๋‹ˆ๋‹ค.

GET /repository/npm-group/left-pad HTTP/1.1
Host: example.com
user-agent: npm/5.6.0 node/v8.9.4 linux x64
npm-in-ci: false
npm-scope: 
npm-session: c4c14c0b37be7bd5
referer: install left-pad
pacote-req-type: packument
pacote-pkg-id: registry:manifest
accept: application/vnd.npm.install-v1+json; q=1.0, application/json; q=0.8, */*
authorization: Bearer NpmToken.XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
accept-encoding: gzip,deflate
X-Forwarded-Proto: https
X-Forwarded-For: 10.10.10.1
X-Forwarded-Host: example.com
X-Forwarded-Server: example.com
Connection: Keep-Alive

Yarn์€ always-auth ๊ฐ€ ์„ค์ •๋˜์–ด ์žˆ์ง€ ์•Š์œผ๋ฉด ํ† ํฐ์„ ๋ณด๋‚ด์ง€ ์•Š์Šต๋‹ˆ๋‹ค . .npmrc ์—์„œ always-auth ํ”Œ๋ž˜๊ทธ๋ฅผ ๋ช…์‹œ ์ ์œผ๋กœ ์„ค์ •ํ•˜๋ฉด ๋ชจ๋“  ๊ฒƒ์ด ์˜ˆ์ƒ๋Œ€๋กœ ์ž‘๋™ํ•ฉ๋‹ˆ๋‹ค.

npm config set always-auth true \
    && cat ~/.npmrc
registry=https://example.com/repository/npm-group/
//example.com/repository/npm-group/:_authToken=NpmToken.XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
always-auth=true

NPM๊ณผ Yarn ์‚ฌ์ด์˜ ๋™์ž‘์ด ๋‹ค๋ฅด๋‹ค๋Š” ๊ฒƒ์„ ์•„๋Š” ๊ฒƒ ์™ธ์—๋„ ์–ด๋–ค ๋™์ž‘์ด ์˜ฌ๋ฐ”๋ฅธ์ง€ ์•Œ๊ธฐ์— ์ถฉ๋ถ„ํžˆ ์ต์ˆ™ํ•˜์ง€ ์•Š์Šต๋‹ˆ๋‹ค.

yarn login

์ž‘๋™ํ•˜์ง€ ์•Š๋Š” yarn login ์— ๋Œ€ํ•ด ์˜ณ๋‹ค๊ณ  ์ƒ๊ฐํ•˜์ง€๋งŒ ๊ด‘๋ฒ”์œ„ํ•˜๊ฒŒ ํ…Œ์ŠคํŠธํ•˜์ง€๋Š” ์•Š์•˜์Šต๋‹ˆ๋‹ค. .npmrc ๋ฌด์‹œํ•˜๊ณ  yarn ๋งŒ ์‚ฌ์šฉํ•˜์—ฌ NPM ๊ตฌ์„ฑ์„ ๋ชจ๋ฐฉํ•˜๋ ค๊ณ ํ•ฉ๋‹ˆ๋‹ค.

yarn config set registry https://example.com/repository/npm-group/ \
    && yarn config set always-auth true \
    && yarn login

.yarnrc :

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


registry "https://example.com/repository/npm-group/"
always-auth true
email [email protected]
lastUpdateCheck 1517883362958
username myusername

๋‚ด๊ฐ€ ๋ฌด์—‡์„ํ•˜๋“  ๋‚ด ๋น„๋ฐ€๋ฒˆํ˜ธ๋ฅผ ์ž…๋ ฅํ•˜๋ผ๋Š” ๋ฉ”์‹œ์ง€๊ฐ€ ํ‘œ์‹œ๋˜์ง€ ์•Š์Šต๋‹ˆ๋‹ค.

@KidkArolis ๋‚˜๋ฅผ ์œ„ํ•ด npm์€ always-auth=true ์—†์ด ์ž‘๋™ํ•˜๊ณ  yarn (1.3.2 ๋˜๋Š” 1.4.0)์€ ๊ทธ๋ ‡์ง€ ์•Š์Šต๋‹ˆ๋‹ค. ์ œ ๊ฒฝ์šฐ์—๋Š” ๋ชจ๋“  ์š”์ฒญ์„ ์•„ํ‹ฐ ํŒฉํ† ๋ฆฌ์˜ ๊ฐ€์ƒ ๋ ˆ์ง€์ŠคํŠธ๋ฆฌ๋กœ ์ง€์ •ํ•˜๋ ค๊ณ ํ•ฉ๋‹ˆ๋‹ค. .npmrc์—์„œ always-auth=true ๋ฐ authToken โ€“ 1.3.2 ์—์„œ ์ž‘๋™ํ•˜๋ฏ€๋กœ 1.4.0 ์—์„œ ์ •ํ™•ํžˆ ๋ฌด์—‡์ด ์ˆ˜์ •๋˜์—ˆ๋Š”์ง€ ๋ช…ํ™•ํ•˜์ง€ ์•Š์Šต๋‹ˆ๋‹ค.

์ด๊ฒƒ์€ ์—ฌ์ „ํžˆ โ€‹โ€‹๋ฌธ์ œ ์ธ ๊ฒƒ ๊ฐ™์Šต๋‹ˆ๋‹ค. ํŠนํžˆ Nexus ์ €์žฅ์†Œ์— ์—ฐ๊ฒฐ๋ฉ๋‹ˆ๋‹ค.

๋ช‡ ๊ฐ€์ง€ ์ ‘๊ทผ ๋ฐฉ์‹์„ ์‹œ๋„ํ–ˆ์Šต๋‹ˆ๋‹ค.

  1. ์‚ญ์ œ ๋‚ด ~/.yarnrc ์™„์ „ํžˆ์— ์–ด๋–ค์—๋งŒ ์˜์กด ~/.npmrc .
  2. ~/.yarnrc ๋ ˆ์ง€์ŠคํŠธ๋ฆฌ ์„ค์ •์— ๋Œ€ํ•ด ์•Œ์•„ ๋ด…๋‹ˆ๋‹ค.

์ด๋Š” ์–€์€ ํ•ด์‹œ ์‚ฌ์šฉํ•˜์ง€ ์•Š๋Š” ๊ฒƒ _auth ๊ฐ’ (์˜ˆ๋ฅผ ๋“ค์–ด _auth=xyz )์—์„œ ~/.npmrc

๋ฒ„์ „ ์ •๋ณด

NPM

npm --version                                                                                                                                                                                                                                                                                                      
5.6.0

์‹ค

yarn --version
1.5.1

OS X 10.13.2์—์„œ ์‹คํ–‰ ์ค‘์ž…๋‹ˆ๋‹ค.

NPMRC

๋‚ด ~/.npmrc ์€ ๋‹ค์Œ๊ณผ ๊ฐ™์Šต๋‹ˆ๋‹ค (๋ช…๋ฐฑํ•œ ์ด์œ ๋กœ ์ผ๋ถ€ ์„ค์ • _values_ ์ƒ๋žต).

registry=http://nexus-repo:8081/content/repositories/npm-all
init.author.name=Juan Smith
[email protected]
init.author.url=http://nexus-repo:8081/content/repositories/npm/
[email protected]
_auth=BASE64-HASH-USERNAME-PASSWORD
always-auth=true

์›์‚ฌ

๋‚ด ~/.yarnrc ์€ ๋‹ค์Œ๊ณผ ๊ฐ™์Šต๋‹ˆ๋‹ค (๋‹ค์‹œ ํ•œ ๋ฒˆ ๋ถ„๋ช…ํ•œ ๊ฐ’์€ ์ƒ๋žต ๋จ).

registry "http://nexus-repo:8081/content/repositories/npm-all//"
email [email protected]
lastUpdateCheck 1521495247797
username jsmith

ยฏ_ (ใƒ„) _ / ยฏ

์—ฌ๊ธฐ์„œ ์–ด๋””๋กœ ๊ฐ€์•ผํ• ์ง€ ๋ชจ๋ฅด๊ฒ ์Šต๋‹ˆ๋‹ค. ๋ชจ๋“  ์›์‚ฌ ๋นŒ๋“œ๊ฐ€ ๋‹ค์Œ๊ณผ ๊ฐ™์€ ๋ฐฉ์‹์œผ๋กœ ์‹คํŒจํ•œ๋‹ค๋Š” ์ ์„ ์ œ์™ธํ•˜๊ณ ๋Š” ๋ฌด์Šจ ์ผ์ด ์ผ์–ด๋‚˜๊ณ  ์žˆ๋Š”์ง€ ์™„์ „ํžˆ ๋ช…ํ™•ํ•˜์ง€ ์•Š์Šต๋‹ˆ๋‹ค.

error An unexpected error occurred: "http://nexus-repo:8081/content/groups/npm-all/lru-cache/-/lru-cache-4.1.2.tgz: Request failed \"401 Unauthorized\"".

FWIW, IANADOE (I Am Not A Dev Ops Engineer)๋Š” ์ „์ž ๋นŒ๋“œ๋ฅผ ์œ„ํ•ด ์›์‚ฌ์— ์˜์ง€ํ•˜๋Š” ํŒจํ‚ค์ง€๋ฅผ ํ™œ์šฉํ•˜๋ ค๊ณ ํ•ฉ๋‹ˆ๋‹ค. ์ด๊ฒƒ์€ ์›์‚ฌ์— ๋Œ€ํ•ด base64 username | password ํ•ด์‹œ๋ฅผ ์„ค์ •ํ•˜๋Š” ๋ฐฉ๋ฒ•์„ ๋ชจ๋ฅผ ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค. ๋‚˜๋Š” ๊ทธ๊ฒƒ์„ ์„ค๋ช…ํ•˜๋Š” ๋ฌธ์„œ๋ฅผ ์ฐพ์„ ์ˆ˜ ์—†์—ˆ๋‹ค.

@ezweave Sonatype์€ ์ •๋ง ์ข‹์€ ๋ฌธ์„œ๋ฅผ ๊ฐ€์ง€๊ณ  npm Bearer Token Realm ์„ ํ™œ์„ฑํ™”ํ•˜๊ณ  ์›Œํฌ ์Šคํ…Œ์ด์…˜์—์„œ npm login ๋ฅผ ์‚ฌ์šฉํ•˜๋Š” ๊ฒƒ์ด ๊ฐ€์žฅ ์‰ฝ์Šต๋‹ˆ๋‹ค. ์ „์˜:

npm config set registry http://nexus-repo:8081/content/repositories/npm-all
npm login --registry=http://nexus-repo:8081/content/repositories/npm-all --always-auth
npm config set always-auth true

Yarn์„ ์‹œ๋„ํ•˜๊ธฐ ์ „์— NPM์—์„œ ์ž‘๋™ํ•˜๋Š”์ง€ ํ™•์ธํ•˜์‹ญ์‹œ์˜ค. ์ค‘์š”ํ•œ์ง€ ๋ชจ๋ฅด๊ฒ ์ง€๋งŒ .yarnrc ๋ ˆ์ง€์ŠคํŠธ๋ฆฌ์— ๋‘ ๊ฐœ์˜ ํ›„ํ–‰ ์Šฌ๋ž˜์‹œ ( // )๊ฐ€ ์žˆ์Šต๋‹ˆ๋‹ค.

@ryanjaeb ๊ทธ๋ž˜์„œ ์šฐ๋ฆฌ devops ํŒ€์€ _only_ LDAP Realm์„ ์ง€์›ํ•˜๋„๋ก Nexus๋ฅผ ์ž ๊ฐ”์Šต๋‹ˆ๋‹ค. ์ด๊ฒƒ์ด ๋ฌธ์ œ์˜ ํ•ต์‹ฌ ์ผ ์ˆ˜ ์žˆ์ง€๋งŒ yarn ์— ์˜์กดํ•˜๋Š” ๋งŽ์€ ๋„๊ตฌ๊ฐ€ ์ง€์›๋˜์ง€ ์•Š๋Š” ๊ฒƒ ๊ฐ™์•„์„œ ์‚ฌ์šฉํ•  ์ˆ˜ ์—†์Šต๋‹ˆ๋‹ค. ์ ์ ˆํ•œ ๊ตฌ๋ฌธ ๋“ฑ์˜ ๋งค๊ฐœ ๋ณ€์ˆ˜๋กœ _auth ์„ ์ถ”๊ฐ€ํ•˜๋ ค๊ณ ํ–ˆ์Šต๋‹ˆ๋‹ค. ์•„๋ฌด๊ฒƒ๋„ ์ž‘๋™ํ•˜์ง€ ์•Š๋Š” ๊ฒƒ ๊ฐ™์Šต๋‹ˆ๋‹ค. (FWIW : ์—ฌ๋Ÿฌ ๊ฐœ์˜ ์Šฌ๋ž˜์‹œ๊ฐ€ ๊ด€๋ จ ๋ฌธ์ œ์— ๋Œ€ํ•œ ์ˆ˜์ •์ด๋ผ๊ณ  ๊ฐ€์ •ํ–ˆ์Šต๋‹ˆ๋‹ค. ์„ฑ๊ณต ์—ฌ๋ถ€์— ๊ด€๊ณ„์—†์ด ์ˆ˜ํ–‰ํ–ˆ์Šต๋‹ˆ๋‹ค.)

Nexus์—์„œ Yarn ์ธ์ฆ์ด ๊นจ ์กŒ์Œ์„ ํ™•์ธํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค. yarn login ๋Š” ์•”ํ˜ธ๋ฅผ ๋ฌป๋Š” ๋ฉ”์‹œ์ง€๋ฅผ ํ‘œ์‹œํ•˜์ง€ ์•Š์ง€๋งŒ ์„ฑ๊ณต์ ์œผ๋กœ ๋กœ๊ทธ์ธ๋˜์—ˆ๋‹ค๊ณ  ๋งํ•ฉ๋‹ˆ๋‹ค (๊ทธ๋ ‡์ง€ ์•Š์•˜์Šต๋‹ˆ๋‹ค-rc ํŒŒ์ผ์— ๋Œ€ํ•œ ๋ณ€๊ฒฝ ์‚ฌํ•ญ ์—†์Œ).

๊ฒŒ์‹œ๋Š” ์•”ํ˜ธ๋ฅผ ์ž…๋ ฅํ•˜๋ผ๋Š” ๋ฉ”์‹œ์ง€๋ฅผ ํ‘œ์‹œํ•˜๊ณ  ๊ฒŒ์‹œํ•˜์ง€๋งŒ ๋งค๋ฒˆ ๋กœ๊ทธ์ธํ•ด์•ผํ•˜๋Š” ๊ฒฝ์šฐ __auth ํ† ํฐ์—์„œ ์ฝ์ง€ ์•Š์Šต๋‹ˆ๋‹ค. ๋˜ํ•œ CI ์‹œ๋‚˜๋ฆฌ์˜ค์—์„œ ์›์‚ฌ๋ฅผ ์‚ฌ์šฉํ•  ์ˆ˜ ์—†์Šต๋‹ˆ๋‹ค.

์› ์‚ฌ๋Š” CI ๋‚ด์—์„œ ์ž‘๋™ํ•˜์ง€ ์•Š์Šต๋‹ˆ๋‹ค. ์ด๊ฒƒ์ด ์ž‘๋™ํ• ๊นŒ์š”?

์ด ๋ฌธ์ œ๋Š” https://github.com/yarnpkg/yarn/pull/5216 ์—์„œ ํ•ด๊ฒฐ๋˜์—ˆ์Šต๋‹ˆ๋‹ค

Fixes #4157, #4451, #4672, #4119.

์ด๋กœ ์ธํ•ด PR์ด ๋ณ‘ํ•ฉ ๋  ๋•Œ GitHub๊ฐ€ # 4157 ๋งŒ ์ž๋™์œผ๋กœ ๋‹ซํ˜”์Šต๋‹ˆ๋‹ค. ๋‹ค๋ฅธ ๋ฌธ์ œ๋„ ํ•ด๊ฒฐ๋˜์—ˆ์„ ๊ฒƒ์ž…๋‹ˆ๋‹ค.

@valscion ์ด๊ฒƒ์€ https://github.com/yarnpkg/yarn/pull/5322 ์™€ ๊ฐ™์€ ๋ฌธ์ œ์— ๋” ๋„์›€์ด ๋  ์ˆ˜ ์žˆ์ง€๋งŒ ๊ท ์—ด์„ ํ†ตํ•ด ๋ฏธ๋„๋Ÿฌ์กŒ์Šต๋‹ˆ๋‹ค ..

๋‹ค๋ฅธ ๋ฐ์ดํ„ฐ ํฌ์ธํŠธ ์ถ”๊ฐ€-yarn 1.8.x +๊ฐ€ ๋นŒ๋“œ ์—์ด์ „ํŠธ (VSTS)์—์„œ ์‹คํŒจํ•ฉ๋‹ˆ๋‹ค. yarn 1.7.x๋กœ ๋˜ ๋Œ๋ฆฌ๋ฉด ๋ฌธ์ œ๊ฐ€ ํ•ด๊ฒฐ๋ฉ๋‹ˆ๋‹ค. ์˜ฌ๋ฐ”๋ฅธ ๋ ˆ์ง€์ŠคํŠธ๋ฆฌ๋ฅผ๋ณด๊ณ  ์žˆ์ง€๋งŒ ๋นŒ๋“œ ์—์ด์ „ํŠธ๊ฐ€ .npmrc ์— ์‚ฝ์ž… ํ•œ ํ† ํฐ์„ ์‚ฌ์šฉํ•˜์ง€ ์•Š์Šต๋‹ˆ๋‹ค. ์—ฌ๊ธฐ์— ๋งŽ์€ ๋ณ€์ˆ˜๊ฐ€ ์žˆ๋‹ค๋Š” ๊ฒƒ์„ ์•Œ๊ณ  ์žˆ์ง€๋งŒ ์œ ์šฉ ํ•  ๊ฒƒ์ด๋ผ๊ณ  ์ƒ๊ฐํ–ˆ์Šต๋‹ˆ๋‹ค.

๋‚ด ์‚ฌ์šฉ์ž .npmrc ํ† ํฐ์ด ์ €์žฅ๋˜๋Š” 1.9.x๋ฅผ ๋กœ์ปฌ์—์„œ ์‹คํ–‰ํ•˜๋ฉด ์ •์ƒ์ ์œผ๋กœ ์ž‘๋™ํ•ฉ๋‹ˆ๋‹ค.

1.9.x ๋ฒ„์ „

2018-08-03T21:17:04.9324575Z [command]C:\Windows\system32\cmd.exe /D /S /C "C:\Builds\_tool\yarn\1.9.4\x64\yarn-v1.9.4\bin\yarn.cmd build"
2018-08-03T21:17:05.4481355Z yarn run v1.9.4
2018-08-03T21:17:05.5418442Z $ lerna clean && lerna bootstrap
2018-08-03T21:17:08.3387809Z lerna info version 2.11.0
2018-08-03T21:17:08.3387809Z lerna info versioning independent
2018-08-03T21:17:08.3856545Z lerna info clean removing <REMOVED>
2018-08-03T21:17:08.3856545Z lerna info clean removing <REMOVED>
2018-08-03T21:17:08.3856545Z lerna info clean removing <REMOVED>
2018-08-03T21:17:08.3856545Z lerna info clean removing <REMOVED>
2018-08-03T21:17:08.4012821Z lerna info clean removing <REMOVED>
2018-08-03T21:17:08.4012821Z lerna info clean removing <REMOVED>
2018-08-03T21:17:08.4169058Z lerna info clean removing <REMOVED>
2018-08-03T21:17:08.4325326Z lerna info clean removing <REMOVED>
2018-08-03T21:17:08.4325326Z lerna info clean removing <REMOVED>
2018-08-03T21:17:08.7606628Z lerna success clean finished
2018-08-03T21:17:09.5145894Z lerna info version 2.11.0
2018-08-03T21:17:09.5145894Z lerna info versioning independent
2018-08-03T21:17:09.5419287Z lerna info Bootstrapping 9 packages
2018-08-03T21:17:09.5419287Z lerna info lifecycle preinstall
2018-08-03T21:17:09.5576221Z lerna info Installing external dependencies
2018-08-03T21:17:12.8857424Z lerna ERR! execute callback with error
2018-08-03T21:17:12.8857424Z lerna ERR! Error: Command failed: yarn install --mutex network:42424 --non-interactive
2018-08-03T21:17:12.8857424Z lerna ERR! warning package.json: No license field
2018-08-03T21:17:12.8857424Z lerna ERR! warning Waiting for the other yarn instance to finish (4048)
2018-08-03T21:17:12.8857424Z lerna ERR! warning Waiting for the other yarn instance to finish (6896)
2018-08-03T21:17:12.8857424Z lerna ERR! warning No license field
2018-08-03T21:17:12.8857424Z lerna ERR! error An unexpected error occurred: "<INTERNAL_REGISTRY>/lodash.foreach/-/lodash.foreach-2.3.0.tgz: Request failed \"401 Unauthorized\"".
2018-08-03T21:17:12.8857424Z lerna ERR! [1/4] Resolving packages...
2018-08-03T21:17:12.8857424Z lerna ERR! [2/4] Fetching packages...
2018-08-03T21:17:12.8857424Z lerna ERR! info If you think this is a bug, please open a bug report with the information provided in "C:\\Builds\\6\\s\\packages\\<REMOVED>\\yarn-error.log".
2018-08-03T21:17:12.8857424Z lerna ERR! info Visit https://yarnpkg.com/en/docs/cli/install for documentation about this command.
2018-08-03T21:17:12.8857424Z lerna ERR! 
2018-08-03T21:17:12.8857424Z lerna ERR!     at Promise.all.then.arr (C:\Builds\6\s\node_modules\lerna\node_modules\execa\index.js:236:11)
2018-08-03T21:17:12.8857424Z lerna ERR!     at <anonymous>
2018-08-03T21:17:12.9482437Z lerna WARN complete Waiting for 1 child process to exit. CTRL-C to exit immediately.
2018-08-03T21:17:13.0732458Z { Error: Command failed: yarn install --mutex network:42424 --non-interactive
2018-08-03T21:17:13.0732458Z warning package.json: No license field
2018-08-03T21:17:13.0732458Z warning Waiting for the other yarn instance to finish (4048)
2018-08-03T21:17:13.0732458Z warning Waiting for the other yarn instance to finish (6896)
2018-08-03T21:17:13.0732458Z warning No license field
2018-08-03T21:17:13.0732458Z error An unexpected error occurred: "<INTERNAL_REGISTRY>/lodash.foreach/-/lodash.foreach-2.3.0.tgz: Request failed \"401 Unauthorized\"".
2018-08-03T21:17:13.0732458Z [1/4] Resolving packages...
2018-08-03T21:17:13.0732458Z [2/4] Fetching packages...
2018-08-03T21:17:13.0732458Z info If you think this is a bug, please open a bug report with the information provided in "C:\\Builds\\6\\s\\packages\\<REMOVED>\\yarn-error.log".
2018-08-03T21:17:13.0732458Z info Visit https://yarnpkg.com/en/docs/cli/install for documentation about this command.
2018-08-03T21:17:13.0732458Z 
2018-08-03T21:17:13.0732458Z     at Promise.all.then.arr (C:\Builds\6\s\node_modules\lerna\node_modules\execa\index.js:236:11)
2018-08-03T21:17:13.0732458Z     at <anonymous>
2018-08-03T21:17:13.0732458Z     at process._tickCallback (internal/process/next_tick.js:188:7)
2018-08-03T21:17:13.0732458Z   code: 1,
2018-08-03T21:17:13.0732458Z   killed: false,
2018-08-03T21:17:13.0732458Z   stdout: '[1/4] Resolving packages...\n[2/4] Fetching packages...\ninfo If you think this is a bug, please open a bug report with the information provided in "C:\\\\Builds\\\\6\\\\s\\\\packages\\\\<REMOVED>\\\\yarn-error.log".\ninfo Visit https://yarnpkg.com/en/docs/cli/install for documentation about this command.\n',
2018-08-03T21:17:13.0732458Z   stderr: 'warning package.json: No license field\nwarning Waiting for the other yarn instance to finish (4048)\nwarning Waiting for the other yarn instance to finish (6896)\nwarning No license field\nerror An unexpected error occurred: "<INTERNAL_REGISTRY>/lodash.foreach/-/lodash.foreach-2.3.0.tgz: Request failed \\"401 Unauthorized\\"".\n',
2018-08-03T21:17:13.0732458Z   failed: true,
2018-08-03T21:17:13.0732458Z   signal: null,
2018-08-03T21:17:13.0732458Z   cmd: 'yarn install --mutex network:42424 --non-interactive',
2018-08-03T21:17:13.0732458Z   timedOut: false,
2018-08-03T21:17:13.0732458Z   exitCode: 1 }
2018-08-03T21:17:13.0888721Z error Command failed with exit code 1.
2018-08-03T21:17:13.0888721Z info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

1.7.X ๋ฒ„์ „

2018-08-03T21:33:16.4477199Z [command]C:\Windows\system32\cmd.exe /D /S /C "C:\Builds\_tool\yarn\1.7.0\x64\yarn-v1.7.0\bin\yarn.cmd build"
2018-08-03T21:33:16.9633413Z yarn run v1.7.0
2018-08-03T21:33:17.0727225Z $ lerna clean && lerna bootstrap
2018-08-03T21:33:19.2509802Z lerna info version 2.11.0
2018-08-03T21:33:19.2509802Z lerna info versioning independent
2018-08-03T21:33:19.2666043Z lerna info clean removing <REMOVED>
2018-08-03T21:33:19.2666043Z lerna info clean removing <REMOVED>
2018-08-03T21:33:19.2666043Z lerna info clean removing <REMOVED>
2018-08-03T21:33:19.2666043Z lerna info clean removing <REMOVED>
2018-08-03T21:33:19.2978554Z lerna info clean removing <REMOVED>
2018-08-03T21:33:19.5478528Z lerna info clean removing <REMOVED>
2018-08-03T21:33:19.5478528Z lerna info clean removing <REMOVED>
2018-08-03T21:33:19.5478528Z lerna info clean removing <REMOVED>
2018-08-03T21:33:19.6728520Z lerna info clean removing <REMOVED>
2018-08-03T21:33:19.8759839Z lerna success clean finished
2018-08-03T21:33:20.5947225Z lerna info version 2.11.0
2018-08-03T21:33:20.5947225Z lerna info versioning independent
2018-08-03T21:33:20.6103497Z lerna info Bootstrapping 9 packages
2018-08-03T21:33:20.6103497Z lerna info lifecycle preinstall
2018-08-03T21:33:20.6415982Z lerna info Installing external dependencies
2018-08-03T21:33:23.1103303Z lerna info Symlinking packages and binaries
2018-08-03T21:33:23.1415791Z lerna info lifecycle postinstall
2018-08-03T21:33:23.1415791Z lerna info lifecycle prepublish
2018-08-03T21:33:23.1415791Z lerna info lifecycle prepare
2018-08-03T21:33:23.1415791Z lerna success Bootstrapped 9 packages
2018-08-03T21:33:23.1572133Z $ ts-node ./build/index.ts
2018-08-03T21:33:58.5218101Z Done in 41.54s.

์•ˆ๋…•ํ•˜์„ธ์š” ์—ฌ๋Ÿฌ๋ถ„,์ด ๋ฌธ์ œ๋ฅผ ํŒ”๋กœ์šฐํ•˜๊ณ  ๊ฐœ์ธ ๋ ˆ์ง€์ŠคํŠธ๋ฆฌ๋ฅผ ์‚ฌ์šฉํ•˜๋Š” ์‚ฌ๋žŒ๋“ค์—๊ฒŒ ์š”์ฒญ์ด ์žˆ์Šต๋‹ˆ๋‹ค.

์ž ๊ธˆ ํŒŒ์ผ์—์„œ ๋ ˆ์ง€์ŠคํŠธ๋ฆฌ ํ˜ธ์ŠคํŠธ ์ด๋ฆ„ ์„ ํ•˜๊ณ  ์žˆ์Šต๋‹ˆ๋‹ค . ์ด๋ ‡๊ฒŒํ•˜๋ฉด ๊ฐœ์ธ ๋ ˆ์ง€์ŠคํŠธ๋ฆฌ์—์„œ ๋‹ค๋ฅธ ๋ ˆ์ง€์ŠคํŠธ๋ฆฌ๋กœ ์‰ฝ๊ฒŒ ์ „ํ™˜ ํ•  ์ˆ˜ ์žˆ์ง€๋งŒ ๋‹จ์ ์€ ๋ชจ๋“  ๋ ˆ์ง€์ŠคํŠธ๋ฆฌ๊ฐ€ ์œ ์‚ฌํ•œ URL์„ ์‚ฌ์šฉํ•ด์•ผํ•œ๋‹ค๋Š” ๊ฒƒ์ž…๋‹ˆ๋‹ค (ํ˜ธ์ŠคํŠธ ์ด๋ฆ„์ด URL์˜ ์ผ๋ถ€๊ฐ€ ์•„๋‹ˆ๊ธฐ ๋•Œ๋ฌธ์— ๋Ÿฐํƒ€์ž„์— ํ™œ์„ฑ ๊ตฌ์„ฑ).

# 5892์—์„œ์ด ์›Œํฌ ํ”Œ๋กœ๊ฐ€ ๊ฐœ์ธ ๋ ˆ์ง€์ŠคํŠธ๋ฆฌ ์ œ๊ณต ์—…์ฒด์—์„œ ์ž‘๋™ํ•˜๋Š”์ง€ ํ™•์ธํ•˜๋Š” ๋ฐ ๋„์›€์„ ์ฃผ์‹œ๊ฒ ์Šต๋‹ˆ๊นŒ (๋˜๋Š” ๊ทธ๋ ‡์ง€ ์•Š์€ ๊ฒฝ์šฐ ์•Œ๋ ค์ฃผ์„ธ์š”)? ์ด๋ ‡๊ฒŒํ•˜๋ฉด ์ด๋Ÿฌํ•œ ๋ณ€ํ™”๋ฅผ ๋งŒ๋“œ๋Š” ๋ฐ ํ•„์š”ํ•œ ์ˆ˜์ค€์˜ ์ž์‹ ๊ฐ์„ ์–ป์„ ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค. ๊ฐ์‚ฌ!

yarn publish ๋‚ด .npmrc ์—์„œ ์ธ์ฆ ํ† ํฐ์„ ์ฝ์ง€ ๋ชปํ•˜๋Š” ๋ฌธ์ œ๊ฐ€ ๋ฐœ์ƒํ•ฉ๋‹ˆ๋‹ค. ๋‚˜๋Š” ์ด๊ฒƒ์„ ์šฐ๋ถ„ํˆฌ์—์„œ ์‹คํ–‰ํ•˜๊ณ  ์žˆ์Šต๋‹ˆ๋‹ค.

๋ฒ„์ „

์›์‚ฌ-1.9.4
npm-5.5.1

~ / .npmrc

๋‹ค์Œ์€ ๋‚ด ~/.npmrc ๋ชจ์Šต์ž…๋‹ˆ๋‹ค (ํ† ํฐ ๋ฐ ๋ ˆ์ง€์ŠคํŠธ๋ฆฌ๊ฐ€ ๋‚œ๋… ํ™”๋จ).

registry=http://myprivateregistry.net/
//myprivateregistry.net/:_authToken="myAuthToken"

์‚ฐ์ถœ

yarn publish --noninteractive ์‹คํ–‰ํ•˜๋ฉด ๋‹ค์Œ ์˜ค๋ฅ˜๊ฐ€ ํ‘œ์‹œ๋ฉ๋‹ˆ๋‹ค.

yarn publish v1.9.4
[1/4] Bumping version...
info Current version: 2.1.3
[2/4] Logging in...
error No token found and can't prompt for login when running with --non-interactive.
info Visit https://yarnpkg.com/en/docs/cli/publish for documentation about this command.

๋””๋ฒ„๊ทธ ๋‹จ๊ณ„

๋‚˜๋Š” ์†Œ์šฉ์ด์—†๋Š” ๋‹ค์Œ์„ ์‹œ๋„ํ–ˆ์Šต๋‹ˆ๋‹ค.

  • ~/.npmrc ๋ฅผ ๋‚ด ํ”„๋กœ์ ํŠธ ๋””๋ ‰ํ† ๋ฆฌ์˜ ๋กœ์ปฌ .npmrc ์— ๋ณต์‚ฌ
  • yarn publish ์‹คํ–‰ํ•˜๊ธฐ ์ „์— ๋‚ด ์ž๊ฒฉ ์ฆ๋ช…์œผ๋กœ yarn login ์‹คํ–‰

๋˜ํ•œ npm publish ๋ฅผ ์‹คํ–‰ํ•˜๋ฉด ์ธ์ฆ ๋‹จ๊ณ„๋ฅผ ํ†ต๊ณผํ•˜๋Š” ๊ฒƒ์œผ๋กœ ํ™•์ธ๋˜์—ˆ์Šต๋‹ˆ๋‹ค (๋™์ผํ•œ ๋ฒ„์ „ ๋ฒˆํ˜ธ๋ฅผ ์žฌ์ •์˜ ํ•  ์ˆ˜ ์—†๊ธฐ ๋•Œ๋ฌธ์— ๋ฒ„์ „ ๊ด€๋ฆฌ ๋‹จ๊ณ„์—์„œ ์‹คํŒจํ•ฉ๋‹ˆ๋‹ค. ์ด๊ฒƒ์ด ์ œ๊ฐ€ yarn publish --non-interactive ์„ ์‚ฌ์šฉํ•˜๋Š” ์ด์œ ์ž…๋‹ˆ๋‹ค.)

๋‚ด๊ฐ€ ๋†“์นœ ๋‹ค๋ฅธ ๊ฒƒ์ด ์žˆ์Šต๋‹ˆ๊นŒ? ๊ฐ์‚ฌ!

@ liuhelen10 ํ”„๋กœ์ ํŠธ์— .yarnrc ํŒŒ์ผ์ด ์žˆ์Šต๋‹ˆ๊นŒ? ์ด๊ฒƒ์€ ~/.npmrc ์•ˆ์— ์ €์žฅ๋œ ํ† ํฐ์œผ๋กœ ๋‚˜๋ฅผ ์œ„ํ•ด ์ผํ–ˆ์Šต๋‹ˆ๋‹ค.

์˜ˆ

$ cat .yarnrc 
registry "https://registry.npmjs.org/"

.npmrc์˜ always-auth = true ์ด ํŠธ๋ฆญ์„ ์ˆ˜ํ–‰ํ•˜์—ฌ Yarn์„ ์‚ฌ์šฉํ•˜๋Š” ๋™์•ˆ ๋” ์ด์ƒ 401์„๋ฐ›์ง€ ๋ชปํ–ˆ์Šต๋‹ˆ๋‹ค.
๋ง์ด ์•ˆ๋˜์ง€๋งŒ ๋ญ๋“ ์ง€ :)

์ด๋Š” 2017 ๋…„์—๋ณด๊ณ ๋˜์—ˆ์œผ๋ฉฐ ํ˜„์žฌ 2019 ๋…„์ด๋ฉฐ์ด ๋ฌธ์ œ๋Š” ์—ฌ์ „ํžˆ ์กด์žฌํ•ฉ๋‹ˆ๋‹ค.

๋™์˜ํ•ฉ๋‹ˆ๋‹ค. ์—ฌ์ „ํžˆ ์ž‘๋™ํ•˜์ง€ ์•Š์Šต๋‹ˆ๋‹ค.

.npmrc

always-auth=true
<strong i="7">@somename</strong>:registry=https://npm.pkg.github.com/
//npm.pkg.github.com/:_authToken=[token]

.yarnc

"<strong i="11">@somename</strong>:registry" "https://npm.pkg.github.com/"

npm.pkg.github.com์—์„œ๋„ ์˜ค๋ฅ˜๊ฐ€ ๋ฐœ์ƒํ•ฉ๋‹ˆ๋‹ค.

Integrity checked failed (none of the specified algorithms are supported

npm.pkg.github.com์—์„œ๋„ ์˜ค๋ฅ˜๊ฐ€ ๋ฐœ์ƒํ•ฉ๋‹ˆ๋‹ค.

Integrity checked failed (none of the specified algorithms are supported

์ด๊ฒƒ๋„ ์–ป๊ณ 

Nexus ๋ฒ„์ „ 3์„ ์‚ฌ์šฉํ•˜์—ฌ ๋™์ผํ•œ ๋ฌธ์ œ๊ฐ€ ๋ฐœ์ƒํ–ˆ์ง€๋งŒ์ด ๋ฌธ์ œ https://github.com/yarnpkg/yarn/issues/3093#issuecomment -317671597์—์„œ @plitex ๊ฐ€ ์–ธ๊ธ‰ ํ•œ ์ ‘๊ทผ ๋ฐฉ์‹์„ ์‚ฌ์šฉํ•˜์—ฌ ํ•ด๊ฒฐ๋˜์—ˆ์Šต๋‹ˆ๋‹ค.

์ด ์ฝ˜ํ…์ธ ๋ฅผ .npmrc ํŒŒ์ผ์— ๋„ฃ์Šต๋‹ˆ๋‹ค. .yarnrc ํŒŒ์ผ์—๋Š” ์„ค์ •์ด ํ•„์š”ํ•˜์ง€ ์•Š์Šต๋‹ˆ๋‹ค.

always-auth=true
registry=https://nexus.server.com/repository/npm-group/
//nexus.server.com/repository/npm-group/:_authToken={AUTH_TOKEN}

์›์‚ฌ-๋ฒ„์ „
1.17.3

npm-๋ฒ„์ „
6.10.2

@nbransby , @revmischa : ๋ฌธ์ œ # 7552๋„ ํ™•์ธํ•˜์„ธ์š”.์ด ๊ฒฝ์šฐ ์˜ค๋ฅ˜ ๋ฉ”์‹œ์ง€๊ฐ€ ์ •ํ™•ํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.

์ €์—๊ฒŒ ๋„์›€์ด ๋œ ๋‘ ๊ฐ€์ง€ :

  1. always-auth = true
  2. rm yarn.lock

์›์‚ฌ 1.19.1์—์„œ์ด ์˜ค๋ฅ˜๊ฐ€ ๋ฐœ์ƒํ•˜๊ธฐ ์‹œ์ž‘ํ–ˆ์Šต๋‹ˆ๋‹ค. ํ•ด๋‹น ์›์‚ฌ๊ฐ€ .npmrc ์—์„œ ๋ ˆ์ง€์ŠคํŠธ๋ฆฌ ๋ฐ ํ† ํฐ ์ •๋ณด๋ฅผ ์˜ฌ๋ฐ”๋ฅด๊ฒŒ ์„ ํƒํ•˜๋Š” ๊ฒƒ์ฒ˜๋Ÿผ ๋ณด์˜€์ง€๋งŒ 1.19.1์—์„œ๋Š” .yarnrc ์—๋„ registry ๊ตฌ์„ฑ์„ ์ถ”๊ฐ€ํ•ด์•ผํ–ˆ์Šต๋‹ˆ๋‹ค. ๊ทธ๋ ‡์ง€ ์•Š์œผ๋ฉด ๋ฐฉ๊ธˆ 401 ์˜ค๋ฅ˜๊ฐ€ ๋ฐœ์ƒํ–ˆ์Šต๋‹ˆ๋‹ค.

์™„๋ฃŒ๋˜๋ฉด ์ž‘๋™ํ–ˆ๊ณ  ๊ณ„์†ํ•ด์„œ .npmrc ์—์„œ ํ† ํฐ์„ ๊ฐ€์ ธ ์™”์Šต๋‹ˆ๋‹ค. ๋‚˜์—๊ฒŒ ํšŒ๊ท€์ฒ˜๋Ÿผ ๋ณด์ž…๋‹ˆ๋‹ค. ๋ ˆ์ง€์ŠคํŠธ๋ฆฌ ๊ตฌ์„ฑ์„ .npmrc ์—์„œ .yarnrc ๋กœ ๋ณต์ œ ํ•  ์ข‹์€ ์ด์œ ๊ฐ€์—†๋Š” ๊ฒƒ ๊ฐ™์Šต๋‹ˆ๋‹ค.

@rocketraman ์ฒ˜๋Ÿผ yarn 1.19.1์„ ์„ค์น˜ํ•˜์ž๋งˆ์ž ๊ฐœ์ธ ๋ ˆ์ง€์ŠคํŠธ๋ฆฌ (nexus)์—์„œ ๋ฒ”์œ„ ์ง€์ • ํŒจํ‚ค์ง€๋ฅผ ์„ค์น˜ํ•˜๋ ค๊ณ  ํ•  ๋•Œ 401s๊ฐ€ ๋ฐœ์ƒํ•˜๊ธฐ ์‹œ์ž‘ํ–ˆ์Šต๋‹ˆ๋‹ค. npm install ์ž˜ ์ž‘๋™ํ•ฉ๋‹ˆ๋‹ค.

๋‹ค์šด ๊ทธ๋ ˆ์ด๋“œ ๋œ ์‹ค๊ณผ ๋ชจ๋‘ ๋‹ค์‹œ ์ž‘๋™ :

curl -o- -L https://yarnpkg.com/install.sh | bash -s -- --version 1.17.3

์ด๊ฒƒ์ด ์—ฌ์ „ํžˆ ๋ฌธ์ œ์ž„์„ ํ™•์ธํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.

yarn install ์‹คํ–‰์‹œ 401 ์˜ค๋ฅ˜ ๋ฐœ์ƒ

Request "https://npm.pkg.github.com/user/@scope/package" finished with status code 401.

npn install ๋Š” ๋ฌธ์ œ์—†์ด ์‹คํ–‰๋ฉ๋‹ˆ๋‹ค.

์ง€๋‚œ 2 ์‹œ๊ฐ„ ๋™์•ˆ์ด ๋ฌธ์ œ๋ฅผ ๋””๋ฒ„๊น…ํ–ˆ์œผ๋ฉฐ ์ œ ์นœ๊ตฌ @AndreiCalazans ๋•๋ถ„์— ํ•ด๊ฒฐ ๋ฐฉ๋ฒ•์ด ์žˆ์Šต๋‹ˆ๋‹ค.

์œ ์‚ฌํ•œ ๋ฌธ์ œ๋กœ ์–ด๋ ค์›€์„ ๊ฒช๊ณ ์žˆ๋Š” ๋ชจ๋“  ์‚ฌ๋žŒ์„ ์œ„ํ•ด ์—ฌ๊ธฐ์—์„œ ๊ณต์œ ํ•ฉ๋‹ˆ๋‹ค.

์‚ฌ์šฉ ์‚ฌ๋ก€

yarn ์ž‘์—… ์˜์—ญ์„ ์‚ฌ์šฉํ•˜๋Š” ํ”„๋กœ์ ํŠธ๋ฅผ Heroku์— ๋ฐฐํฌํ•˜๊ณ  ์žˆ์Šต๋‹ˆ๋‹ค. yarn.lock ํ•˜๊ณ  npm install ๋ฅผ ์‚ฌ์šฉํ•˜๋”๋ผ๋„ ํ”„๋กœ์ ํŠธ๋Š” ์ž‘์—… ๊ณต๊ฐ„์œผ๋กœ ๋นŒ๋“œ๋˜๊ณ  yarn ์—†์ด๋Š” _ ์ „ํ˜€ ์ž‘๋™ํ•˜์ง€ ์•Š์Šต๋‹ˆ๋‹ค _.

ํ”„๋กœ์ ํŠธ๋Š” GitHub ํŒจํ‚ค์ง€์—์„œ ํ˜ธ์ŠคํŒ…๋˜๋Š” ํŒจํ‚ค์ง€์— ์˜์กดํ•˜๋ฉฐ ํ† ํฐ์„ ํ†ตํ•ด GitHub์— ๋Œ€ํ•ด ์ธ์ฆํ•ด์•ผํ•ฉ๋‹ˆ๋‹ค.

๋ฌธ์ œ

Heroku๊ฐ€๋Š” ๋ณผ ๊ฒƒ์ด๋‹ค yarn.lock ํ•˜๊ณ ์™€ ์ข…์†์„ฑ์„ ์„ค์น˜ yarn ๋ฌด์‹œํ•ฉ๋‹ˆ๋‹ค, ~/.npmrc I ์‚ฌ์ „ ๋นŒ๋“œ๋ฅผ ๋งŒ๋“œ๋Š” ๊ฒƒ์ด ํŒŒ์ผ์„.

์‚ฌ์ „ ๋นŒ๋“œ, ๋‚˜๋Š” ์‹คํ–‰ํ•  ๊ฒƒ์ž…๋‹ˆ๋‹ค

echo "always-auth=true\n//npm.pkg.github.com/:_authToken=${GITHUB_NPM_TOKEN}\" >> ~/.npmrc",

๊ทธ๋Ÿฌ๋ฉด ๋‹ค์Œ ๋‚ด์šฉ์ด ํฌํ•จ ๋œ ~/.npmrc ํŒŒ์ผ์ด ์ƒ์„ฑ๋ฉ๋‹ˆ๋‹ค.

always-auth=true
//npm.pkg.github.com/:_authToken=whatevermytokenis

yarn ๋Š” ์ด๊ฒƒ์„ ๋ฌด์‹œํ•˜๊ณ  401 Unauthorized GitHub ํŒจํ‚ค์ง€ ๋ ˆ์ง€์ŠคํŠธ๋ฆฌ์—์„œ ์ข…์†์„ฑ์„ ๊ฐ€์ ธ ์˜ค๋ ค๊ณ  ํ•  ๋•Œ ์‹คํŒจํ•ฉ๋‹ˆ๋‹ค.

ํ•ด๊ฒฐ ๋ฐฉ๋ฒ•

Andrei๋Š” GitHub ๋ ˆ์ง€์ŠคํŠธ๋ฆฌ๋ฅผ ์‚ฌ์šฉํ•˜๊ธฐ ์œ„ํ•ด _ ์กฐ์ง ๋งŒ _ ์•จ๋ฆฌ์–ด์‹ฑํ•˜๊ณ , _GitHub ๋ ˆ์ง€์ŠคํŠธ๋ฆฌ ํ† ํฐ์„ ์•„๋ž˜์— ์ถ”๊ฐ€ํ–ˆ์Šต๋‹ˆ๋‹ค.

๊ธฐ๋ณธ์ ์œผ๋กœ ~/.npmrc ํŒŒ์ผ์„ ์•ฝ๊ฐ„ ๋ณ€๊ฒฝํ•˜์—ฌ ๋‹ค์Œ์„ ์ถ”๊ฐ€ํ•ฉ๋‹ˆ๋‹ค.

always-auth=true
+<strong i="36">@MY_ORG</strong>:registry=https://npm.pkg.github.com/

//npm.pkg.github.com/:_authToken=whatevermytokenis

๋ชจ๋“  ๊ฒƒ์ด ํ•ด๊ฒฐ๋˜์—ˆ๊ณ  ๊ฐ‘์ž๊ธฐ yarn ๊ฐ€ GitHub ์กฐ์ง์ธ @MY_ORG ๋ชจ๋“  ํŒจํ‚ค์ง€์— ๋Œ€ํ•ด npm.pkg.github.com ์— ์ œ๊ณต๋œ ์ธ์ฆ ํ† ํฐ์„ ์‚ฌ์šฉํ–ˆ์Šต๋‹ˆ๋‹ค.

์•„ํœด! ๋ˆ„๊ตฐ๊ฐ€์—๊ฒŒ ๋„์›€์ด ๋˜์—ˆ๊ธฐ๋ฅผ ๋ฐ”๋ž๋‹ˆ๋‹ค! ๐Ÿ’ž

์ด๊ฒƒ์€ ์—ฌ์ „ํžˆ โ€‹โ€‹๋ฌธ์ œ์ž…๋‹ˆ๋‹ค !! NPM ์„ค์น˜๋Š” ๋ฌธ์ œ์—†์ด ์‹คํ–‰๋ฉ๋‹ˆ๋‹ค.
error Couldn't find package "@diligentcorp/atlas-react" on the "npm" registry. info Visit https://yarnpkg.com/en/docs/cli/add for documentation about this command.

๋‚ด Windows ์ปดํ“จํ„ฐ์—์„œ ๋ฌธ์ œ๋Š” ๋‚ด ์‚ฌ์šฉ์ž ์ˆ˜์ค€ .npmrc ํŒŒ์ผ์ด์žˆ๋Š” ์‚ฌ์šฉ์ž ํด๋”๊ฐ€ ๋„คํŠธ์›Œํฌ ๋“œ๋ผ์ด๋ธŒ์— ์žˆ๋‹ค๋Š” ๊ฒƒ์ž…๋‹ˆ๋‹ค. ์ปดํ“จํ„ฐ์˜ ๋กœ์ปฌ ์‚ฌ์šฉ์ž ํด๋”์— .npmrc ํŒŒ์ผ์ด ์—†์ง€๋งŒ yarn์ด์ด ํด๋”๋ฅผ ์ฐพ๋Š” ๊ฒƒ ๊ฐ™์Šต๋‹ˆ๋‹ค. ๋„คํŠธ์›Œํฌ ๋“œ๋ผ์ด๋ธŒ์—์„œ ๋กœ์ปฌ ์‚ฌ์šฉ์ž ํด๋”๋กœ .npmrc๋ฅผ ๋ณต์‚ฌํ•˜๋ฉด ๋ฌธ์ œ๊ฐ€ ํ•ด๊ฒฐ๋˜์—ˆ์Šต๋‹ˆ๋‹ค (์ธ์ฆ ํ† ํฐ์ด ์‚ฌ์šฉ์ž ์ˆ˜์ค€ .npmrc์— ์ €์žฅ ๋จ).

๋‚˜๋Š” ์šฐ์—ฐํžˆ "cd ~"๋ฅผ ๋‚ด git bash์— ์ž…๋ ฅ ํ•œ ํ›„ ์›๊ฒฉ ํ™ˆ ํด๋” (๋‚ด๊ฐ€ ์‚ฌ์šฉํ•˜์ง€ ์•Š๋Š”)๋กœ ์ „ํ™˜๋˜์—ˆ์Œ์„ ๋ฐœ๊ฒฌํ–ˆ๋‹ค.

@TejasQ ํ•ด๊ฒฐ ๋ฐฉ๋ฒ•์ด ์ €์—๊ฒŒ ํšจ๊ณผ์ ์ด์ง€ ์•Š์•˜์Šต๋‹ˆ๋‹ค.

๋˜ํ•œ GitHub ํŒจํ‚ค์ง€๋ฅผ ์‚ฌ์šฉํ•˜๊ณ  ์žˆ์Šต๋‹ˆ๋‹ค.
npm ์™€ (์™€) ์™„๋ฒฝํ•˜๊ฒŒ ์ž‘๋™ํ•˜์ง€๋งŒ ์—ฌ์ „ํžˆ 401 unauthorized ๋ฐ›๊ณ  ์žˆ์Šต๋‹ˆ๋‹ค.

๋‚˜๋Š” ์‹ค v1.22.0์œผ๋กœ ์ž‘๋™ํ•˜๋„๋ก ๊ด€๋ฆฌํ–ˆ์Šต๋‹ˆ๋‹ค.

.npmrc

always-auth=true
<strong i="7">@fortawesome</strong>:registry=https://npm.fontawesome.com
//npm.fontawesome.com/:_authToken=xyz-xyz-xyz-xyz

.yarnrc

"<strong i="11">@fortawesome</strong>:registry" "https://npm.fontawesome.com"

registry "https://some-regular-registry.org"

๊ทธ๋Ÿฐ ๋‹ค์Œ yarn add @fortawesome/fontawesome-pro ๋ฅผ ์‹คํ–‰ํ•ฉ๋‹ˆ๋‹ค.

๋‚˜์—๊ฒŒ๋„ .npmrc ์œผ๋กœ ๋งŒ ์ž‘๋™ ํ•  ์ˆ˜ ์žˆ๊ธฐ๋ฅผ ๋ฐ”๋ž์ง€๋งŒ .yarnrc ์ถ”๊ฐ€ ํ•  ๋•Œ๋งŒ ์ž‘๋™ํ•˜๋ฏ€๋กœ yarn์— ๋Œ€ํ•ด์„œ๋งŒ ๊ตฌ์„ฑ์„ ๋ณต์ œํ•ด์•ผํ•ฉ๋‹ˆ๋‹ค.

๋‚˜๋Š” ์ด๊ฒƒ์ด ๋‚ด๊ฐ€ ๊ฒช๊ณ ์žˆ๋Š” ๊ฒƒ์ด๋ผ๊ณ  ์ƒ๊ฐํ•œ๋‹ค. .npmrc ๊ฐ€ ํ™ˆ ๋””๋ ‰ํ† ๋ฆฌ์— ์žˆ์ง€๋งŒ ํ”„๋กœ์ ํŠธ ๋””๋ ‰ํ† ๋ฆฌ์—๋Š” ์—†์„ ๋•Œ ์ž‘๋™ํ•ฉ๋‹ˆ๋‹ค (jenkins / travis์— ํ•„์š”).
https://github.com/yarnpkg/yarn/issues/8034

์ด๊ฒƒ์€ ๋‚˜๋ฅผ ์œ„ํ•ด ํ•ด๊ฒฐ๋˜์—ˆ์Šต๋‹ˆ๋‹ค : https://github.com/yarnpkg/yarn/issues/4451#issuecomment -570691809

๋ฒ”์œ„๊ฐ€ ์ง€์ •๋œ ๋ ˆ์ง€์ŠคํŠธ๋ฆฌ๋ฅผ ์„ค์ •ํ•  ๋•Œ ๋ ˆ์ง€์ŠคํŠธ๋ฆฌ ๋’ค์— /name ๊ฐ€ ์—†๋Š”์ง€ ํ™•์ธํ•˜์‹ญ์‹œ์˜ค.

- <strong i="7">@4r7d3c0</strong>:registry=https://npm.pkg.github.com/4r7d3c0
+ <strong i="8">@4r7d3c0</strong>:registry=https://npm.pkg.github.com

๋ฌธ์„œ์— ๋”ฐ๋ผ registry=https://npm.pkg.github.com/OWNER , ๋ฒ”์œ„๋ฅผ ์„ค์ •ํ•  ๋•Œ ์†Œ์œ ์ž๊ฐ€ ๊ฑฐ๊ธฐ์—์žˆ์„ ํ•„์š”๊ฐ€ ์—†๋‹ค๋Š” ๊ฒƒ์„ ๊ฐ„๊ณผํ–ˆ์Šต๋‹ˆ๋‹ค. NPM์€ ์ฒ˜๋ฆฌ ํ•  ์ˆ˜ โ€‹โ€‹์žˆ์ง€๋งŒ ์› ์‚ฌ๋Š” ์ฒ˜๋ฆฌ ํ•  ์ˆ˜ โ€‹โ€‹์—†์Šต๋‹ˆ๋‹ค.

๋ณ„์นญ์„ ์‚ฌ์šฉํ•˜๋Š” ๊ฒฝ์šฐ ๋‹ค์Œ ํ•ด๊ฒฐ ๋ฐฉ๋ฒ•์„ ํ™•์ธํ•˜์‹ญ์‹œ์˜ค. https://github.com/yarnpkg/yarn/issues/8130#issuecomment -636281053

Yarn์ด GitHub ํŒจํ‚ค์ง€ ํ† ํฐ์„ ์กด์ค‘ํ•˜๋„๋ก ์‚ฌ์šฉ์ž ์ˆ˜์ค€ .npmrc ๋ฐ ํ”„๋กœ์ ํŠธ ์ˆ˜์ค€ .npmrc ๋ฅผ ๋ถ„ํ• ํ•ด์•ผํ–ˆ์Šต๋‹ˆ๋‹ค. ์‚ฌ์šฉ์ž ์ˆ˜์ค€์—์„œ ํ”„๋กœ์ ํŠธ ์ˆ˜์ค€์œผ๋กœ ๋ช…๋ช… ๋œ ๋ ˆ์ง€์ŠคํŠธ๋ฆฌ ์„ ์–ธ์„ ์ด๋™ํ•˜๋Š” ๊ฒƒ์ด ํ•ต์‹ฌ์ด์—ˆ์Šต๋‹ˆ๋‹ค.

~/.npmrc

_auth=#####TOKEN_FOR_ARTIFACTORY#####
always-auth=true
registry=https://artifactory.mycompany.net/artifactory/api/npm/npm/
//npm.pkg.github.com/:_authToken=####GitHub_NPM_REGISTRY_TOKEN#####

~/projects/blah/.npmrc

<strong i="14">@mycompany</strong>:registry=https://npm.pkg.github.com

^ ๋ช…๋ช… ๋œ ํŒจ๋ฐ€๋ฆฌ ํŒจํ‚ค์ง€ ๋ ˆ์ง€์ŠคํŠธ๋ฆฌ ํ•ญ๋ชฉ์„ ํ”„๋กœ์ ํŠธ ์ˆ˜์ค€ .npmrc ๋กœ ์˜ฎ๊ธธ ๋•Œ๊นŒ์ง€ yarn install ๋Š” 401์„ ์ œ๊ณตํ–ˆ์Šต๋‹ˆ๋‹ค ( @mycompany ์•„๋ž˜์˜ GH ํ˜ธ์ŠคํŒ… ํŒจํ‚ค์ง€์˜ ๊ฒฝ์šฐ).

Docker ๋นŒ๋“œ์˜ ๊ฒฝ์šฐ ๋ณ„๋„๋กœ ๋งˆ์šดํŠธํ•˜์‹ญ์‹œ์˜ค.

base.Dockerfile :

# syntax=docker/dockerfile:1-experimental
## ^ need to enable --mount=type=secret support

ARG BASE_IMAGE
FROM ${BASE_IMAGE} as build

# note that only project-level .npmrc is copied
COPY package.json yarn.lock .npmrc ./

# ~/.npmrc with actual secrets is mounted as "secret" (does not stay in image)
RUN --mount=type=secret,id=npmrc,target=/root/.npmrc,required \
    yarn install --production --frozen-lockfile ...

Docker ๋นŒ๋“œ ๋ช…๋ น :

DOCKER_BUILDKIT=1 docker build \
        --build-arg BASE_IMAGE=$(BASE_IMAGE) \
        --secret id=npmrc,src="$(HOME)/.npmrc" \
        -t $(IMAGE_NAME):$(IMAGE_TAG) \
        -f base.Dockerfile .

_ (์ฐธ๊ณ ,์ด ์ž‘์—…์„ ์œ„ํ•ด .yarnrc ๊ฐ€ ํ•„์š”ํ•˜์ง€ ์•Š์•˜์ง€๋งŒ, ์ €๋Š” yarn 1.17.3์„ ์‚ฌ์šฉํ•˜๊ณ  ์žˆ์œผ๋ฏ€๋กœ ๋‹ค๋ฅธ ๋ฒ„์ „์—์„œ๋Š” ๋‹ค๋ฅผ ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.) _

๋‚˜๋Š” ์กฐ๊ธˆ arround๋ฅผ ํŒŒํ—ค ์ณค๊ณ  yarn์ด ์ž˜๋ชป๋œ ์ธ์ฆ ์ž๊ฒฉ ์ฆ๋ช…์„ ์‚ฌ์šฉํ•˜๋Š” ๊ฒƒ ๊ฐ™์Šต๋‹ˆ๋‹ค.

~ / .npmrc

//npm-old.visualon.de/npm/vo-npm/:_password=XXXXXX
//npm-old.visualon.de/npm/vo-npm/:username=kriese
//npm-old.visualon.de/npm/vo-npm/:always-auth=true

//npm-new.visualon.de/:_authToken="XXXXXX"

package.json

{
  "name": "yarn-auth",
  "version": "1.0.0",
  "main": "index.js",
  "license": "MIT",
  "dependencies": {
    "tslib": "^2.0.1",
    "moment": "2.20.1"
  }
}

yarn.lock

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


[email protected]:
  version "2.20.1"
  resolved "https://npm-old.visualon.de/npm/vo-npm/moment/-/moment-2.20.1.tgz#d6eb1a46cbcc14a2b2f9434112c1ff8907f313fd"
  integrity sha1-1usaRsvMFKKy+UNBEsH/iQfzE/0=

tslib@^2.0.1:
  version "2.0.1"
  resolved "https://npm-new.visualon.de/tslib/-/tslib-2.0.1.tgz#410eb0d113e5b6356490eec749603725b021b43e"
  integrity sha512-SgIkNheinmEBgx1IUNirK0TUD4X9yjjBRTqqjggWCU3pUEqIk3/Uwl3yRixYKT6WjQuGiwDv4NomL3wqRCj+CQ==

yarn์„ ์„ค์น˜ํ•˜๋Š” ๋™์•ˆ bearer ํ† ํฐ์„ npm-new.visualon.de ์—์„œ npm-old.visualon.de ๋ณด๋ƒ…๋‹ˆ๋‹ค. ๊ทธ๋ž˜์„œ semms yarn์€ ๊ธฐ๋ณธ ๋„๋ฉ”์ธ๋งŒ์„ ๋น„๊ตํ•ฉ๋‹ˆ๋‹ค.

๋ˆ„๊ตฐ๊ฐ€๊ฐ€ ์—ฌ์ „ํžˆ ๊ทธ๊ฒƒ์„ ์ง๋ฉดํ•œ๋‹ค๋ฉด ์ด๊ฒƒ์ด ๋‚˜๋ฅผ ์œ„ํ•ด ์ผํ•œ ๊ฒƒ์ž…๋‹ˆ๋‹ค.

.npmrc:
always-auth=true
<strong i="6">@orgaccount</strong>:registry=https://npm.pkg.github.com
registry=https://registry.yarnpkg.com

https://npm.pkg.github.com/:_authToken=yyyyjjjjj3333888etc

๋ˆ„๊ตฐ๊ฐ€ ๋น„์Šทํ•œ ๋ฌธ์ œ์— ์ง๋ฉดํ–ˆ๋Š”์ง€ ํ™•์‹คํ•˜์ง€ ์•Š์ง€๋งŒ ๋ˆ„๊ตฐ๊ฐ€ ์‹œ๊ฐ„์„ ์ ˆ์•ฝํ•˜๋Š” ๋ฐ ๋„์›€์ด ๋  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.

Azure Artifacts๋ฅผ ๊ฐœ์ธ ๋ ˆ์ง€์ŠคํŠธ๋ฆฌ๋กœ ์‚ฌ์šฉํ•˜๊ณ  ์žˆ์œผ๋ฉฐ ๊ฑฐ๊ธฐ์— ์„ค๋ช… ๋œ๋Œ€๋กœ PAT ๋ฐ .npmrc ํŒŒ์ผ์„ ์„ค์ •ํ–ˆ์Šต๋‹ˆ๋‹ค.
๊ทธ๋Ÿผ์—๋„ ๋ถˆ๊ตฌํ•˜๊ณ  npm install ๊ฐ€ ์™„๋ฒฝํ•˜๊ฒŒ ์ž‘๋™ํ•˜๋Š” ๊ฒƒ๊ณผ ๋™์ผํ•œ ๋ฌธ์ œ๊ฐ€ ๋ฐœ์ƒํ–ˆ์ง€๋งŒ yarn install ๋Š” ํ•ญ์ƒ 401 ์˜ค๋ฅ˜๊ฐ€ ๋ฐœ์ƒํ•ฉ๋‹ˆ๋‹ค.
์•ฝ๊ฐ„์˜ ์‹œ๋„์™€ ์˜ค๋ฅ˜ ํ›„ ๋ ˆ์ง€์ŠคํŠธ๋ฆฌ URL (... @ Local / ...)์— ํŠน์ˆ˜ ๋ฌธ์ž๊ฐ€์žˆ๋Š” ๊ฒƒ์œผ๋กœ ๋ฐํ˜€์กŒ์ง€๋งŒ Azure Artifacts๋Š”์ด๋ฅผ ์„ค์ • ๊ฐ€์ด๋“œ ๋‚ด์˜ ์œ ๋‹ˆ ์ฝ”๋“œ ํ‘œํ˜„์œผ๋กœ ํ•ด๊ฒฐํ•ฉ๋‹ˆ๋‹ค. npm์€ ์ด๊ฒƒ์„ ์ž˜ ์ฒ˜๋ฆฌํ•ฉ๋‹ˆ๋‹ค. URL์— ์‹ค์ œ @ ๋ฌธ์ž๋ฅผ ์„ค์ •ํ•˜๋ฉด ๋ฌธ์ œ๊ฐ€ ํ•ด๊ฒฐ๋˜์—ˆ์Šต๋‹ˆ๋‹ค.

์ด ํŽ˜์ด์ง€๊ฐ€ ๋„์›€์ด ๋˜์—ˆ๋‚˜์š”?
0 / 5 - 0 ๋“ฑ๊ธ‰