<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
  <channel>
    <title>Bobby's Blog</title>
    <description>Welcome! 此博客源码请访问: https://github.com/JiaoJianbo/jiaojianbo.github.io</description>
    <link>https://jiaojianbo.github.io/</link>
    <atom:link href="https://jiaojianbo.github.io/feed.xml" rel="self" type="application/rss+xml"/>
    <pubDate>Sun, 10 Sep 2023 14:58:08 +0000</pubDate>
    <lastBuildDate>Sun, 10 Sep 2023 14:58:08 +0000</lastBuildDate>
    <generator>Jekyll v3.9.3</generator>
    
      <item>
        <title>npm 学习笔记</title>
        <description>&lt;ul id=&quot;markdown-toc&quot;&gt;
  &lt;li&gt;&lt;a href=&quot;#前言&quot; id=&quot;markdown-toc-前言&quot;&gt;前言&lt;/a&gt;    &lt;ul&gt;
      &lt;li&gt;&lt;a href=&quot;#常用的包管理工具&quot; id=&quot;markdown-toc-常用的包管理工具&quot;&gt;常用的包管理工具&lt;/a&gt;&lt;/li&gt;
    &lt;/ul&gt;
  &lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;#npm&quot; id=&quot;markdown-toc-npm&quot;&gt;npm&lt;/a&gt;    &lt;ul&gt;
      &lt;li&gt;&lt;a href=&quot;#npm-的安装&quot; id=&quot;markdown-toc-npm-的安装&quot;&gt;npm 的安装&lt;/a&gt;&lt;/li&gt;
      &lt;li&gt;&lt;a href=&quot;#npm-基本使用&quot; id=&quot;markdown-toc-npm-基本使用&quot;&gt;npm 基本使用&lt;/a&gt;        &lt;ul&gt;
          &lt;li&gt;&lt;a href=&quot;#初始化&quot; id=&quot;markdown-toc-初始化&quot;&gt;初始化&lt;/a&gt;&lt;/li&gt;
          &lt;li&gt;&lt;a href=&quot;#搜索包&quot; id=&quot;markdown-toc-搜索包&quot;&gt;搜索包&lt;/a&gt;&lt;/li&gt;
          &lt;li&gt;&lt;a href=&quot;#下载和安装包&quot; id=&quot;markdown-toc-下载和安装包&quot;&gt;下载和安装包&lt;/a&gt;&lt;/li&gt;
          &lt;li&gt;&lt;a href=&quot;#require-导入-npm-包的流程&quot; id=&quot;markdown-toc-require-导入-npm-包的流程&quot;&gt;require 导入 npm 包的流程&lt;/a&gt;&lt;/li&gt;
        &lt;/ul&gt;
      &lt;/li&gt;
      &lt;li&gt;&lt;a href=&quot;#开发依赖与生产依赖&quot; id=&quot;markdown-toc-开发依赖与生产依赖&quot;&gt;开发依赖与生产依赖&lt;/a&gt;&lt;/li&gt;
      &lt;li&gt;&lt;a href=&quot;#全局安装&quot; id=&quot;markdown-toc-全局安装&quot;&gt;全局安装&lt;/a&gt;        &lt;ul&gt;
          &lt;li&gt;&lt;a href=&quot;#修改-windows-执行策略&quot; id=&quot;markdown-toc-修改-windows-执行策略&quot;&gt;修改 Windows 执行策略&lt;/a&gt;&lt;/li&gt;
        &lt;/ul&gt;
      &lt;/li&gt;
      &lt;li&gt;&lt;a href=&quot;#安装包的所有依赖&quot; id=&quot;markdown-toc-安装包的所有依赖&quot;&gt;安装包的所有依赖&lt;/a&gt;&lt;/li&gt;
      &lt;li&gt;&lt;a href=&quot;#安装指定版本的包&quot; id=&quot;markdown-toc-安装指定版本的包&quot;&gt;安装指定版本的包&lt;/a&gt;&lt;/li&gt;
      &lt;li&gt;&lt;a href=&quot;#删除依赖&quot; id=&quot;markdown-toc-删除依赖&quot;&gt;删除依赖&lt;/a&gt;&lt;/li&gt;
      &lt;li&gt;&lt;a href=&quot;#配置命令别名&quot; id=&quot;markdown-toc-配置命令别名&quot;&gt;配置命令别名&lt;/a&gt;&lt;/li&gt;
    &lt;/ul&gt;
  &lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;#cnpm&quot; id=&quot;markdown-toc-cnpm&quot;&gt;cnpm&lt;/a&gt;    &lt;ul&gt;
      &lt;li&gt;&lt;a href=&quot;#介绍&quot; id=&quot;markdown-toc-介绍&quot;&gt;介绍&lt;/a&gt;&lt;/li&gt;
      &lt;li&gt;&lt;a href=&quot;#安装&quot; id=&quot;markdown-toc-安装&quot;&gt;安装&lt;/a&gt;&lt;/li&gt;
      &lt;li&gt;&lt;a href=&quot;#操作命令&quot; id=&quot;markdown-toc-操作命令&quot;&gt;操作命令&lt;/a&gt;&lt;/li&gt;
      &lt;li&gt;&lt;a href=&quot;#给-npm-配置淘宝镜像&quot; id=&quot;markdown-toc-给-npm-配置淘宝镜像&quot;&gt;给 npm 配置淘宝镜像&lt;/a&gt;        &lt;ul&gt;
          &lt;li&gt;&lt;a href=&quot;#直接配置&quot; id=&quot;markdown-toc-直接配置&quot;&gt;直接配置&lt;/a&gt;&lt;/li&gt;
          &lt;li&gt;&lt;a href=&quot;#工具配置&quot; id=&quot;markdown-toc-工具配置&quot;&gt;工具配置&lt;/a&gt;&lt;/li&gt;
        &lt;/ul&gt;
      &lt;/li&gt;
    &lt;/ul&gt;
  &lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;#yarn&quot; id=&quot;markdown-toc-yarn&quot;&gt;yarn&lt;/a&gt;    &lt;ul&gt;
      &lt;li&gt;&lt;a href=&quot;#介绍-1&quot; id=&quot;markdown-toc-介绍-1&quot;&gt;介绍&lt;/a&gt;&lt;/li&gt;
      &lt;li&gt;&lt;a href=&quot;#特点&quot; id=&quot;markdown-toc-特点&quot;&gt;特点&lt;/a&gt;&lt;/li&gt;
      &lt;li&gt;&lt;a href=&quot;#安装-1&quot; id=&quot;markdown-toc-安装-1&quot;&gt;安装&lt;/a&gt;&lt;/li&gt;
      &lt;li&gt;&lt;a href=&quot;#常用命令&quot; id=&quot;markdown-toc-常用命令&quot;&gt;常用命令&lt;/a&gt;&lt;/li&gt;
      &lt;li&gt;&lt;a href=&quot;#配置淘宝镜像&quot; id=&quot;markdown-toc-配置淘宝镜像&quot;&gt;配置淘宝镜像&lt;/a&gt;&lt;/li&gt;
      &lt;li&gt;&lt;a href=&quot;#npm-和-yarn-的选择&quot; id=&quot;markdown-toc-npm-和-yarn-的选择&quot;&gt;npm 和 yarn 的选择&lt;/a&gt;&lt;/li&gt;
    &lt;/ul&gt;
  &lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;#管理发布包&quot; id=&quot;markdown-toc-管理发布包&quot;&gt;管理发布包&lt;/a&gt;    &lt;ul&gt;
      &lt;li&gt;&lt;a href=&quot;#创建与发布&quot; id=&quot;markdown-toc-创建与发布&quot;&gt;创建与发布&lt;/a&gt;&lt;/li&gt;
      &lt;li&gt;&lt;a href=&quot;#更新包&quot; id=&quot;markdown-toc-更新包&quot;&gt;更新包&lt;/a&gt;&lt;/li&gt;
      &lt;li&gt;&lt;a href=&quot;#删除包&quot; id=&quot;markdown-toc-删除包&quot;&gt;删除包&lt;/a&gt;&lt;/li&gt;
    &lt;/ul&gt;
  &lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;#扩展内容&quot; id=&quot;markdown-toc-扩展内容&quot;&gt;扩展内容&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;#nvm&quot; id=&quot;markdown-toc-nvm&quot;&gt;nvm&lt;/a&gt;    &lt;ul&gt;
      &lt;li&gt;&lt;a href=&quot;#介绍-2&quot; id=&quot;markdown-toc-介绍-2&quot;&gt;介绍&lt;/a&gt;&lt;/li&gt;
      &lt;li&gt;&lt;a href=&quot;#使用&quot; id=&quot;markdown-toc-使用&quot;&gt;使用&lt;/a&gt;        &lt;ul&gt;
          &lt;li&gt;&lt;a href=&quot;#下载安装&quot; id=&quot;markdown-toc-下载安装&quot;&gt;下载安装&lt;/a&gt;&lt;/li&gt;
          &lt;li&gt;&lt;a href=&quot;#常用命令-1&quot; id=&quot;markdown-toc-常用命令-1&quot;&gt;常用命令&lt;/a&gt;&lt;/li&gt;
        &lt;/ul&gt;
      &lt;/li&gt;
    &lt;/ul&gt;
  &lt;/li&gt;
