<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/">
    <channel>
        <title>NotionNext BLOG</title>
        <link>https://notion-next-ashy-five.vercel.app//</link>
        <description>这是一个由NotionNext生成的站点</description>
        <lastBuildDate>Thu, 12 Oct 2023 10:13:27 GMT</lastBuildDate>
        <docs>https://validator.w3.org/feed/docs/rss2.html</docs>
        <generator>https://github.com/jpmonette/feed</generator>
        <language>zh-CN</language>
        <copyright>All rights reserved 2023, Jeffrey</copyright>
        <item>
            <title><![CDATA[scp2-javascript-文件传输]]></title>
            <link>https://notion-next-ashy-five.vercel.app//article/blog-7</link>
            <guid>https://notion-next-ashy-five.vercel.app//article/blog-7</guid>
            <pubDate>Thu, 12 Oct 2023 00:00:00 GMT</pubDate>
            <description><![CDATA[一个基于 ssh2 的纯 javascript 安全拷贝程序。]]></description>
            <content:encoded><![CDATA[<div id="notion-article" class="mx-auto overflow-hidden "><main class="notion light-mode notion-page notion-block-79822ba5b5c1409baab25ced57725678"><div class="notion-viewport"></div><div class="notion-collection-page-properties"></div><div class="notion-text notion-block-66dbcf8172564e49a9e0a9f1c6826e8c">一个基于 ssh2 的纯 javascript 安全拷贝程序。</div><h3 class="notion-h notion-h2 notion-h-indent-0 notion-block-128226a69a834359b09f04b970b5dd18" data-id="128226a69a834359b09f04b970b5dd18"><span><div id="128226a69a834359b09f04b970b5dd18" class="notion-header-anchor"></div><a class="notion-hash-link" href="#128226a69a834359b09f04b970b5dd18" title="安装"><svg viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"></path></svg></a><span class="notion-h-title">安装</span></span></h3><h3 class="notion-h notion-h2 notion-h-indent-0 notion-block-59bd997268ea4934a9f232d610bf4785" data-id="59bd997268ea4934a9f232d610bf4785"><span><div id="59bd997268ea4934a9f232d610bf4785" class="notion-header-anchor"></div><a class="notion-hash-link" href="#59bd997268ea4934a9f232d610bf4785" title="高级 API"><svg viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"></path></svg></a><span class="notion-h-title">高级 API</span></span></h3><h3 class="notion-h notion-h2 notion-h-indent-0 notion-block-26fad5ebb45840a4be734490e44d00e0" data-id="26fad5ebb45840a4be734490e44d00e0"><span><div id="26fad5ebb45840a4be734490e44d00e0" class="notion-header-anchor"></div><a class="notion-hash-link" href="#26fad5ebb45840a4be734490e44d00e0" title="使用 scp2 实现自动部署前端项目"><svg viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"></path></svg></a><span class="notion-h-title">使用 scp2 实现自动部署前端项目</span></span></h3><ul class="notion-list notion-list-disc notion-block-a44eb89d08934337a9ac03c81a0a3b00"><li>创建 deploy.js 文件</li></ul><ul class="notion-list notion-list-disc notion-block-55710a53bc574ef4bd2f2022afd708b3"><li>package.json 添加自动脚本</li></ul><ol start="1" class="notion-list notion-list-numbered notion-block-c7690b05113949e0a14ffe5bb7cf3a84"><li>发送文件之前需要先 build</li></ol><ol start="2" class="notion-list notion-list-numbered notion-block-b619c7ffc853489f875eaad002ce3080"><li>终端输入 npm run deploy 即可发布到服务器</li></ol><div class="notion-blank notion-block-2e1226ba1ee04455b1edf92ca85074aa"> </div></main></div>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[linux部署go项目]]></title>
            <link>https://notion-next-ashy-five.vercel.app//article/blog-1</link>
            <guid>https://notion-next-ashy-five.vercel.app//article/blog-1</guid>
            <pubDate>Thu, 12 Oct 2023 00:00:00 GMT</pubDate>
            <description><![CDATA[linux部署go项目]]></description>
            <content:encoded><![CDATA[<div id="notion-article" class="mx-auto overflow-hidden "><main class="notion light-mode notion-page notion-block-51ac269e32d5455dacf048f40aa520fa"><div class="notion-viewport"></div><div class="notion-collection-page-properties"></div><div class="notion-blank notion-block-62bfc58f91154d8abd76f15ebd51435f"> </div><div class="notion-callout notion-gray_background_co notion-block-ce96c6b5acc8454ca95fe8e641b22801"><div class="notion-page-icon-inline notion-page-icon-span"><span class="notion-page-icon" role="img" aria-label="💡">💡</span></div><div class="notion-callout-text">有关部署go项目上的问题，欢迎您在底部评论区留言，一起交流~</div></div><div class="notion-blank notion-block-0fbaf0886622438caea744177d112936"> </div></main></div>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[express-token]]></title>
            <link>https://notion-next-ashy-five.vercel.app//article/blog-5</link>
            <guid>https://notion-next-ashy-five.vercel.app//article/blog-5</guid>
            <pubDate>Thu, 12 Oct 2023 00:00:00 GMT</pubDate>
            <description><![CDATA[什么是 Token？ Token 指访问资源的凭据，是一种身份认证的方式，它是解决跨域认证的最流行的一种方式。]]></description>
            <content:encoded><![CDATA[<div id="notion-article" class="mx-auto overflow-hidden "><main class="notion light-mode notion-page notion-block-acd7fe33f73440f6912eda62d9e8a69a"><div class="notion-viewport"></div><div class="notion-collection-page-properties"></div><h2 class="notion-h notion-h1 notion-h-indent-0 notion-block-15c3a1f80295461789b075e627fe00d2" data-id="15c3a1f80295461789b075e627fe00d2"><span><div id="15c3a1f80295461789b075e627fe00d2" class="notion-header-anchor"></div><a class="notion-hash-link" href="#15c3a1f80295461789b075e627fe00d2" title="token jwt 介绍"><svg viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"></path></svg></a><span class="notion-h-title">token jwt 介绍</span></span></h2><h3 class="notion-h notion-h2 notion-h-indent-1 notion-block-0164389feab44403805c032f7799ea58" data-id="0164389feab44403805c032f7799ea58"><span><div id="0164389feab44403805c032f7799ea58" class="notion-header-anchor"></div><a class="notion-hash-link" href="#0164389feab44403805c032f7799ea58" title="一、Token"><svg viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"></path></svg></a><span class="notion-h-title">一、Token</span></span></h3><ul class="notion-list notion-list-disc notion-block-ca9cfcec584646949cc6249c68e028f7"><li>什么是 Token？ Token 指访问资源的凭据，是一种身份认证的方式，它是解决跨域认证的最流行的一种方式。</li></ul><ul class="notion-list notion-list-disc notion-block-d2f2a905d26b465eb3f2a8a5776b32cf"><li>为什么用 Token？ 以前较为流行的是通过 session 去做身份认证，session 是通过服务器中保存会话数据来做身份认证，这种方式会导致在高并发中服务器压力过大的情况，还有就是，如果是服务器集群，那么就需要这些服务器 session 共享。</li></ul><div class="notion-text notion-block-ea2a51be91314efb85619312d2f40994">Token 不在服务器中保存会话数据，而是保存在客户端。每次请求的 headers 中存入 Token，在服务器中判断 Token 的有效性，是否可以访问资源。</div><ul class="notion-list notion-list-disc notion-block-0bd9e10a65714569a10d669424d26b7d"><li>传统 Token 和 JWT 的区别</li></ul><ul class="notion-list notion-list-disc notion-block-851c2d08df3843c3b21b691554df813b"><li>传统 Token 用户发起登录请求，登录成功之后返回 Token，并且存于数据库，用户访问资源的时候需要携带 Token，服务端获取 Token 之后和数据库中的对比。</li></ul><ul class="notion-list notion-list-disc notion-block-d2155dc160414046a4b1927b1aadd67e"><li>JWT 用户发起登录请求，登录成功之后返回 Token，但是不存于数据库，用户访问资源的时候需要携带 Token，服务端获取 Token 之后去校验 Token 的合法性。</li></ul><h3 class="notion-h notion-h2 notion-h-indent-1 notion-block-c14b9a6dc34e4556bba4093ed9f4833a" data-id="c14b9a6dc34e4556bba4093ed9f4833a"><span><div id="c14b9a6dc34e4556bba4093ed9f4833a" class="notion-header-anchor"></div><a class="notion-hash-link" href="#c14b9a6dc34e4556bba4093ed9f4833a" title="二、JWT 实现过程"><svg viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"></path></svg></a><span class="notion-h-title">二、JWT 实现过程</span></span></h3><ul class="notion-list notion-list-disc notion-block-059111727c76486c961c362703569115"><li>JWT 分为三个部分 header、payload、verify signature</li></ul><ul class="notion-list notion-list-disc notion-block-7162e8f96d6f481abd6fb2b7c37d2e80"><li>header</li></ul><div class="notion-text notion-block-99d097d391544b88867037ce2b40aa3c">内部包含有签名算法、Token 类型，然后通过 base64url 算法转成字符串</div><ul class="notion-list notion-list-disc notion-block-d0781c3a9372410eb2655df84b5636c9"><li>payload 内部包含 JWT 标准数据和自定义数据，然后通过 base64url 算法转成字符串 JWT 标准数据常见的有：</li></ul><div class="notion-text notion-block-a4fedf15286f4ef5a57acbe7f8007a9c">可选择性使用以上标准数据</div><blockquote class="notion-quote notion-block-19d953df8f484c3fa7bb67ebdeaaaedb"><div>注意：由于 JWT 是默认不加密的，所以在这边不要存敏感信息</div></blockquote><ul class="notion-list notion-list-disc notion-block-60ac43a7e2d046138f1529ce0a6dd9f4"><li>verify signature 这部分是对前两部分的签名，防止数据的篡改 secret 是服务器端保存的密钥，只有服务器端知道，再使用 header 中所指定的签名算法对上面的俩部分进行签名，按照以下公式生成签名</li></ul><div class="notion-text notion-block-4b92e9deeee1494d9576ec1bd0ae77a3">复制代码 算出签名之后，把三部分通过.分隔开返回给用户就行了</div><ul class="notion-list notion-list-disc notion-block-90de42a860f54cc3aca185dfe12771d4"><li>客户端请求</li></ul><ul class="notion-list notion-list-disc notion-block-64aad5ec6d844d77a88486fc5179e49a"><li>每次客户端的请求都需要带上这个 token，一般是把 token 写入到请求的 headers 中</li></ul><h3 class="notion-h notion-h2 notion-h-indent-1 notion-block-0fde1767ee084865919c8a950426abba" data-id="0fde1767ee084865919c8a950426abba"><span><div id="0fde1767ee084865919c8a950426abba" class="notion-header-anchor"></div><a class="notion-hash-link" href="#0fde1767ee084865919c8a950426abba" title="三、Node.js 中使用"><svg viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"></path></svg></a><span class="notion-h-title">三、Node.js 中使用</span></span></h3><div class="notion-text notion-block-43dc7554c5cd490d9ff59df33304c583">Node.js 中使用 JWT</div><h4 class="notion-h notion-h3 notion-h-indent-2 notion-block-2d8a906a640445288a2d6259ac2c35f6" data-id="2d8a906a640445288a2d6259ac2c35f6"><span><div id="2d8a906a640445288a2d6259ac2c35f6" class="notion-header-anchor"></div><a class="notion-hash-link" href="#2d8a906a640445288a2d6259ac2c35f6" title="1.开始使用"><svg viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"></path></svg></a><span class="notion-h-title">1.开始使用</span></span></h4><div class="notion-text notion-block-682fc235e59d420899bd3c7139fc99bd">通过 npm 包 jsonwebtoken 来完成 token 的生成和验证</div><h4 class="notion-h notion-h3 notion-h-indent-2 notion-block-5afa91494db745409e38beb105e322ed" data-id="5afa91494db745409e38beb105e322ed"><span><div id="5afa91494db745409e38beb105e322ed" class="notion-header-anchor"></div><a class="notion-hash-link" href="#5afa91494db745409e38beb105e322ed" title="2.生成、验证 Token"><svg viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"></path></svg></a><span class="notion-h-title">2.生成、验证 Token</span></span></h4><div class="notion-blank notion-block-9b6559f9f58a4c5ea3426f802fc878eb"> </div><h4 class="notion-h notion-h3 notion-h-indent-2 notion-block-6eff5bf2957e47338d91d7673f4729c0" data-id="6eff5bf2957e47338d91d7673f4729c0"><span><div id="6eff5bf2957e47338d91d7673f4729c0" class="notion-header-anchor"></div><a class="notion-hash-link" href="#6eff5bf2957e47338d91d7673f4729c0" title="3.使用"><svg viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"></path></svg></a><span class="notion-h-title">3.使用</span></span></h4><h3 class="notion-h notion-h2 notion-h-indent-1 notion-block-c0ba1c3a5d8946e3b0a41eead0c980d3" data-id="c0ba1c3a5d8946e3b0a41eead0c980d3"><span><div id="c0ba1c3a5d8946e3b0a41eead0c980d3" class="notion-header-anchor"></div><a class="notion-hash-link" href="#c0ba1c3a5d8946e3b0a41eead0c980d3" title="总结"><svg viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"></path></svg></a><span class="notion-h-title">总结</span></span></h3><div class="notion-text notion-block-a0cc38e6ddf942fb8160a622a9f421fa">:::tip</div><ul class="notion-list notion-list-disc notion-block-8ededc90419542ed9582f509c0743092"><li>登录成功之后 服务端根据用户信息生成 <code class="notion-inline-code">token</code></li></ul><ul class="notion-list notion-list-disc notion-block-1ba53f7f4d6f4b78ae084d44bfc15402"><li>非登录接口发起请求是需设置 <code class="notion-inline-code">headers.authorization = token</code></li></ul><ul class="notion-list notion-list-disc notion-block-d42403a223054f949205445dba5e0401"><li>添加<code class="notion-inline-code">token</code>验证中间件，除登录接口 其他接口全部验证 token</li></ul><ul class="notion-list notion-list-disc notion-block-199d616bfe5346f08946a232e03eb688"><li>验证成功通过，不成功提示错误 :::</li></ul><div class="notion-blank notion-block-808e86bb873e452ab1678b46222c0747"> </div></main></div>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[pm2-nodejs]]></title>
            <link>https://notion-next-ashy-five.vercel.app//article/blog-6</link>
            <guid>https://notion-next-ashy-five.vercel.app//article/blog-6</guid>
            <pubDate>Thu, 12 Oct 2023 00:00:00 GMT</pubDate>
            <description><![CDATA[PM2 是具有内置负载均衡器的 Node.js 应用程序的生产流程管理器。它允许您使应用程序永远保持活动状态，在不停机的情况下重新加载它们，并促进常见的系统管理任务。]]></description>
            <content:encoded><![CDATA[<div id="notion-article" class="mx-auto overflow-hidden "><main class="notion light-mode notion-page notion-block-b87ab5715c18459b945b3538bd15bb20"><div class="notion-viewport"></div><div class="notion-collection-page-properties"></div><h2 class="notion-h notion-h1 notion-h-indent-0 notion-block-8165b2455eb34e88b3d0a4988c254f6e" data-id="8165b2455eb34e88b3d0a4988c254f6e"><span><div id="8165b2455eb34e88b3d0a4988c254f6e" class="notion-header-anchor"></div><a class="notion-hash-link" href="#8165b2455eb34e88b3d0a4988c254f6e" title="PM2"><svg viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"></path></svg></a><span class="notion-h-title">PM2</span></span></h2><ul class="notion-list notion-list-disc notion-block-e7d7fdd2ada44d13a0e3e4e5d2be6c2f"><li>PM2 是具有内置负载均衡器的 Node.js 应用程序的生产流程管理器。它允许您使应用程序永远保持活动状态，在不停机的情况下重新加载它们，并促进常见的系统管理任务。</li></ul><h4 class="notion-h notion-h3 notion-h-indent-1 notion-block-a1e7572a550b4f0ab8a1cc669adb5567" data-id="a1e7572a550b4f0ab8a1cc669adb5567"><span><div id="a1e7572a550b4f0ab8a1cc669adb5567" class="notion-header-anchor"></div><a class="notion-hash-link" href="#a1e7572a550b4f0ab8a1cc669adb5567" title="1、pm2 需要全局安装"><svg viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"></path></svg></a><span class="notion-h-title">1、pm2 需要全局安装</span></span></h4><blockquote class="notion-quote notion-block-87274d6e79104561a6150c4a323fcffc"><div>npm install -g pm2</div></blockquote><h4 class="notion-h notion-h3 notion-h-indent-1 notion-block-b74112a83b384a2fbff3c8d443bf7947" data-id="b74112a83b384a2fbff3c8d443bf7947"><span><div id="b74112a83b384a2fbff3c8d443bf7947" class="notion-header-anchor"></div><a class="notion-hash-link" href="#b74112a83b384a2fbff3c8d443bf7947" title="2、进入项目根目录"><svg viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"></path></svg></a><span class="notion-h-title">2、进入项目根目录</span></span></h4><h4 class="notion-h notion-h3 notion-h-indent-1 notion-block-2c409d60bc11475b8770223ed699c61b" data-id="2c409d60bc11475b8770223ed699c61b"><span><div id="2c409d60bc11475b8770223ed699c61b" class="notion-header-anchor"></div><a class="notion-hash-link" href="#2c409d60bc11475b8770223ed699c61b" title="2.1 启动进程/应用"><svg viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"></path></svg></a><span class="notion-h-title">2.1 启动进程/应用</span></span></h4><blockquote class="notion-quote notion-block-697477ebf6d34840aaa688705ec992b3"><div>pm2 start bin/www 或 pm2 start app.js</div></blockquote><h4 class="notion-h notion-h3 notion-h-indent-1 notion-block-ee663748bb1943f390d142c78ee73222" data-id="ee663748bb1943f390d142c78ee73222"><span><div id="ee663748bb1943f390d142c78ee73222" class="notion-header-anchor"></div><a class="notion-hash-link" href="#ee663748bb1943f390d142c78ee73222" title="2.2 重命名进程/应用"><svg viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"></path></svg></a><span class="notion-h-title">2.2 重命名进程/应用</span></span></h4><blockquote class="notion-quote notion-block-d62142c2563f41fcb3121c18679b3571"><div>pm2 start app.js –name wb123</div></blockquote><h4 class="notion-h notion-h3 notion-h-indent-1 notion-block-9e22988107614575a9fe490f545a0ec8" data-id="9e22988107614575a9fe490f545a0ec8"><span><div id="9e22988107614575a9fe490f545a0ec8" class="notion-header-anchor"></div><a class="notion-hash-link" href="#9e22988107614575a9fe490f545a0ec8" title="2.3 添加进程/应用 watch"><svg viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"></path></svg></a><span class="notion-h-title">2.3 添加进程/应用 watch</span></span></h4><blockquote class="notion-quote notion-block-3b5cde1d5f2243f1a1b19a551c8a4fb6"><div>pm2 start bin/www –watch</div></blockquote><h4 class="notion-h notion-h3 notion-h-indent-1 notion-block-9762089a0ba84475b42d1bf04645e402" data-id="9762089a0ba84475b42d1bf04645e402"><span><div id="9762089a0ba84475b42d1bf04645e402" class="notion-header-anchor"></div><a class="notion-hash-link" href="#9762089a0ba84475b42d1bf04645e402" title="2.4 结束进程/应用"><svg viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"></path></svg></a><span class="notion-h-title">2.4 结束进程/应用</span></span></h4><blockquote class="notion-quote notion-block-b966344707394899b2138120470514fc"><div>pm2 stop www</div></blockquote><h4 class="notion-h notion-h3 notion-h-indent-1 notion-block-eb752dd7d09443858e051fed2fb33bec" data-id="eb752dd7d09443858e051fed2fb33bec"><span><div id="eb752dd7d09443858e051fed2fb33bec" class="notion-header-anchor"></div><a class="notion-hash-link" href="#eb752dd7d09443858e051fed2fb33bec" title="2.5 结束所有进程/应用"><svg viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"></path></svg></a><span class="notion-h-title">2.5 结束所有进程/应用</span></span></h4><blockquote class="notion-quote notion-block-015c00bed5664d319fa0fbcfac3751c0"><div>pm2 stop all</div></blockquote><h4 class="notion-h notion-h3 notion-h-indent-1 notion-block-6c4dd6cef4d94a9e894b7a571df4468a" data-id="6c4dd6cef4d94a9e894b7a571df4468a"><span><div id="6c4dd6cef4d94a9e894b7a571df4468a" class="notion-header-anchor"></div><a class="notion-hash-link" href="#6c4dd6cef4d94a9e894b7a571df4468a" title="2.6 删除进程/应用"><svg viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"></path></svg></a><span class="notion-h-title">2.6 删除进程/应用</span></span></h4><blockquote class="notion-quote notion-block-a2075e3413464926921181da6e65ff51"><div>pm2 delete www</div></blockquote><h4 class="notion-h notion-h3 notion-h-indent-1 notion-block-3bd9b87d98894d488a1c11d81bcb616a" data-id="3bd9b87d98894d488a1c11d81bcb616a"><span><div id="3bd9b87d98894d488a1c11d81bcb616a" class="notion-header-anchor"></div><a class="notion-hash-link" href="#3bd9b87d98894d488a1c11d81bcb616a" title="2.7 删除所有进程/应用"><svg viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"></path></svg></a><span class="notion-h-title">2.7 删除所有进程/应用</span></span></h4><blockquote class="notion-quote notion-block-97c966288889421eb7b29bf795e9830f"><div>pm2 delete all</div></blockquote><h4 class="notion-h notion-h3 notion-h-indent-1 notion-block-124114106a1a4943bc1bfbbae3810850" data-id="124114106a1a4943bc1bfbbae3810850"><span><div id="124114106a1a4943bc1bfbbae3810850" class="notion-header-anchor"></div><a class="notion-hash-link" href="#124114106a1a4943bc1bfbbae3810850" title="2.8 列出所有进程/应用"><svg viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"></path></svg></a><span class="notion-h-title">2.8 列出所有进程/应用</span></span></h4><blockquote class="notion-quote notion-block-f4c8b9bf273b41fb90b125892267ae75"><div>pm2 list</div></blockquote><h4 class="notion-h notion-h3 notion-h-indent-1 notion-block-c5ab8673cd3548a689ffc9e723f1465a" data-id="c5ab8673cd3548a689ffc9e723f1465a"><span><div id="c5ab8673cd3548a689ffc9e723f1465a" class="notion-header-anchor"></div><a class="notion-hash-link" href="#c5ab8673cd3548a689ffc9e723f1465a" title="2.9 查看某个进程/应用具体情况"><svg viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"></path></svg></a><span class="notion-h-title">2.9 查看某个进程/应用具体情况</span></span></h4><blockquote class="notion-quote notion-block-acb0d845f0464718b2b62d96c62e9273"><div>pm2 describe www</div></blockquote><h4 class="notion-h notion-h3 notion-h-indent-1 notion-block-b11c274f33714c6da846dfbde5e3405e" data-id="b11c274f33714c6da846dfbde5e3405e"><span><div id="b11c274f33714c6da846dfbde5e3405e" class="notion-header-anchor"></div><a class="notion-hash-link" href="#b11c274f33714c6da846dfbde5e3405e" title="2.10 查看进程/应用的资源消耗情况"><svg viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"></path></svg></a><span class="notion-h-title">2.10 查看进程/应用的资源消耗情况</span></span></h4><blockquote class="notion-quote notion-block-2684ec9eeca94aa7884d19b0c21ba625"><div>pm2 monit</div></blockquote><h4 class="notion-h notion-h3 notion-h-indent-1 notion-block-d210bbd63c20491991466714c5759f11" data-id="d210bbd63c20491991466714c5759f11"><span><div id="d210bbd63c20491991466714c5759f11" class="notion-header-anchor"></div><a class="notion-hash-link" href="#d210bbd63c20491991466714c5759f11" title="2.11 查看 pm2 的日志"><svg viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"></path></svg></a><span class="notion-h-title">2.11 查看 pm2 的日志</span></span></h4><blockquote class="notion-quote notion-block-19cb0319d6c6464d95929126f7437b49"><div>pm2 logs</div></blockquote><h4 class="notion-h notion-h3 notion-h-indent-1 notion-block-cde0b6d1f3b34b30944853d4361664aa" data-id="cde0b6d1f3b34b30944853d4361664aa"><span><div id="cde0b6d1f3b34b30944853d4361664aa" class="notion-header-anchor"></div><a class="notion-hash-link" href="#cde0b6d1f3b34b30944853d4361664aa" title="2.11.1 删除日志"><svg viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"></path></svg></a><span class="notion-h-title">2.11.1 删除日志</span></span></h4><blockquote class="notion-quote notion-block-b05497f6a6a1455da49598fce1a90a29"><div>pm2 flush</div></blockquote><h4 class="notion-h notion-h3 notion-h-indent-1 notion-block-87c919df35364e53934cceb13bdf5a03" data-id="87c919df35364e53934cceb13bdf5a03"><span><div id="87c919df35364e53934cceb13bdf5a03" class="notion-header-anchor"></div><a class="notion-hash-link" href="#87c919df35364e53934cceb13bdf5a03" title="2.12 若要查看某个进程/应用的日志,使用"><svg viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"></path></svg></a><span class="notion-h-title">2.12 若要查看某个进程/应用的日志,使用</span></span></h4><blockquote class="notion-quote notion-block-94b5078c5e4a4d1599894d4ac561af08"><div>pm2 logs www</div></blockquote><h4 class="notion-h notion-h3 notion-h-indent-1 notion-block-33813d401e19485397968e4376fba202" data-id="33813d401e19485397968e4376fba202"><span><div id="33813d401e19485397968e4376fba202" class="notion-header-anchor"></div><a class="notion-hash-link" href="#33813d401e19485397968e4376fba202" title="2.13 重新启动进程/应用"><svg viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"></path></svg></a><span class="notion-h-title">2.13 重新启动进程/应用</span></span></h4><blockquote class="notion-quote notion-block-cd429e35a9ba4bc587e86587d7699ae0"><div>pm2 restart www</div></blockquote><h4 class="notion-h notion-h3 notion-h-indent-1 notion-block-6008e01a3cda425e900288cc36ea9842" data-id="6008e01a3cda425e900288cc36ea9842"><span><div id="6008e01a3cda425e900288cc36ea9842" class="notion-header-anchor"></div><a class="notion-hash-link" href="#6008e01a3cda425e900288cc36ea9842" title="2.14 重新启动所有进程/应用"><svg viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"></path></svg></a><span class="notion-h-title">2.14 重新启动所有进程/应用</span></span></h4><blockquote class="notion-quote notion-block-52af07fe30e746fab908c93f1950ab9f"><div>pm2 restart all</div></blockquote><h2 class="notion-h notion-h1 notion-h-indent-0 notion-block-88d2cf22dff74d90beb39847a596a32a" data-id="88d2cf22dff74d90beb39847a596a32a"><span><div id="88d2cf22dff74d90beb39847a596a32a" class="notion-header-anchor"></div><a class="notion-hash-link" href="#88d2cf22dff74d90beb39847a596a32a" title="分布式部署（负载均衡）"><svg viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"></path></svg></a><span class="notion-h-title">分布式部署（负载均衡）</span></span></h2><h4 class="notion-h notion-h3 notion-h-indent-1 notion-block-30911036bdd14c0196cb8d971119ce6a" data-id="30911036bdd14c0196cb8d971119ce6a"><span><div id="30911036bdd14c0196cb8d971119ce6a" class="notion-header-anchor"></div><a class="notion-hash-link" href="#30911036bdd14c0196cb8d971119ce6a" title="1、增加多少工作线程"><svg viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"></path></svg></a><span class="notion-h-title">1、增加多少工作线程</span></span></h4><blockquote class="notion-quote notion-block-8b0ffc095a134350bd02550770bda946"><div>pm2 scale app +3</div></blockquote><h4 class="notion-h notion-h3 notion-h-indent-1 notion-block-d7360bc10f514eabb1c0d272b601650d" data-id="d7360bc10f514eabb1c0d272b601650d"><span><div id="d7360bc10f514eabb1c0d272b601650d" class="notion-header-anchor"></div><a class="notion-hash-link" href="#d7360bc10f514eabb1c0d272b601650d" title="2、减少多少工作线程"><svg viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"></path></svg></a><span class="notion-h-title">2、减少多少工作线程</span></span></h4><div class="notion-blank notion-block-c23df59f12e84baaa597496d398d19bc"> </div></main></div>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[n– 交互式管理您的 Node.js 版本]]></title>
            <link>https://notion-next-ashy-five.vercel.app//article/blog-4</link>
            <guid>https://notion-next-ashy-five.vercel.app//article/blog-4</guid>
            <pubDate>Thu, 12 Oct 2023 00:00:00 GMT</pubDate>
            <description><![CDATA[n– 交互式管理您的 Node.js 版本]]></description>
            <content:encoded><![CDATA[<div id="notion-article" class="mx-auto overflow-hidden "><main class="notion light-mode notion-page notion-block-b0ede9b903794421b405be2cac640a16"><div class="notion-viewport"></div><div class="notion-collection-page-properties"></div><ul class="notion-list notion-list-disc notion-block-b6453a9daf6c4201a49aee76b3120637"><li>Node.js 版本管理：没有 subshells，没有配置文件设置，没有复杂的 API，只是简单的.</li></ul><h3 class="notion-h notion-h2 notion-h-indent-0 notion-block-81fdbf47f90d415db501a99ea5244f27" data-id="81fdbf47f90d415db501a99ea5244f27"><span><div id="81fdbf47f90d415db501a99ea5244f27" class="notion-header-anchor"></div><a class="notion-hash-link" href="#81fdbf47f90d415db501a99ea5244f27" title="支持的平台"><svg viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"></path></svg></a><span class="notion-h-title">支持的平台</span></span></h3><div class="notion-text notion-block-c7e6f56d862c474bbc35f9b2108ce35a">:::tip</div><ul class="notion-list notion-list-disc notion-block-554571c876384c04b793b564b63f4b8e"><li>n 在 macOS、Linux 上受支持，包括适用于 Linux 的 Windows 子系统和各种其他类 unix 系统。它是作为 BASH 脚本编写的，但不需要您使用 BASH 作为命令 shell。</li></ul><ul class="notion-list notion-list-disc notion-block-1939e0f559244c40b120e18c990d1520"><li>n 不适用于 Microsoft Windows（如 PowerShell）或 Git for Windows BASH 或 Cygwin DLL 上的本机 shell。 :::</li></ul><h3 class="notion-h notion-h2 notion-h-indent-0 notion-block-971a1a769265455cabde519334424d98" data-id="971a1a769265455cabde519334424d98"><span><div id="971a1a769265455cabde519334424d98" class="notion-header-anchor"></div><a class="notion-hash-link" href="#971a1a769265455cabde519334424d98" title="安装"><svg viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"></path></svg></a><span class="notion-h-title">安装</span></span></h3><ul class="notion-list notion-list-disc notion-block-d0dc44e1171d412a9bf954b0b592e48e"><li>如果你已经安装了 Node.js，一个简单的安装方法 n 是使用 npm：</li></ul><h4 class="notion-h notion-h3 notion-h-indent-1 notion-block-86a47e8d25fa426fba13a830d87cdbc6" data-id="86a47e8d25fa426fba13a830d87cdbc6"><span><div id="86a47e8d25fa426fba13a830d87cdbc6" class="notion-header-anchor"></div><a class="notion-hash-link" href="#86a47e8d25fa426fba13a830d87cdbc6" title="第三方安装程序"><svg viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"></path></svg></a><span class="notion-h-title">第三方安装程序</span></span></h4><h3 class="notion-h notion-h2 notion-h-indent-0 notion-block-8a317764d74b42198e91325e1fd966be" data-id="8a317764d74b42198e91325e1fd966be"><span><div id="8a317764d74b42198e91325e1fd966be" class="notion-header-anchor"></div><a class="notion-hash-link" href="#8a317764d74b42198e91325e1fd966be" title="安装 Node.js 版本"><svg viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"></path></svg></a><span class="notion-h-title">安装 Node.js 版本</span></span></h3><ul class="notion-list notion-list-disc notion-block-a7d3e9d2b16c4b8683c6219ed0037656"><li>只需执行 n <code class="notion-inline-code">version</code>下载并安装一个版本的 Node.js。如果<code class="notion-inline-code">version</code>已经下载，n 将从其缓存中安装。</li></ul><ul class="notion-list notion-list-disc notion-block-fd542d0b2738494d8a30ea5aee28d8a7"><li>n 自行执行以查看您下载的版本，并安装选定的版本。</li></ul><h3 class="notion-h notion-h2 notion-h-indent-0 notion-block-02ca037d5aec4b2298580e02dd7919ba" data-id="02ca037d5aec4b2298580e02dd7919ba"><span><div id="02ca037d5aec4b2298580e02dd7919ba" class="notion-header-anchor"></div><a class="notion-hash-link" href="#02ca037d5aec4b2298580e02dd7919ba" title="指定 Node.js 版本"><svg viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"></path></svg></a><span class="notion-h-title">指定 Node.js 版本</span></span></h3><div class="notion-text notion-block-0c6fc70858364ea58c4243bc63b653c5">有多种方法可以为 n 命令指定目标 Node.js 版本。大多数命令使用最新的匹配版本，并 n ls-remote 列出多个匹配版本。 数字版本号可以是完整的或不完整的，带有可选的前导 v。</div><ul class="notion-list notion-list-disc notion-block-4bb6321849a64e0aa6476217d1113fd3"><li>4.9.1</li></ul><ul class="notion-list notion-list-disc notion-block-e7b7fd3d93f14bf28ed7624dac6b9f46"><li>8: 8.xy 版本</li></ul><ul class="notion-list notion-list-disc notion-block-09c6a9bd6d9c4f9fa2bad6e26bf20c38"><li>v6.1: 6.1.x 版本 有两个特别有用的版本的标签：</li></ul><ul class="notion-list notion-list-disc notion-block-2b8fe47921084b79825d964653c2c234"><li>lts: 最新的长期支持官方版本</li></ul><ul class="notion-list notion-list-disc notion-block-c8b1ad810fcb444f99fa0cf0f82b3e4f"><li>latest, current: 最新官方发布</li></ul><h3 class="notion-h notion-h2 notion-h-indent-0 notion-block-b3122c7d88b44eeca1a35770c2d07c88" data-id="b3122c7d88b44eeca1a35770c2d07c88"><span><div id="b3122c7d88b44eeca1a35770c2d07c88" class="notion-header-anchor"></div><a class="notion-hash-link" href="#b3122c7d88b44eeca1a35770c2d07c88" title="删除版本"><svg viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"></path></svg></a><span class="notion-h-title">删除版本</span></span></h3><div class="notion-text notion-block-5b671dd147034db4953abbb20e8db760">删除一些缓存版本：</div><div class="notion-text notion-block-d3b34ba6372c4095953f354cc4e5859c">删除除已安装版本之外的所有缓存版本：</div><h3 class="notion-h notion-h2 notion-h-indent-0 notion-block-fbf1c3eda08746bf83c603ea3c841ef6" data-id="fbf1c3eda08746bf83c603ea3c841ef6"><span><div id="fbf1c3eda08746bf83c603ea3c841ef6" class="notion-header-anchor"></div><a class="notion-hash-link" href="#fbf1c3eda08746bf83c603ea3c841ef6" title="保留 npm"><svg viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"></path></svg></a><span class="notion-h-title">保留 npm</span></span></h3><div class="notion-text notion-block-3866226475de4f79b352edc8a5a49d21">Node.js 安装通常还包括 npm、 npx 和 corepack，但您可能希望使用以下方式保留当前（尤其是较新）版本–preserve：</div><h3 class="notion-h notion-h2 notion-h-indent-0 notion-block-ece6ba1f89ff4553a5f37db967ea0eb3" data-id="ece6ba1f89ff4553a5f37db967ea0eb3"><span><div id="ece6ba1f89ff4553a5f37db967ea0eb3" class="notion-header-anchor"></div><a class="notion-hash-link" href="#ece6ba1f89ff4553a5f37db967ea0eb3" title="各种各样的"><svg viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"></path></svg></a><span class="notion-h-title">各种各样的</span></span></h3><div class="notion-text notion-block-cf1b1e7dd36c42f2a63e6d250affd2fa">命令行帮助可以从<code class="notion-inline-code">n --help</code></div><div class="notion-blank notion-block-d7c7a70cfdeb45f4b613231c71decfca"> </div></main></div>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[格式化工具-Prettier]]></title>
            <link>https://notion-next-ashy-five.vercel.app//article/blog-3</link>
            <guid>https://notion-next-ashy-five.vercel.app//article/blog-3</guid>
            <pubDate>Thu, 12 Oct 2023 00:00:00 GMT</pubDate>
            <description><![CDATA[格式化工具-Prettier详细介绍]]></description>
            <content:encoded><![CDATA[<div id="notion-article" class="mx-auto overflow-hidden "><main class="notion light-mode notion-page notion-block-5da53b4fd3b64cc0b3723c6238b0a9a8"><div class="notion-viewport"></div><div class="notion-collection-page-properties"></div><h2 class="notion-h notion-h1 notion-h-indent-0 notion-block-99b9bc25c48049f49e838e21252354c8" data-id="99b9bc25c48049f49e838e21252354c8"><span><div id="99b9bc25c48049f49e838e21252354c8" class="notion-header-anchor"></div><a class="notion-hash-link" href="#99b9bc25c48049f49e838e21252354c8" title="Prettier"><svg viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"></path></svg></a><span class="notion-h-title">Prettier</span></span></h2><h3 class="notion-h notion-h2 notion-h-indent-1 notion-block-1897e2fd0a63402695806a9bdcae99c9" data-id="1897e2fd0a63402695806a9bdcae99c9"><span><div id="1897e2fd0a63402695806a9bdcae99c9" class="notion-header-anchor"></div><a class="notion-hash-link" href="#1897e2fd0a63402695806a9bdcae99c9" title="什么是 Prettier"><svg viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"></path></svg></a><span class="notion-h-title">什么是 Prettier</span></span></h3><ul class="notion-list notion-list-disc notion-block-1e05e772b27b4a99a1b8949b527e0ef8"><li>Prettier 是一个固执己见的代码格式化程序，支持：</li></ul><ul class="notion-list notion-list-disc notion-block-81c6c1cbd5414ceabeb3998cf09b50b3"><li>它删除了所有原始样式*并确保所有输出的代码符合一致的样式</li></ul><h3 class="notion-h notion-h2 notion-h-indent-1 notion-block-496e3f74c0524b958867b7b9a2cd27be" data-id="496e3f74c0524b958867b7b9a2cd27be"><span><div id="496e3f74c0524b958867b7b9a2cd27be" class="notion-header-anchor"></div><a class="notion-hash-link" href="#496e3f74c0524b958867b7b9a2cd27be" title="安装"><svg viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"></path></svg></a><span class="notion-h-title">安装</span></span></h3><h3 class="notion-h notion-h2 notion-h-indent-1 notion-block-6cd93075422e4b32b2b0863d98e85a54" data-id="6cd93075422e4b32b2b0863d98e85a54"><span><div id="6cd93075422e4b32b2b0863d98e85a54" class="notion-header-anchor"></div><a class="notion-hash-link" href="#6cd93075422e4b32b2b0863d98e85a54" title="使用"><svg viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"></path></svg></a><span class="notion-h-title">使用</span></span></h3><ul class="notion-list notion-list-disc notion-block-55d9c5b5c3d94874a5774ede7ce2a3e9"><li>在 package script 添加 fromat 执行 Prettier</li></ul><div class="notion-text notion-block-fb940c67b7bb4ac4957edd9c088ac783"><code class="notion-inline-code">json title=&quot;package.json&quot; {   &quot;scripts&quot;: {     &quot;format&quot;: &quot;prettier --write .&quot;   } }</code></div><div class="notion-text notion-block-9d090e7859b24b9db8fd2033a2865527">运行 npm run format 即可对代码进行格式化</div><h3 class="notion-h notion-h2 notion-h-indent-1 notion-block-6637002de5e640698f85013bca5f1711" data-id="6637002de5e640698f85013bca5f1711"><span><div id="6637002de5e640698f85013bca5f1711" class="notion-header-anchor"></div><a class="notion-hash-link" href="#6637002de5e640698f85013bca5f1711" title="配置文件"><svg viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"></path></svg></a><span class="notion-h-title">配置文件</span></span></h3><ul class="notion-list notion-list-disc notion-block-80ad364d22b146cfb45949b79f7d7274"><li>创建 .prettierrc ｜.prettierrc.yml ｜ .prettierrc.yaml 任意文件 已.prettierrc 为例： 基本配置</li></ul><h3 class="notion-h notion-h2 notion-h-indent-1 notion-block-6704ed9343d346838566edc950d90694" data-id="6704ed9343d346838566edc950d90694"><span><div id="6704ed9343d346838566edc950d90694" class="notion-header-anchor"></div><a class="notion-hash-link" href="#6704ed9343d346838566edc950d90694" title="忽略文件.prettierignore"><svg viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"></path></svg></a><span class="notion-h-title">忽略文件.prettierignore</span></span></h3><ul class="notion-list notion-list-disc notion-block-b98ddfe28a334bd29b1d57baa9ce4800"><li>要从格式化中排除文件，.prettierignore 请在项目的根目录中创建一个文件。.prettierignore 使用 gitignore 语法。 例如</li></ul><h3 class="notion-h notion-h2 notion-h-indent-1 notion-block-15213c2ed61745b78af9f2a4aa4b6691" data-id="15213c2ed61745b78af9f2a4aa4b6691"><span><div id="15213c2ed61745b78af9f2a4aa4b6691" class="notion-header-anchor"></div><a class="notion-hash-link" href="#15213c2ed61745b78af9f2a4aa4b6691" title="优点"><svg viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"></path></svg></a><span class="notion-h-title">优点</span></span></h3><ul class="notion-list notion-list-disc notion-block-389af9cf02744bd1b3890bf5ffbdc347"><li>您按保存并格式化代码</li></ul><ul class="notion-list notion-list-disc notion-block-b9d9967a995f48869f0ecf1a94e3e0a4"><li>无需在代码审查中讨论风格</li></ul><ul class="notion-list notion-list-disc notion-block-a4dd96fd0d8f494e892c805fdb652769"><li>节省您的时间和精力</li></ul></main></div>]]></content:encoded>
        </item>
    </channel>
</rss>