yarn - deptno/deptno.github.io GitHub Wiki
berry κΈ°μ€
yarn info _package_name_
yarn info _package_name_ version
yarn patch-package
yarn set version berry
yarn plugin import @yarnpkg/plugin-workspace-tools
λμΆ© zero install λͺ¨λκ° λλ©΄μ package κ° zip νμΌλ‘ .yarn/cache
λλ ν 리μμ λ€μ΄κ°κ²λλ€.
λμ node_modules
λλ ν λ¦¬κ° μμ΄μ§λ©΄μ μλν°μμ λ¬Έμ λ₯Ό μΌμΌμΌ°λλ° [email protected] κΈ°μ€, μ λμ
λ€λ₯Έ μλν°λ μ¬μ ν λ¬Έμ κ° λλλ° μ΄λ₯Ό sdk ννλ‘ ν¨κ» λ°°ν¬νκ³ μλ€
@yarnpkg/sdks
yarn dlx @yarnpkg/sdks vscode vim
yarn dlx @yarnpkg/sdks base # neovim >= 0.6 native lsp
λͺ¨λ μν¬νΈκ° μλμ ν μ€νΈνκΈ°κ° μ§μ¦λ¬λλ° μ΅μ μ€μ ν΄λ³΄λ λλ€
node -r .pnp.cjs
$
yarn node [script.js]
- 2023-02-04 μ°Έμ‘°
- https://velog.io/@projaguar/Yarn-3-MonoRepo-with-Typescript-Next.js-Nest-React-Native
- https://velog.io/@projaguar/Yarn-Berryv3-Workspace1-workspace-μ€μ
-
https://velog.io/@projaguar/Yarn-Berryv3-Workspace-2-Nest-μ€μ
symlink λ ν΄λμ΄λ¦μ΄ μλλΌ
package.json#name
μ΄ μ¬μ©λλ€.yarnrc
μworkspaces-experimental false
λ₯Ό μΆκ°ν΄μ workspace λ₯Ό off ν μ μλ€. μ΄ κ²½μ°μ νΌλΈλ¦¬μ±μ΄ μ λλμ§λ νμΈν΄ λ³Ό κ² @todo
yarn add --force @workspace/package [package_name]
yarn set version berry
yarn init -w
yarn plugin import @yarnpkg/plugin-workspace-tools
cd packages
mkdir lib
cd lib
yarn init -y
package.json
{
"name": "tmp",
"packageManager": "[email protected]",
"private": true,
"workspaces": [
"packages/*"
]
}
{
"name": "papago",
"type": "module",
"dependencies": {
"node-fetch": "^3.2.0"
}
}
λͺ¨λ
Έλ ν¬μμ νλμ ν¨ν€μ§μμ λ€λ₯Έ ν¨ν€μ§λ₯Ό μ°Έμ‘°νλ €λ©΄ μ€μ λ‘λ λΉλλ₯Ό λκ² νλ κ²μ΄ μ μμ΄λ λ²κ±°λ‘λ€.
ν¨ν€μ§λ§ λΆλ¦¬νκ³ ν¨κ» μ»΄νμ΄λλλ‘ νλ €λ©΄ νμ
μ€ν¬λ¦½νΈ compilerOptions
μ μΆκ° μ€μ μ΄ νμνλ€
"baseUrl": ".",
"paths": {
"@project/package": [
"packages/package/src"
],
"@project/package/*": [
"packages/package/src/*"
]
}
@project/package
λ μ°Έμ‘°ν ν¨ν€μ§μ package.json:name
κ³Ό κ°κ²νλ€
- 2023-02-03 μλ λ΄μ©μ @yarnpkg/sdks λ₯Ό ν΅ν΄ ν΄κ²°μ΄ κ°λ₯νλ©° webstorm λ νμ¬ zero install μ μ§μν΄μ μ μ©νμ§ μλ€
.yarnrc.yml
yarnPath: .yarn/releases/yarn-3.2.0.cjs
nodeLinker: node-modules
νΉμ
yarn config set nodeLinker node-modules
- nodeLinker: λ₯Ό ν΅ν΄ node_modules pnp μμλ μ¬μ© κ°λ₯νλ€.
node_modules
μ΄ μμΌλ©΄ 2022-03-14 νμ¬λ webstorm μμ μ λλ‘ μ¬μ©μ΄ λΆκ°λ₯νλ€.- 2023-02-13 νμ¬λ nodeLinker μμ΄ μ¬μ© κ°λ₯
- https://classic.yarnpkg.com/blog/2018/02/15/nohoist/ /package.json
{
"workspaces": {
"packages": [ "packages/*" ],
"nohoist": [ "**/react-native" ]
}
}
workspace tool μ΄ μμ΄μΌμ§ κ°λ₯
# https://yarnpkg.com/api/modules/plugin_workspace_tools.html
yarn plugin import workspace-tools
- 2023-01-31 workspace package κ° prefix λ₯Ό κ°μ§κ² λ κ²μΌλ‘ 보μΈλ€
yarn plugin import @yarnpkg/plugin-workspace-tools
β€ YN0000: β Some peer dependencies are incorrectly met; run yarn explain peer-requirements <hash> for details, where <hash> is the six-letter p-prefixed code
β€ YN0000: β Completed in 0s 623ms
β€ YN0000: β Fetch step
β€ YN0013: β @ptomasroos/react-native-multi-slider@https://github.com/zigbang/react-native-multi-slider.git#commit=22a0d52e2edb40edb552c4e010cd629bc2e68e9c can't be found in the cache and will be fetched from GitHub
β€ YN0013: β multiple-cucumber-html-reporter@https://github.com/Seunghyum/multiple-cucumber-html-reporter.git#commit=e03908f469aa694900da40597ea31a9a0ca3d86f can't be found in the cache and will be fetched from GitHub
β€ YN0013: β @ptomasroos/react-native-multi-slider@git+https://github.com/zigbang/react-native-multi-slider.git#commit=22a0d52e2edb40edb552c4e010cd629bc2e68e9c can't be found in the cache and will be fetched from the remote r
β€ YN0013: β multiple-cucumber-html-reporter@https://github.com/Seunghyum/multiple-cucumber-html-reporter.git#commit=e03908f469aa694900da40597ea31a9a0ca3d86f can't be found in the cache and will be fetched from the remote rep
β€ YN0018: β @ptomasroos/react-native-multi-slider@git+https://github.com/zigbang/react-native-multi-slider.git#commit=22a0d52e2edb40edb552c4e010cd629bc2e68e9c: The remote archive doesn't match the expected checksum
β€ YN0018: β multiple-cucumber-html-reporter@https://github.com/Seunghyum/multiple-cucumber-html-reporter.git#commit=e03908f469aa694900da40597ea31a9a0ca3d86f: The remote archive doesn't match the expected checksum
β€ YN0000: β Completed in 5s 348ms
β€ YN0000: Failed with errors in 5s 976ms
$ YARN_CHECKSUM_BEHAVIOR=update yarn
-
https://yarnpkg.com/advanced/error-codes#yn0018---cache_checksum_mismatch
- 2023-01-06
- μ€μ λ‘ μ λ°©μμ ν΄λ³΄λ ν΄κ²°μ΄ λμ§λ§ λ€λ₯Έ νκ²½μμλ μλ¬λ‘ μΈμνλ€. μ€μ§ λλ§ λ€λ₯Έ 체ν¬μ¬μ΄ μκΈ°λ μν
- https://github.com/yarnpkg/berry/issues/2399
- version v3.3.0 μ΄μμμ ν΄κ²° ->
yarn
μΌλ‘yarn.lock
μ λ°μ΄νΈκ° λλ νμλ λ²μ μ λ€μ λ΄λ €λ μ μμ μΌλ‘ μλλ¨
- 2023-01-06
yarn set version 3.3.1
Error: Required unplugged package missing from disk. This may happen when switching branches without running installs (unplugged packages must be fully materialized on disk to work).
sharp
λͺ¨λμ μ€μΉνλ©΄μ μλ¬κ° λ¬λ€. yarn
μ μν κ²μ μλκ³ μ΄λ―Έμ§λ₯Ό λΉλνλ μ»΄ν¨ν°μ runtime 컨ν
μ΄λμ μν€ν
μ³ μ°¨μ΄κ° λ°μνλ©΄μ λͺ¨λμ λͺ»μ°Ύλκ² λ¬Έμ
ν΄λΉ λͺ¨λμ .yarn/unplugged
μμΉμ μ€μΉλλλ° μλ§λ node-gyp
λ₯Ό ν΅ν΄ λ€μ΄ν°λΈ λΉλκ° λ€μ΄κ°κΈ° λλ¬ΈμΌ μ μμ κ² κ°μ
npm
μ κ²½μ°μλ arch
μ΅μ
μ μ§μνμ§λ§ yarn
μ μ΄λ₯Ό μ§μνμ§ μλλ° μλ λͺ
λ Ήμ΄λ₯Ό ν΅ν΄μ ν΄κ²°
μ€μΉμμλ κΈ°μ‘΄μ μ€μΉλ λͺ¨λμ μ§μ°κ³ μ€μΉν΄μΌνλ€. μλ§ λ©ν° νλ«νΌμ λΉλλ₯Ό νλ €λ©΄ κ° νλ«νΌ λ³ μΈμ€ν¨ νμ .yarn/unplugged
λλ ν 리λ₯Ό λ³ν©ν΄μΌν κ²μΌλ‘ μκ°
$ SHARP_IGNORE_GLOBAL_LIBVIPS=1 npm_config_arch=x64 npm_config_platform=linux yarn add sharp
β€ YN0001: β Error [ERR_STREAM_PREMATURE_CLOSE]: Premature close
at new NodeError (node:internal/errors:400:5)
at PassThrough.onclose (node:internal/streams/end-of-stream:143:30)
at PassThrough.emit (node:events:513:28)
at emitCloseNT (node:internal/streams/destroy:132:10)
at process.processTicksAndRejections (node:internal/process/task_queues:81:21)
β€ YN0000: β Completed in 5s 872ms
β€ YN0000: Failed with errors in 6s 5ms
λΈλμΉ λ°κΎΈλκΉ ν΄κ²°λ¨, λΈλμΉλ΄μ λ¬Έμ κ° μμλ κ±Έλ‘ μμλ¨