&lt;/ul&gt;

npm 学习笔记

&lt;h2 id=&quot;前言&quot;&gt;前言&lt;/h2&gt;

&lt;h3 id=&quot;常用的包管理工具&quot;&gt;常用的包管理工具&lt;/h3&gt;
&lt;ul&gt;
  &lt;li&gt;npm&lt;/li&gt;
  &lt;li&gt;yarn&lt;/li&gt;
  &lt;li&gt;cnpm&lt;/li&gt;
&lt;/ul&gt;

&lt;h2 id=&quot;npm&quot;&gt;npm&lt;/h2&gt;
npm 全称 &lt;strong&gt;Node Package Manager&lt;/strong&gt;, 即 Node 的包管理工具。
npm 是 node.js 官方内置的包管理工具

&lt;h3 id=&quot;npm-的安装&quot;&gt;npm 的安装&lt;/h3&gt;
node.js 安装时会自动安装 npm，所以如果你已经安装了 node.js，就可以直接使用 npm

可以通过 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;npm -v&lt;/code&gt; 查看版本号来测试，如果显示版本号说明安装成功，反之安装失败

&lt;img src=&quot;/assets/images/2023/09/npm-v.png&quot; alt=&quot;npm-v&quot; /&gt;

&lt;h3 id=&quot;npm-基本使用&quot;&gt;npm 基本使用&lt;/h3&gt;

&lt;h4 id=&quot;初始化&quot;&gt;初始化&lt;/h4&gt;
&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;npm init&lt;/code&gt; 命令的作用是将一个文件夹初始化为一个“包”，交互式创建 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;package.json&lt;/code&gt; 文件&lt;br /&gt;
&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;package.json&lt;/code&gt; 是包的配置文件，每个包都必须有个 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;package.json&lt;/code&gt;

&lt;img src=&quot;/assets/images/2023/09/npm-init.png&quot; alt=&quot;npm-init&quot; /&gt;

&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;package.json&lt;/code&gt; 内容：
&lt;div class=&quot;language-json highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
  &lt;/span&gt;&lt;span class=&quot;nl&quot;&gt;&quot;name&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;01_npm&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;                 &lt;/span&gt;&lt;span class=&quot;err&quot;&gt;#&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;err&quot;&gt;包的名称&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
  &lt;/span&gt;&lt;span class=&quot;nl&quot;&gt;&quot;version&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;1.0.0&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;               &lt;/span&gt;&lt;span class=&quot;err&quot;&gt;#&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;err&quot;&gt;包的版本&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
  &lt;/span&gt;&lt;span class=&quot;nl&quot;&gt;&quot;description&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;01 npm learning&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;err&quot;&gt;#&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;err&quot;&gt;包的描述&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
  &lt;/span&gt;&lt;span class=&quot;nl&quot;&gt;&quot;main&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;index.js&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;               &lt;/span&gt;&lt;span class=&quot;err&quot;&gt;#&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;err&quot;&gt;包的入口&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
  &lt;/span&gt;&lt;span class=&quot;nl&quot;&gt;&quot;scripts&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;                      &lt;/span&gt;&lt;span class=&quot;err&quot;&gt;#&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;err&quot;&gt;脚本配置&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
    &lt;/span&gt;&lt;span class=&quot;nl&quot;&gt;&quot;test&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;echo &lt;/span&gt;&lt;span class=&quot;se&quot;&gt;\&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;Error: no test specified&lt;/span&gt;&lt;span class=&quot;se&quot;&gt;\&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt; &amp;amp;&amp;amp; exit 1&quot;&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
  &lt;/span&gt;&lt;span class=&quot;p&quot;&gt;},&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
  &lt;/span&gt;&lt;span class=&quot;nl&quot;&gt;&quot;author&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;                     &lt;/span&gt;&lt;span class=&quot;err&quot;&gt;#&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;err&quot;&gt;作者&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
  &lt;/span&gt;&lt;span class=&quot;nl&quot;&gt;&quot;license&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;ISC&quot;&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;                  &lt;/span&gt;&lt;span class=&quot;err&quot;&gt;#&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;err&quot;&gt;许可证&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;strong&gt;初始化过程中的一些注意事项&lt;/strong&gt;
