両方とも前のリビジョン 前のリビジョン 次のリビジョン | 前のリビジョン |
javascript:yarn [2022/07/20 06:05] – [creat-react-app のインストール] ともやん | javascript:yarn [2024/03/04 05:50] (現在) – [yarn のインストール] ともやん |
---|
Yarn (ヤーン) とは JavaScript(フロントエンド) のパッケージマネージャである。2016 年 10 月に FaceBook がオープンソースの BSD ライセンスで公開した。\\ | Yarn (ヤーン) とは JavaScript(フロントエンド) のパッケージマネージャである。2016 年 10 月に FaceBook がオープンソースの BSD ライセンスで公開した。\\ |
npm と互換性 (package.json, node_modules/ で構成) があり、npm よりも処理が高速である。\\ | npm と互換性 (package.json, node_modules/ で構成) があり、npm よりも処理が高速である。\\ |
| |
ヤ~ンばか~ん...😅💦💦💦 (<wrap em>**※これはイメージです!!**</wrap>)\\ | |
んふ~ん🎵 そこはお耳なの んふ~ん🎵...\\ | |
<WRAP youtube><html> | |
<iframe width="560" height="315" src="https://www.youtube.com/embed/jsbMi4f9xM4" frameborder="0" | |
allow="accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe> | |
</html></WRAP> | |
林家木久蔵 / いやんばか~ん - YouTube より\\ | |
[[wpjp>いやんばか〜ん|]]\\ | |
[[http://www.kget.jp/lyric/241629/%E3%81%84%E3%82%84%E3%82%93%E3%81%B0%E3%81%8B%EF%BD%9E%E3%82%93_%E6%9E%97%E5%AE%B6%E6%9C%A8%E4%B9%85%E8%94%B5|いやんばか~ん/林家木久蔵 - 歌詞検索サービス 歌詞GET]]\\ | |
| |
===== インストール ===== | ===== インストール ===== |
| |
| ==== Linux ==== |
| **anyenv** をインストールする。\\ |
| [[:linux:anyenv|anyenv - rbenv スタイルのオールインワン環境マネージャー]] (Linux)\\ |
| [[:linux:anyenv#anyenv-update_anyenv_とセットで必ずインストールを推奨|anyenv - anyenv-update (anyenv とセットで必ずインストールを推奨)]]\\ |
| [[:linux:anyenv#nodenv_のインストール|anyenv - nodenv のインストール]] ← ここまでの手順を済ませてから...🤔\\ |
| <WRAP color_term> |
| <WRAP color_command><html><pre> |
| $ anyenv update |
| </pre></html></WRAP> |
| <WRAP color_result><html><pre> |
| <b class=GRN>Updating 'anyenv'... |
| Updating 'anyenv/anyenv-update'... |
| Updating 'nodenv'... |
| Updating 'nodenv/node-build'...</b> |
| <b class=GRN>|</b> From https://github.com/nodenv/node-build |
| <b class=GRN>|</b> 8eb08bb0..eaefcd83 master -> origin/master |
| <b class=GRN>|</b> * [new tag] v4.9.90 -> v4.9.90 |
| <b class=GRN>Updating 'nodenv/nodenv-vars'... |
| Updating 'anyenv manifest directory'...</b> |
| </pre></html></WRAP> |
| </WRAP> |
| |
| === node のインストール === |
| <WRAP color_term> |
| <WRAP color_command><html><pre> |
| <font color="#FF8700"><b>$</b></font> <font color="#4E9A06">nodenv</font> install 20.11.1 |
| </pre></html></WRAP> |
| <WRAP color_result><html><pre> |
| Downloading node-v20.11.1-linux-x64.tar.gz... |
| -> https://nodejs.org/dist/v20.11.1/node-v20.11.1-linux-x64.tar.gz |
| Installing node-v20.11.1-linux-x64... |
| Installed node-v20.11.1-linux-x64 to /home/tomoyan/.anyenv/envs/nodenv/versions/20.11.1 |
| </pre></html></WRAP> |
| |
| <WRAP color_command><html><pre> |
| <font color="#FF8700"><b>$</b></font> <font color="#4E9A06">nodenv</font> rehash |
| <font color="#FF8700"><b>$</b></font> <font color="#4E9A06">nodenv</font> global 20.11.1 |
| <font color="#FF8700"><b>$</b></font> <font color="#4E9A06">nodenv</font> versions |
| </pre></html></WRAP> |
| <WRAP color_result><html><pre> |
| * 20.11.1 (set by /home/tomoyan/.anyenv/envs/nodenv/version) |
| </pre></html></WRAP> |
| |
| <WRAP color_command><html><pre> |
| <font color="#FF8700"><b>$</b></font> <font color="#4E9A06">node</font> <font color="#75507B">-v</font> |
| </pre></html></WRAP> |
| <WRAP color_result><html><pre> |
| v20.11.1 |
| </pre></html></WRAP> |
| |
| <WRAP color_command><html><pre> |
| <font color="#FF8700"><b>$</b></font> <font color="#4E9A06">npm</font> <font color="#75507B">-v</font> |
| </pre></html></WRAP> |
| <WRAP color_result><html><pre> |
| 10.2.4 |
| </pre></html></WRAP> |
| |
| <WRAP color_command><html><pre> |
| <font color="#FF8700"><b>$</b></font> <font color="#4E9A06">npx</font> <font color="#75507B">-v</font> |
| </pre></html></WRAP> |
| <WRAP color_result><html><pre> |
| 10.2.4 |
| </pre></html></WRAP> |
| |
| <WRAP color_command><html><pre> |
| <font color="#FF8700"><b>$</b></font> <font color="#4E9A06">npm</font> <font color="#75507B">-g</font><font color="#999999"> list</font> |
| </pre></html></WRAP> |
| <WRAP color_result><html> |
| <pre>/home/tomoyan/.anyenv/envs/nodenv/versions/20.11.1/lib |
| ├── corepack@0.23.0 |
| └── npm@10.2.4 |
| </pre></html></WRAP> |
| </WRAP> |
| |
| === yarn のインストール === |
| <WRAP color_term> |
| <WRAP color_command><html><pre> |
| <font color="#FF8700"><b>$</b></font> <font color="#4E9A06">npm</font> install <font color="#75507B">-g</font> yarn |
| </pre></html></WRAP> |
| <WRAP color_result><html><pre> |
| |
| added 1 package in 3s |
| <span style="background-color:#2E3436"><font color="#D3D7CF">npm</font></span> <span style="background-color:#2E3436"><font color="#06989A">notice</font></span> |
| <span style="background-color:#2E3436"><font color="#D3D7CF">npm</font></span> <span style="background-color:#2E3436"><font color="#06989A">notice</font></span> New <font color="#C4A000">minor</font> version of npm available! <font color="#CC0000">10.2.4</font> -> <font color="#4E9A06">10.5.0</font> |
| <span style="background-color:#2E3436"><font color="#D3D7CF">npm</font></span> <span style="background-color:#2E3436"><font color="#06989A">notice</font></span> Changelog: <font color="#06989A">https://github.com/npm/cli/releases/tag/v10.5.0</font> |
| <span style="background-color:#2E3436"><font color="#D3D7CF">npm</font></span> <span style="background-color:#2E3436"><font color="#06989A">notice</font></span> Run <font color="#4E9A06">npm install -g npm@10.5.0</font> to update! |
| <span style="background-color:#2E3436"><font color="#D3D7CF">npm</font></span> <span style="background-color:#2E3436"><font color="#06989A">notice</font></span> |
| </pre></html></WRAP> |
| <WRAP color_command><html><pre> |
| <font color="#FF8700"><b>$</b></font> <font color="#4E9A06"><u style="text-decoration-style:single">exec</u></font> <font color="#4E9A06">$SHELL</font> <font color="#75507B">-l</font> |
| <font color="#FF8700"><b>$</b></font> <font color="#4E9A06">yarn</font> <font color="#75507B">-v</font> |
| </pre></html></WRAP> |
| <WRAP color_result><html><pre> |
| 1.22.21 |
| </pre></html></WRAP> |
| </WRAP> |
| |
| プロジェクトの yarn バージョンをセット🤔\\ |
| <WRAP color_term> |
| <WRAP color_command><html><pre> |
| <font color="#FF8700"><b>$</b></font> <font color="#4E9A06">yarn</font> set version 3.5.0 |
| </pre></html></WRAP> |
| <WRAP color_result><html><pre> |
| <font color="#729FCF">➤</font> YN0000: Retrieving <font color="#D75FD7">https://repo.yarnpkg.com/3.5.0/packages/yarnpkg-cli/bin/yarn.js</font> |
| <font color="#729FCF">➤</font> YN0000: Saving the new release in <font color="#75507B">.yarn/releases/yarn-3.5.0.cjs</font> |
| <font color="#729FCF">➤</font> YN0000: Done in 2s 180ms |
| </pre></html></WRAP> |
| <WRAP color_command><html><pre> |
| <font color="#FF8700"><b>$</b></font> <font color="#4E9A06">yarn</font> <font color="#75507B">-v</font> |
| </pre></html></WRAP> |
| <WRAP color_result><html><pre> |
| 3.5.0 |
| </pre></html></WRAP> |
| </WRAP> |
| |
| ==== Windows ==== |
[[windows:scoop|Scoop]] によるインストール。\\ | [[windows:scoop|Scoop]] によるインストール。\\ |
| |
| |
===== トラブルシューティング ===== | ===== トラブルシューティング ===== |
| |
| ==== error `--global` has been deprecated. ==== |
| Yarn でのグローバルへのインストールは <html><code>yarn global add <package name></code></html> である🤔\\ |
| <WRAP color_term> |
| <WRAP color_command><html><pre> |
| $ yarn install @google-cloud/functions-framework -g |
| </pre></html></WRAP> |
| <WRAP color_result><html><pre> |
| yarn install v1.22.19 |
| info No lockfile found. |
| error `--global` has been deprecated. Please run "yarn global add @google-cloud/functions-framework" instead. |
| info Visit https://yarnpkg.com/en/docs/cli/install for documentation about this command. |
| </pre></html></WRAP> |
| </WRAP> |
| |
| <WRAP color_term> |
| <WRAP color_command><html><pre> |
| $ yarn global add @google-cloud/functions-framework |
| </pre></html></WRAP> |
| <WRAP color_result><html><pre> |
| yarn global v1.22.19 |
| [1/4] Resolving packages... |
| [2/4] Fetching packages... |
| [3/4] Linking dependencies... |
| [4/4] Building fresh packages... |
| success Installed "@google-cloud/functions-framework@3.1.3" with binaries: |
| - functions-framework |
| - functions-framework-nodejs |
| Done in 9.32s. |
| </pre></html></WRAP> |
| </WRAP> |
| |
| ==== その他 ==== |
<code> | <code> |
Vue CLI v4.5.9 | Vue CLI v4.5.9 |
| |
==== 付録 ==== | ==== 付録 ==== |
[[tw>|]]\\ | [[tw>tomoyan596sp/status/1549493263090188288|こちらが本題なのですが、Node.js入れるのにWindowsのnvmの不具合の数々😅Linuxでやった方が良さそう🤔YarnでReactアプリのプロジェクトを数十秒以内に開始する😆また、はるおわーるどか🤣]]\\ |
| |