&lt;ol&gt;
  &lt;li&gt;package name 不能用中文、大写字母，默认就是当前文件夹的名称，所以文件夹也不要使用中文和大写字母&lt;/li&gt;
  &lt;li&gt;version 要求 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;x.y.z&lt;/code&gt; 的形式, 且必须是数字，默认 1.0.0&lt;/li&gt;
  &lt;li&gt;ISC 与 MIT 证书功能上是相同的，关于开源证书扩展阅读
&lt;a href=&quot;https://www.ruanyifeng.com/blog/2011/05/how_to_choose_free_software_licenses.html&quot;&gt;如何选择开源许可证？&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;package.json&lt;/code&gt; 可以手动创建与修改&lt;/li&gt;
  &lt;li&gt;使用 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;npm init -y&lt;/code&gt; 或者 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;npm init --yes&lt;/code&gt; 极速创建  &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;package.json&lt;/code&gt; 
&lt;img src=&quot;/assets/images/2023/09/npm-init-y.png&quot; alt=&quot;npm-init-y&quot; /&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;h4 id=&quot;搜索包&quot;&gt;搜索包&lt;/h4&gt;
&lt;ol&gt;
  &lt;li&gt;命令搜索，&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;npm s [keyword]&lt;/code&gt; 或 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;npm search [keyword]&lt;/code&gt;&lt;/li&gt;
  &lt;li&gt;网站搜索，&lt;a href=&quot;https://www.npmjs.com/&quot;&gt;https://www.npmjs.com&lt;/a&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;h4 id=&quot;下载和安装包&quot;&gt;下载和安装包&lt;/h4&gt;
通过 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;npm install [package_name]&lt;/code&gt; 或 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;npm i [package_name]&lt;/code&gt; 命令安装包。前提是当前文件夹已经初始化过了。
运行之后文件夹下面会增加两个资源：
&lt;ul&gt;
  &lt;li&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;node_modules&lt;/code&gt; 文件夹，存放下载的包&lt;/li&gt;
  &lt;li&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;package-lock.json&lt;/code&gt; 包的锁文件，用来锁定包的版本&lt;/li&gt;
&lt;/ul&gt;

示例: &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;npm i nanoid&lt;/code&gt;

&lt;img src=&quot;/assets/images/2023/09/npm-install.png&quot; alt=&quot;npm-install&quot; /&gt;

&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;package-lock.json&lt;/code&gt;:
&lt;div class=&quot;language-json highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
  &lt;/span&gt;&lt;span class=&quot;nl&quot;&gt;&quot;name&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;npm_study&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
  &lt;/span&gt;&lt;span class=&quot;nl&quot;&gt;&quot;version&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;1.0.0&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
  &lt;/span&gt;&lt;span class=&quot;nl&quot;&gt;&quot;lockfileVersion&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;3&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
  &lt;/span&gt;&lt;span class=&quot;nl&quot;&gt;&quot;requires&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;kc&quot;&gt;true&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
  &lt;/span&gt;&lt;span class=&quot;nl&quot;&gt;&quot;packages&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
    &lt;/span&gt;&lt;span class=&quot;nl&quot;&gt;&quot;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
      &lt;/span&gt;&lt;span class=&quot;nl&quot;&gt;&quot;name&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;npm_study&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
      &lt;/span&gt;&lt;span class=&quot;nl&quot;&gt;&quot;version&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;1.0.0&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
      &lt;/span&gt;&lt;span class=&quot;nl&quot;&gt;&quot;license&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;ISC&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
      &lt;/span&gt;&lt;span class=&quot;nl&quot;&gt;&quot;dependencies&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
        &lt;/span&gt;&lt;span class=&quot;nl&quot;&gt;&quot;nanoid&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;^4.0.2&quot;&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
      &lt;/span&gt;&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
    &lt;/span&gt;&lt;span class=&quot;p&quot;&gt;},&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
    &lt;/span&gt;&lt;span class=&quot;nl&quot;&gt;&quot;node_modules/nanoid&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
      &lt;/span&gt;&lt;span class=&quot;nl&quot;&gt;&quot;version&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;4.0.2&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
      &lt;/span&gt;&lt;span class=&quot;nl&quot;&gt;&quot;resolved&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;https://registry.npmmirror.com/nanoid/-/nanoid-4.0.2.tgz&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
      &lt;/span&gt;&lt;span class=&quot;nl&quot;&gt;&quot;integrity&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;sha512-7ZtY5KTCNheRGfEFxnedV5zFiORN1+Y1N6zvPTnHQd8ENUvfaDBeuJDZb2bN/oXwXxu3qkTXDzy57W5vAmDTBw==&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
      &lt;/span&gt;&lt;span class=&quot;nl&quot;&gt;&quot;bin&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
        &lt;/span&gt;&lt;span class=&quot;nl&quot;&gt;&quot;nanoid&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;bin/nanoid.js&quot;&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
      &lt;/span&gt;&lt;span class=&quot;p&quot;&gt;},&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
      &lt;/span&gt;&lt;span class=&quot;nl&quot;&gt;&quot;engines&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
        &lt;/span&gt;&lt;span class=&quot;nl&quot;&gt;&quot;node&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;^14 || ^16 || &amp;gt;=18&quot;&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
      &lt;/span&gt;&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
    &lt;/span&gt;&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
  &lt;/span&gt;&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h4 id=&quot;require-导入-npm-包的流程&quot;&gt;require 导入 npm 包的流程&lt;/h4&gt;
&lt;ol&gt;
  &lt;li&gt;在当前文件夹 node_modules 中寻找同名的文件夹&lt;/li&gt;
  &lt;li&gt;在上级目录中的 node_modules 中寻找同名的文件夹，直到找到磁盘根目录&lt;/li&gt;
&lt;/ol&gt;

&lt;h3 id=&quot;开发依赖与生产依赖&quot;&gt;开发依赖与生产依赖&lt;/h3&gt;
我们可以在安装时设置参数来区分依赖类型，主要分两类

&lt;table&gt;
  &lt;thead&gt;
    &lt;tr&gt;
      &lt;th&gt;类型&lt;/th&gt;
      &lt;th&gt;命令&lt;/th&gt;
      &lt;th&gt;补充&lt;/th&gt;
    &lt;/tr&gt;
  &lt;/thead&gt;
  &lt;tbody&gt;
    &lt;tr&gt;
      &lt;td&gt;生产依赖&lt;/td&gt;
      &lt;td&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;npm -S nanoid&lt;/code&gt; &lt;br /&gt; &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;npm i --save nanoid&lt;/code&gt;&lt;/td&gt;
      &lt;td&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;-S&lt;/code&gt; 等同于 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;--save&lt;/code&gt;, &lt;strong&gt;-S 是默认选项&lt;/strong&gt; &lt;br /&gt; 包信息保存在 package.json &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;dependencies&lt;/code&gt; 属性中&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;开发依赖&lt;/td&gt;
      &lt;td&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;npm i -D less&lt;/code&gt; &lt;br /&gt; &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;npm i --save-dev less&lt;/code&gt;&lt;/td&gt;
      &lt;td&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;-D&lt;/code&gt; 等同于 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;--save-dev&lt;/code&gt; &lt;br /&gt; 包信息保存在 package.json &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;devDependencies&lt;/code&gt; 属性中&lt;/td&gt;
    &lt;/tr&gt;
  &lt;/tbody&gt;
&lt;/table&gt;

&lt;strong&gt;开发依赖&lt;/strong&gt;只是在开发阶段依赖的包，而&lt;strong&gt;生产依赖&lt;/strong&gt;是开发阶段和最终上线运行阶段都要用到的依赖包

&lt;h3 id=&quot;全局安装&quot;&gt;全局安装&lt;/h3&gt;
执行安装选项 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;-g&lt;/code&gt; 进行全局安装。例如安装 nodemon, &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;npm i -g nodemon&lt;/code&gt;
全局安装完成后，就可以在命令行的任何位置运行 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;nodemon&lt;/code&gt; 命令。该命令的作用是重启 node 应用程序，开发阶段，当修改完 js 文件并保存后，会自动重启服务（当你的服务是用 nodemon 命令运行的时）
说明：
&lt;ul&gt;
  &lt;li&gt;全局安装的命令不受工作目录位置影响&lt;/li&gt;
  &lt;li&gt;可以通过 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;npm root -g&lt;/code&gt; 可以查看全局安装包的位置
&lt;img src=&quot;/assets/images/2023/09/npm-root-g.png&quot; alt=&quot;npm-root-g&quot; /&gt;&lt;/li&gt;
  &lt;li&gt;&lt;strong&gt;不是所有的包都适合全局安装&lt;/strong&gt;，只有全局类的工具才适合，可以通过查看包的官方文档来确定安装方式&lt;/li&gt;
&lt;/ul&gt;

&lt;h4 id=&quot;修改-windows-执行策略&quot;&gt;修改 Windows 执行策略&lt;/h4&gt;
Windows 默认不允许 npm 全局命令执行脚本文件，所以需要修改 Windows 执行策略
&lt;ol&gt;
  &lt;li&gt;
    以&lt;strong&gt;管理员身份&lt;/strong&gt;打开 powershell 命令行
&lt;img src=&quot;/assets/images/2023/09/windows-powershell.png&quot; alt=&quot;windows-powershell&quot; /&gt;
  &lt;/li&gt;
  &lt;li&gt;
    输入命令 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;set-ExecutionPolicy remoteSigned&lt;/code&gt;
&lt;img src=&quot;/assets/images/2023/09/windows-set-policy.png&quot; alt=&quot;windows-set-policy&quot; /&gt;
  &lt;/li&gt;
  &lt;li&gt;
    输入 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;A&lt;/code&gt;，回车
  &lt;/li&gt;
  &lt;li&gt;
    重启 vscode
  &lt;/li&gt;
&lt;/ol&gt;

其实还有另外的解决办法，使用 cmd 命令行，不要使用默认的 powershell
&lt;img src=&quot;/assets/images/2023/09/vscode-term.png&quot; alt=&quot;vscode-term&quot; /&gt;

&lt;h3 id=&quot;安装包的所有依赖&quot;&gt;安装包的所有依赖&lt;/h3&gt;
通过 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;npm i&lt;/code&gt; 或者 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;npm install&lt;/code&gt; 可以依据 package.json 和 package-lock.json 的依赖声明安装项目依赖&lt;br /&gt;
node_modules 文件夹大多数情况都不会上传到代码仓库

&lt;h3 id=&quot;安装指定版本的包&quot;&gt;安装指定版本的包&lt;/h3&gt;
命令： &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;npm i [package_name@version]&lt;/code&gt;, 例如：&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;npm i jquery@1.11.2&lt;/code&gt;

&lt;h3 id=&quot;删除依赖&quot;&gt;删除依赖&lt;/h3&gt;
命令： &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;npm r [package_name]&lt;/code&gt; 或者 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;npm remove [package_name]&lt;/code&gt;&lt;br /&gt;
全局删除命令：&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;npm r -g [package_name]&lt;/code&gt; 或者 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;npm remove -g [package_name]&lt;/code&gt;

&lt;h3 id=&quot;配置命令别名&quot;&gt;配置命令别名&lt;/h3&gt;
通过配置命令别名可以更简单地执行命令

配置 package.json 中的 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;scripts&lt;/code&gt; 属性
&lt;div class=&quot;language-json highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
  
  &lt;/span&gt;&lt;span class=&quot;nl&quot;&gt;&quot;scripts&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
    &lt;/span&gt;&lt;span class=&quot;nl&quot;&gt;&quot;server&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;node server.js&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
    &lt;/span&gt;&lt;span class=&quot;nl&quot;&gt;&quot;start&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;node index.js&quot;&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
  &lt;/span&gt;&lt;span class=&quot;p&quot;&gt;},&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
  
&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
配置完成后，可以使用别名执行命令：
&lt;div class=&quot;language-shell highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;npm run server
npm run start
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
不过 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;start&lt;/code&gt; 别名比较特别，使用时可以省略 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;run&lt;/code&gt;，即 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;npm start&lt;/code&gt;

补充说明：
&lt;ul&gt;
  &lt;li&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;npm start&lt;/code&gt; 是项目中常用的一个命令，一般用来启动项目&lt;/li&gt;
  &lt;li&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;npm run&lt;/code&gt; 有自动向上级目录查找的特性，跟 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;require&lt;/code&gt; 函数一样&lt;/li&gt;
  &lt;li&gt;对于陌生的项目，我们可以通过查看 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;scripts&lt;/code&gt; 属性来参考项目的一些操作&lt;/li&gt;
&lt;/ul&gt;

&lt;h2 id=&quot;cnpm&quot;&gt;cnpm&lt;/h2&gt;

&lt;h3 id=&quot;介绍&quot;&gt;介绍&lt;/h3&gt;
cnpm 是淘宝构建的 &lt;a href=&quot;https://www.npmjs.com/&quot;&gt;npmjs.com&lt;/a&gt; 的完整镜像，也称为淘宝镜像。网址：&lt;a href=&quot;https://npmmirror.com/&quot;&gt;https://npmmirror.com/&lt;/a&gt;

cnpm 服务部署在国内阿里云服务器上，可以提高包的下载速度。官方也提供了一个全新工具包 &lt;strong&gt;cnpm&lt;/strong&gt;，操作命令与 npm 基本相同

&lt;h3 id=&quot;安装&quot;&gt;安装&lt;/h3&gt;
我们可以通过 npm 来安装 cnpm
&lt;div class=&quot;language-shell highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;npm &lt;span class=&quot;nb&quot;&gt;install&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;-g&lt;/span&gt; cnpm &lt;span class=&quot;nt&quot;&gt;--registry&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;https://registry.npmmirror.com
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h3 id=&quot;操作命令&quot;&gt;操作命令&lt;/h3&gt;

&lt;table&gt;
  &lt;thead&gt;
    &lt;tr&gt;
      &lt;th&gt;功能&lt;/th&gt;
      &lt;th&gt;命令&lt;/th&gt;
    &lt;/tr&gt;
  &lt;/thead&gt;
  &lt;tbody&gt;
    &lt;tr&gt;
      &lt;td&gt;初始化&lt;/td&gt;
      &lt;td&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;cnpm init&lt;/code&gt; or &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;cnpm init -y&lt;/code&gt;&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;安装包&lt;/td&gt;
      &lt;td&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;cnpm i nanoid&lt;/code&gt;, &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;cnpm i -S nanoid&lt;/code&gt;, &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;cnpm i -D less&lt;/code&gt;, &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;cnpm i -g nodemon&lt;/code&gt;&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;安装项目依赖&lt;/td&gt;
      &lt;td&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;cnpm i&lt;/code&gt;&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;删除包&lt;/td&gt;
      &lt;td&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;cnpm r nanoid&lt;/code&gt;&lt;/td&gt;
    &lt;/tr&gt;
  &lt;/tbody&gt;
&lt;/table&gt;

&lt;h3 id=&quot;给-npm-配置淘宝镜像&quot;&gt;给 npm 配置淘宝镜像&lt;/h3&gt;
两种配置方式，即直接配置和工具配置

&lt;h4 id=&quot;直接配置&quot;&gt;直接配置&lt;/h4&gt;
执行命令
&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;npm config set registry https://registry.npmmirror.com/
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h4 id=&quot;工具配置&quot;&gt;工具配置&lt;/h4&gt;
使用 &lt;strong&gt;nrm&lt;/strong&gt; (npm registry manager) 配置 npm 的镜地址

&lt;ol&gt;
  &lt;li&gt;安装 nrm
    &lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;npm i -g nrm
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;    &lt;/div&gt;
  &lt;/li&gt;
  &lt;li&gt;修改镜像
    &lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;nrm use taobao
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;    &lt;/div&gt;
    支持的所有镜像列表&lt;br /&gt;
&lt;img src=&quot;/assets/images/2023/09/nrm-ls.png&quot; alt=&quot;nrm-ls&quot; /&gt;
  &lt;/li&gt;
  &lt;li&gt;检查是否配置成功
    &lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;npm config list
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;    &lt;/div&gt;
    &lt;img src=&quot;/assets/images/2023/09/npm-config-list.png&quot; alt=&quot;npm-config-list&quot; /&gt;
  &lt;/li&gt;
&lt;/ol&gt;

补充说明：
&lt;ol&gt;
  &lt;li&gt;&lt;strong&gt;建议使用第二种方式&lt;/strong&gt;，因为后续修改起来会比较方便&lt;/li&gt;
  &lt;li&gt;虽然 cnpm 可以提高速度，但是 npm 也可以通过淘宝镜像进行加速，所以 npm 的使用率还是高于 cnpm&lt;/li&gt;
&lt;/ol&gt;

&lt;h2 id=&quot;yarn&quot;&gt;yarn&lt;/h2&gt;

&lt;h3 id=&quot;介绍-1&quot;&gt;介绍&lt;/h3&gt;
yarn 是由 Facebook 在2016 年推出的新的 Javascript 包管理工具。网址：&lt;a href=&quot;https://yarnpkg.com/&quot;&gt;https://yarnpkg.com&lt;/a&gt;

&lt;h3 id=&quot;特点&quot;&gt;特点&lt;/h3&gt;
yarn 官方宣称的一些特点：
&lt;ul&gt;
  &lt;li&gt;速度超快。yarn 缓存了每个下载过的包，所以再次使用时，无需重复下载。同时利用并行下载以最大化资源利用率，因此安装速度更快&lt;/li&gt;
  &lt;li&gt;超级安全。在执行代码之前，yarn 会通过算法校验每个安装包的完整性&lt;/li&gt;
  &lt;li&gt;超级可靠。使用详细、简洁的锁文件格式和明确的安装算法，yarn 能保证在不同系统上无差异的工作&lt;/li&gt;
&lt;/ul&gt;

&lt;h3 id=&quot;安装-1&quot;&gt;安装&lt;/h3&gt;
可以使用 npm 安装 yarn
&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;npm i -g yarn
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h3 id=&quot;常用命令&quot;&gt;常用命令&lt;/h3&gt;

&lt;table&gt;
  &lt;thead&gt;
    &lt;tr&gt;
      &lt;th&gt;功能&lt;/th&gt;
      &lt;th&gt;命令&lt;/th&gt;
    &lt;/tr&gt;
  &lt;/thead&gt;
  &lt;tbody&gt;
    &lt;tr&gt;
      &lt;td&gt;初始化&lt;/td&gt;
      &lt;td&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;yarn init&lt;/code&gt; or &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;yarn init -y&lt;/code&gt;&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;安装包&lt;/td&gt;
      &lt;td&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;yarn add nanoid&lt;/code&gt; &lt;br /&gt; &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;yarn add less --dev&lt;/code&gt; &lt;br /&gt; &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;yarn global add nodemon&lt;/code&gt;&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;删除包&lt;/td&gt;
      &lt;td&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;yarn remove nanoid&lt;/code&gt; &lt;br /&gt; &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;yarn global remove nodemon&lt;/code&gt;&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;安装项目依赖&lt;/td&gt;
      &lt;td&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;yarn&lt;/code&gt;&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;运行命令和别名&lt;/td&gt;
      &lt;td&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;yarn [alias]&lt;/code&gt; 不需要 run&lt;/td&gt;
    &lt;/tr&gt;
  &lt;/tbody&gt;
&lt;/table&gt;

但是有个小问题，就是 yarn 全局安装的包不可用。那是因为 yarn 全局安装包的目录没有被配置在环境变量中，需要我们手动添加到环境变量中。yarn 全局安装包的位置可以通过 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;yarn global bin&lt;/code&gt; 来查看&lt;br /&gt;
&lt;img src=&quot;/assets/images/2023/09/yarn-global-bin.png&quot; alt=&quot;yarn-global-bin&quot; /&gt;

&lt;h3 id=&quot;配置淘宝镜像&quot;&gt;配置淘宝镜像&lt;/h3&gt;
&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;yarn config set registry https://registry.npmmirror.com/
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
可以通过 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;yarn config list&lt;/code&gt; 查看 yarn 的配置项

&lt;div class=&quot;language-shell highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;bobby@bobby-laptop:~/git_repository/npm_study&lt;span class=&quot;nv&quot;&gt;$ &lt;/span&gt;yarn config list
yarn config v1.22.19
info yarn config
&lt;span class=&quot;o&quot;&gt;{&lt;/span&gt;
  &lt;span class=&quot;s1&quot;&gt;'version-tag-prefix'&lt;/span&gt;: &lt;span class=&quot;s1&quot;&gt;'v'&lt;/span&gt;,
  &lt;span class=&quot;s1&quot;&gt;'version-git-tag'&lt;/span&gt;: &lt;span class=&quot;nb&quot;&gt;true&lt;/span&gt;,
  &lt;span class=&quot;s1&quot;&gt;'version-commit-hooks'&lt;/span&gt;: &lt;span class=&quot;nb&quot;&gt;true&lt;/span&gt;,
  &lt;span class=&quot;s1&quot;&gt;'version-git-sign'&lt;/span&gt;: &lt;span class=&quot;nb&quot;&gt;false&lt;/span&gt;,
  &lt;span class=&quot;s1&quot;&gt;'version-git-message'&lt;/span&gt;: &lt;span class=&quot;s1&quot;&gt;'v%s'&lt;/span&gt;,
  &lt;span class=&quot;s1&quot;&gt;'init-version'&lt;/span&gt;: &lt;span class=&quot;s1&quot;&gt;'1.0.0'&lt;/span&gt;,
  &lt;span class=&quot;s1&quot;&gt;'init-license'&lt;/span&gt;: &lt;span class=&quot;s1&quot;&gt;'MIT'&lt;/span&gt;,
  &lt;span class=&quot;s1&quot;&gt;'save-prefix'&lt;/span&gt;: &lt;span class=&quot;s1&quot;&gt;'^'&lt;/span&gt;,
  &lt;span class=&quot;s1&quot;&gt;'bin-links'&lt;/span&gt;: &lt;span class=&quot;nb&quot;&gt;true&lt;/span&gt;,
  &lt;span class=&quot;s1&quot;&gt;'ignore-scripts'&lt;/span&gt;: &lt;span class=&quot;nb&quot;&gt;false&lt;/span&gt;,
  &lt;span class=&quot;s1&quot;&gt;'ignore-optional'&lt;/span&gt;: &lt;span class=&quot;nb&quot;&gt;false&lt;/span&gt;,
  registry: &lt;span class=&quot;s1&quot;&gt;'https://registry.yarnpkg.com'&lt;/span&gt;,
  &lt;span class=&quot;s1&quot;&gt;'strict-ssl'&lt;/span&gt;: &lt;span class=&quot;nb&quot;&gt;true&lt;/span&gt;,
  &lt;span class=&quot;s1&quot;&gt;'user-agent'&lt;/span&gt;: &lt;span class=&quot;s1&quot;&gt;'yarn/1.22.19 npm/? node/v18.16.0 linux x64'&lt;/span&gt;,
  lastUpdateCheck: 1694343292988
&lt;span class=&quot;o&quot;&gt;}&lt;/span&gt;
info npm config
&lt;span class=&quot;o&quot;&gt;{&lt;/span&gt;
  registry: &lt;span class=&quot;s1&quot;&gt;'https://registry.npmmirror.com/'&lt;/span&gt;,
  home: &lt;span class=&quot;s1&quot;&gt;'https://npm.taobao.org'&lt;/span&gt;
&lt;span class=&quot;o&quot;&gt;}&lt;/span&gt;
Done &lt;span class=&quot;k&quot;&gt;in &lt;/span&gt;0.12s.
bobby@bobby-laptop:~/git_repository/npm_study&lt;span class=&quot;nv&quot;&gt;$ &lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h3 id=&quot;npm-和-yarn-的选择&quot;&gt;npm 和 yarn 的选择&lt;/h3&gt;

&lt;ol&gt;
  &lt;li&gt;
    个人项目 &lt;br /&gt;
  如果是个人项目，哪个工具都可以，根据个人喜好选择
  &lt;/li&gt;
  &lt;li&gt;
    公司（团队）项目 &lt;br /&gt;
  按照项目要求选择。可以通过锁文件判断，npm 锁文件是 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;package-lock.json&lt;/code&gt;, npm 锁文件是 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;yarn.lock&lt;/code&gt;
  &lt;/li&gt;
&lt;/ol&gt;

&lt;strong&gt;包管理工具千万不要混着用，切记，切记，切记&lt;/strong&gt;。

&lt;h2 id=&quot;管理发布包&quot;&gt;管理发布包&lt;/h2&gt;

&lt;h3 id=&quot;创建与发布&quot;&gt;创建与发布&lt;/h3&gt;

我们可以将自己开发的工具包发布到 npm 服务上，方便自己和其他开发者使用。操作步骤如下：
&lt;ol&gt;
  &lt;li&gt;创建文件夹，并创建文件 index.js，在文件中声明函数，使用 module.exports 暴露&lt;/li&gt;
  &lt;li&gt;npm 初始化工具包，package.json 填写包的信息（包的名字是唯一的）&lt;/li&gt;
  &lt;li&gt;注册账号，https://www.npmjs.com/signup&lt;/li&gt;
  &lt;li&gt;激活账号（一定要激活账号）&lt;/li&gt;
  &lt;li&gt;修改为官方镜像 （&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;nrm use npm&lt;/code&gt;）&lt;/li&gt;
  &lt;li&gt;命令行下 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;npm login&lt;/code&gt;，填写相关用户信息&lt;/li&gt;
  &lt;li&gt;命令行下 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;npm publish&lt;/code&gt;，提交包&lt;/li&gt;
&lt;/ol&gt;

&lt;h3 id=&quot;更新包&quot;&gt;更新包&lt;/h3&gt;

后续还可以对自己发布的包进行更新。操作步骤如下：
&lt;ol&gt;
  &lt;li&gt;更新包中代码&lt;/li&gt;
  &lt;li&gt;测试代码是否可用&lt;/li&gt;
  &lt;li&gt;修改 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;package.json&lt;/code&gt; 中的版本号&lt;/li&gt;
  &lt;li&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;npm publish&lt;/code&gt;, 发布更新&lt;/li&gt;
&lt;/ol&gt;

&lt;h3 id=&quot;删除包&quot;&gt;删除包&lt;/h3&gt;

执行如下命令：
&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;npm unpublish
npm unpublish &amp;lt;package_name&amp;gt;@&amp;lt;version&amp;gt;
npm unpublish &amp;lt;package_name&amp;gt; --force
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
删除包要满足一定的条件，具体可参考官方文档: &lt;a href=&quot;https://docs.npmjs.com/policies/unpublish/&quot;&gt;npm Unpublish Policy&lt;/a&gt;
&lt;ul&gt;
  &lt;li&gt;你是包的作者&lt;/li&gt;
  &lt;li&gt;发布时间小于 24 小时&lt;/li&gt;
  &lt;li&gt;如果发布时间大于 24 小时，没有其他包依赖，并且每周小于 300 的下载量，并且只有一个维护者&lt;/li&gt;
&lt;/ul&gt;

&lt;h2 id=&quot;扩展内容&quot;&gt;扩展内容&lt;/h2&gt;
在许多语言中都有包管理工具，比如

&lt;table&gt;
  &lt;thead&gt;
    &lt;tr&gt;
      &lt;th&gt;语言&lt;/th&gt;
      &lt;th&gt;包管理工具&lt;/th&gt;
    &lt;/tr&gt;
  &lt;/thead&gt;
  &lt;tbody&gt;
    &lt;tr&gt;
      &lt;td&gt;PHP&lt;/td&gt;
      &lt;td&gt;composer&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;Python&lt;/td&gt;
      &lt;td&gt;pip&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;Java&lt;/td&gt;
      &lt;td&gt;maven&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;Go&lt;/td&gt;
      &lt;td&gt;go mod&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;Javascript&lt;/td&gt;
      &lt;td&gt;npm/yarn/cnpm/other&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;Ruby&lt;/td&gt;
      &lt;td&gt;rubyGems&lt;/td&gt;
    &lt;/tr&gt;
  &lt;/tbody&gt;
&lt;/table&gt;

除了编程语言领域外，操作系统层面也存在包（软件包）管理工具

&lt;table&gt;
  &lt;thead&gt;
    &lt;tr&gt;
      &lt;th&gt;操作系统&lt;/th&gt;
      &lt;th&gt;包管理工具&lt;/th&gt;
      &lt;th&gt;网址&lt;/th&gt;
    &lt;/tr&gt;
  &lt;/thead&gt;
  &lt;tbody&gt;
    &lt;tr&gt;
      &lt;td&gt;CentOS&lt;/td&gt;
      &lt;td&gt;yum&lt;/td&gt;
      &lt;td&gt;https://package.debian.org/stable&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;Ubuntu&lt;/td&gt;
      &lt;td&gt;apt&lt;/td&gt;
      &lt;td&gt;&lt;a href=&quot;https://ubuntu.com/server/docs/package-management&quot;&gt;https://ubuntu.com/server/docs/package-management&lt;/a&gt;&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;MacOS&lt;/td&gt;
      &lt;td&gt;homebrew&lt;/td&gt;
      &lt;td&gt;&lt;a href=&quot;https://brew.sh/&quot;&gt;https://brew.sh/&lt;/a&gt;&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;Windows&lt;/td&gt;
      &lt;td&gt;chocolatey&lt;/td&gt;
      &lt;td&gt;&lt;a href=&quot;https://chocolatey.org/&quot;&gt;https://chocolatey.org/&lt;/a&gt;&lt;/td&gt;
    &lt;/tr&gt;
  &lt;/tbody&gt;
&lt;/table&gt;

&lt;h2 id=&quot;nvm&quot;&gt;nvm&lt;/h2&gt;

&lt;h3 id=&quot;介绍-2&quot;&gt;介绍&lt;/h3&gt;
nvm 全称 Node Version Manager, 顾名思义它是用来管理 node 版本的工具，方便切换不同版本的 Node.js

&lt;h3 id=&quot;使用&quot;&gt;使用&lt;/h3&gt;
nvm 的使用非常简单，跟 npm 的使用方法类似

&lt;h4 id=&quot;下载安装&quot;&gt;下载安装&lt;/h4&gt;
下载地址： https://github.com/coreybutter/nvm-windows/release ， 选择 nvm-setup.exe

&lt;h4 id=&quot;常用命令-1&quot;&gt;常用命令&lt;/h4&gt;

&lt;table&gt;
  &lt;thead&gt;
    &lt;tr&gt;
      &lt;th&gt;命令&lt;/th&gt;
      &lt;th&gt;说明&lt;/th&gt;
    &lt;/tr&gt;
  &lt;/thead&gt;
  &lt;tbody&gt;
    &lt;tr&gt;
      &lt;td&gt;nvm list available&lt;/td&gt;
      &lt;td&gt;显示所有可以下载的 Node.js 版本&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;nvm list&lt;/td&gt;
      &lt;td&gt;显示已安装的版本&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;nvm install 18.12.1&lt;/td&gt;
      &lt;td&gt;安装 18.12.1 版本的 Node.js&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;nvm install latest&lt;/td&gt;
      &lt;td&gt;安装最新版的 Node.js&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;nvm uninstall 18.12.1&lt;/td&gt;
      &lt;td&gt;删除 18.12.1 版本的 Node.js&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;nvm use 18.12.1&lt;/td&gt;
      &lt;td&gt;切换到 18.12.1 版本的 Node.js&lt;/td&gt;
    &lt;/tr&gt;
  &lt;/tbody&gt;
&lt;/table&gt;
</description>
        <pubDate>Wed, 06 Sep 2023 14:00:00 +0000</pubDate>
        <link>https://jiaojianbo.github.io/2023/09/06/npm/</link>
        <guid isPermaLink="true">https://jiaojianbo.github.io/2023/09/06/npm/</guid>
        
        <category>nodejs</category>
        
        <category>npm</category>
        
        
        <category>nodejs</category>
        
      </item>
    
      <item>
        <title>Notes</title>
        <description>
主要记录一些常用。

</description>
        <pubDate>Sun, 12 Feb 2023 03:00:00 +0000</pubDate>
        <link>https://jiaojianbo.github.io/2023/02/12/notes/</link>
        <guid isPermaLink="true">https://jiaojianbo.github.io/2023/02/12/notes/</guid>
        
        <category>Other</category>
        
        
        <category>Other</category>
        
      </item>
    
      <item>
        <title>Podman 或 Docker 常用命令</title>
        <description>
主要记录一些常用的 Docker 命令。

</description>
        <pubDate>Sun, 25 Apr 2021 03:00:00 +0000</pubDate>
        <link>https://jiaojianbo.github.io/2021/04/25/docker-command/</link>
        <guid isPermaLink="true">https://jiaojianbo.github.io/2021/04/25/docker-command/</guid>
        
        <category>Docker</category>
        
        
        <category>Docker</category>
        
      </item>
    
      <item>
        <title>Oracle 常用查询</title>
        <description>
主要记录一些工作中偶尔会用到的一些 Oracle 专有的查询和操作。

</description>
        <pubDate>Mon, 05 Apr 2021 03:40:00 +0000</pubDate>
        <link>https://jiaojianbo.github.io/2021/04/05/GeneralOracleSQL/</link>
        <guid isPermaLink="true">https://jiaojianbo.github.io/2021/04/05/GeneralOracleSQL/</guid>
        
        <category>Oracle</category>
        
        
        <category>Oracle</category>
        
      </item>
    
      <item>
        <title>Spring AOP 和 Java 动态代理的对照说明</title>
        <description>
众所周知，Spring AOP 就是基于动态代理实现的。只不过有些情况下使用 JDK 中原生的动态代理，有些使用 Cglib 实现。至于这其中的差异和实现细节这里不做过多的深究，本文仅从宏观的角度对两者的实现代码作一比较，加深对两者之间关系的认识。

</description>
        <pubDate>Wed, 25 Dec 2019 02:30:00 +0000</pubDate>
        <link>https://jiaojianbo.github.io/2019/12/25/dynproxy-aop/</link>
        <guid isPermaLink="true">https://jiaojianbo.github.io/2019/12/25/dynproxy-aop/</guid>
        
        <category>Spring</category>
        
        
        <category>Spring</category>
        
      </item>
    
      <item>
        <title>YAML 文件中配置对象</title>
        <description>
项目开发中一些参数值需要作为配置项，放在 YAML 文件中。对于简单类型以及 String 类型的值，配置在 YAML 中，然后使用 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;@Value&lt;/code&gt;注解绑定即可。但是对于一些复杂对象，或者自定义的对象又该如何配置和绑定呢？

</description>
        <pubDate>Sun, 28 Jul 2019 03:40:00 +0000</pubDate>
        <link>https://jiaojianbo.github.io/2019/07/28/yaml-config-object/</link>
        <guid isPermaLink="true">https://jiaojianbo.github.io/2019/07/28/yaml-config-object/</guid>
        
        <category>Spring-Boot</category>
        
        
        <category>Spring-Boot</category>
        
      </item>
    
      <item>
        <title>Quartz + H2 DB 时 “Couldn't store job: Function EMPTY_BLOB not found” 错误解决办法</title>
        <description>
本来项目中一直使用的是 Oracle 数据库，但是这几日开发环境中 Oracle 资源到期，暂时没有 Oracle 可用。为了正常开发，本地不得不使用 H2 数据库暂时替代一下。好在项目中使用的是 JPA，所以自己写的东西切换到 H2 基本没有什么严重的问题，但是集成的 Quartz 部分功能却遇到了一些异常。

</description>
        <pubDate>Tue, 23 Jul 2019 03:40:00 +0000</pubDate>
        <link>https://jiaojianbo.github.io/2019/07/23/quartz-h2-issues/</link>
        <guid isPermaLink="true">https://jiaojianbo.github.io/2019/07/23/quartz-h2-issues/</guid>
        
        <category>Quartz</category>
        
        <category>H2</category>
        
        
        <category>Quartz</category>
        
      </item>
    
      <item>
        <title>非管理员账号设置 Windows 10 环境变量</title>
        <description>
这里主要说的是&lt;strong&gt;非管理员账号&lt;/strong&gt;，如何设置自己的环境变量。

</description>
        <pubDate>Sat, 13 Jul 2019 03:40:00 +0000</pubDate>
        <link>https://jiaojianbo.github.io/2019/07/13/windows10-env-variables/</link>
        <guid isPermaLink="true">https://jiaojianbo.github.io/2019/07/13/windows10-env-variables/</guid>
        
        <category>Windows</category>
        
        
        <category>Windows</category>
        
      </item>
    
      <item>
        <title>IntelliJ IDEA 常用设置</title>
        <description>
这里的常用设置指的就是 File → Settings (Ctrl + Alt + S) 中的全局设置。

</description>
        <pubDate>Wed, 10 Jul 2019 15:40:00 +0000</pubDate>
        <link>https://jiaojianbo.github.io/2019/07/10/IDEA-common-settings/</link>
        <guid isPermaLink="true">https://jiaojianbo.github.io/2019/07/10/IDEA-common-settings/</guid>
        
        <category>IDE</category>
        
        <category>IDEA</category>
        
        
        <category>IDE</category>
        
      </item>
    
      <item>
        <title>Spring Boot 集成 MyBatis 延迟载失效？</title>
        <description>
今天在一个 Spring Boot 项目里，有个地方用到了延迟加载（也叫“懒加载”）。于是就顺手写了一个 test case，想看看这个延迟加载是不是真的按预想的那样，在需要的时候才去查数据库。

</description>
        <pubDate>Sat, 29 Jun 2019 05:40:00 +0000</pubDate>
        <link>https://jiaojianbo.github.io/2019/06/29/mybatis-lazyloading-query/</link>
        <guid isPermaLink="true">https://jiaojianbo.github.io/2019/06/29/mybatis-lazyloading-query/</guid>
        
        <category>MyBatis</category>
        
        <category>Spring-Boot</category>
        
        
        <category>MyBatis</category>
        
      </item>
    
  </channel>
</rss>
