{"id":53499,"date":"2024-12-03T16:09:25","date_gmt":"2024-12-03T08:09:25","guid":{"rendered":"https:\/\/fwq.ai\/blog\/53499\/"},"modified":"2024-12-03T16:09:25","modified_gmt":"2024-12-03T08:09:25","slug":"%e5%9c%a8%e5%a4%9a%e4%b8%aa%e6%b3%a8%e5%86%8c%e8%a1%a8%e4%b9%8b%e9%97%b4%e5%90%8c%e6%ad%a5-npm-%e5%8c%85","status":"publish","type":"post","link":"https:\/\/fwq.ai\/blog\/53499\/","title":{"rendered":"\u5728\u591a\u4e2a\u6ce8\u518c\u8868\u4e4b\u95f4\u540c\u6b65 NPM \u5305"},"content":{"rendered":"<p><b><\/b>     <\/p>\n<h1>\u5728\u591a\u4e2a\u6ce8\u518c\u8868\u4e4b\u95f4\u540c\u6b65 NPM \u5305<\/h1>\n<p><span style=\"cursor: pointer\"><i><\/i>\u6536\u85cf<\/span>    <\/p>\n<p><span style=\"font-size: 15px\">\u5b66\u4e60\u77e5\u8bc6\u8981\u5584\u4e8e\u601d\u8003\uff0c\u601d\u8003\uff0c\u518d\u601d\u8003\uff01\u4eca\u5929\u7c73\u4e91\u5c0f\u7f16\u5c31\u7ed9\u5927\u5bb6\u5e26\u6765<span style=\"color: #FF6600;, Helvetica, Arial, sans-serif;font-size: 14px;background-color: #FFFFFF\">\u300a\u5728\u591a\u4e2a\u6ce8\u518c\u8868\u4e4b\u95f4\u540c\u6b65 NPM \u5305\u300b<\/span>\uff0c\u4ee5\u4e0b\u5185\u5bb9\u4e3b\u8981\u5305\u542b<span style=\"color: #FF6600;, Helvetica, Arial, sans-serif;font-size: 14px;background-color: #FFFFFF\"><\/span>\u7b49\u77e5\u8bc6\u70b9\uff0c\u5982\u679c\u4f60\u6b63\u5728\u5b66\u4e60\u6216\u51c6\u5907\u5b66\u4e60<span style=\"color: #FF6600;, Helvetica, Arial, sans-serif;font-size: 14px;background-color: #FFFFFF\">\u6587\u7ae0<\/span>\uff0c\u5c31\u90fd\u4e0d\u8981\u9519\u8fc7\u672c\u6587\u5566~\u8ba9\u6211\u4eec\u4e00\u8d77\u6765\u770b\u770b\u5427\uff0c\u80fd\u5e2e\u52a9\u5230\u4f60\u5c31\u66f4\u597d\u4e86\uff01<\/span><\/p>\n<p><img decoding=\"async\" src=\"https:\/\/www.17golang.com\/uploads\/20241201\/1733020426674bcb0a4b52f.jpg\" class=\"aligncenter\" title=\"\u5728\u591a\u4e2a\u6ce8\u518c\u8868\u4e4b\u95f4\u540c\u6b65 NPM \u5305\u63d2\u56fe\" alt=\"\u5728\u591a\u4e2a\u6ce8\u518c\u8868\u4e4b\u95f4\u540c\u6b65 NPM \u5305\u63d2\u56fe\" \/><\/p>\n<p>\u7167\u7247\u7531 nicolas radzimski \u5728 unsplash \u4e0a\u62cd\u6444<\/p>\n<h2> \u95ee\u9898 <\/h2>\n<p>\u6211\u4eec\u7684\u56e2\u961f\u4f9d\u9760\u5185\u90e8 gitlab npm \u6ce8\u518c\u8868\u6765\u7ba1\u7406\u5305\u3002\u8fd9\u975e\u5e38\u9002\u5408\u5185\u90e8\u5206\u53d1\uff0c\u4f46\u5728\u67d0\u4e9b\u60c5\u51b5\u4e0b\u9700\u8981\u4e0e\u5916\u90e8\u534f\u4f5c\u8005\u5171\u4eab\u5305\u3002\u5c06\u5305\u4ece\u5185\u90e8\u6ce8\u518c\u8868\u540c\u6b65\u5230\u5916\u90e8\u6ce8\u518c\u8868\u6210\u4e3a\u4e00\u9879\u65b0\u7684\u6311\u6218\u3002<\/p>\n<p>\u6211\u5f00\u59cb\u5bfb\u627e\u89e3\u51b3\u65b9\u6848\uff0c\u4f46\u50cf\u5f80\u5e38\u4e00\u6837\uff0c\u9047\u5230\u4e86\u4e00\u7cfb\u5217\u969c\u788d\uff0c\u8fd9\u8ba9\u6211\u7684\u5f00\u53d1\u8005\u6597\u4e89\u53c8\u6380\u5f00\u4e86\u65b0\u7684\u7bc7\u7ae0\u3002<\/p>\n<h2> \u5c1d\u8bd5 1\uff1a\u4f7f\u7528 http \u8bf7\u6c42\u6a21\u4eff npm cli <\/h2>\n<p>\u6700\u521d\uff0c\u6211\u8ba4\u4e3a\u6211\u53ef\u4ee5\u4f7f\u7528\u539f\u59cb http \u8bf7\u6c42\u6765\u5904\u7406\u8fd9\u4e2a\u95ee\u9898\uff0c\u672c\u8d28\u4e0a\u662f\u6a21\u4eff npm cli \u5728\u5e55\u540e\u6240\u505a\u7684\u4e8b\u60c5\u3002\u8fd9\u4e2a\u60f3\u6cd5\u5f88\u7b80\u5355\uff1a\u67e5\u8be2\u6e90\u6ce8\u518c\u8868\u4e2d\u7684\u5305\u5143\u6570\u636e\uff0c\u83b7\u53d6 tarball\uff0c\u5e76\u5c06\u5176\u4e0a\u4f20\u5230\u76ee\u6807\u6ce8\u518c\u8868\u3002<\/p>\n<h3> \u4e3a\u4ec0\u4e48\u5931\u8d25\uff1a <\/h3>\n<p>\u2022 \u8fc7\u7a0b\u8fc7\u4e8e\u590d\u6742\u4e14\u8106\u5f31\u3002<br \/> \u2022 \u5b83\u9700\u8981\u4e3a\u6bcf\u4e2a\u7248\u672c\u624b\u52a8\u6784\u5efa\u6574\u4e2apackage.json \u6e05\u5355\u3002<br \/> \u2022 \u6bcf\u4e00\u4e2a\u5c0f\u5931\u8bef\u90fd\u4f1a\u5bfc\u81f4\u5305\u88f9\u7834\u635f\u3002<\/p>\n<h2> \u5c1d\u8bd5 2\uff1a\u5229\u7528 npm-registry-sync <\/h2>\n<p>\u63a5\u4e0b\u6765\uff0c\u6211\u53d1\u73b0\u4e86 npm-registry-sync\uff0c\u4e00\u4e2a\u4e13\u4e3a\u540c\u6b65 npm \u6ce8\u518c\u8868\u800c\u8bbe\u8ba1\u7684\u5e93\u3002\u8fd9\u4e2a\u5de5\u5177\u51e0\u4e4e\u89e3\u51b3\u4e86\u8fd9\u4e2a\u95ee\u9898\uff1b\u5b83\u53ef\u4ee5\u76d1\u63a7\u66f4\u6539\u5e76\u8de8\u6ce8\u518c\u8868\u590d\u5236\u5b83\u4eec\u3002<\/p>\n<h3> \u4e3a\u4ec0\u4e48\u5b83\u5bf9\u6211\u4e0d\u8d77\u4f5c\u7528\uff1a <\/h3>\n<p>\u2022 \u5b83\u4ee5\u201c\u5b88\u62a4\u7a0b\u5e8f\u6a21\u5f0f\u201d\u8fd0\u884c\uff0c\u4e0d\u65ad\u8f6e\u8be2\u66f4\u65b0\u3002<br \/> \u2022 \u5728 gitlab ci \u7ba1\u9053\u4e2d\uff0c\u6211\u9700\u8981\u4e00\u6b21\u6027\u6267\u884c\uff0c\u5b8c\u5168\u7531\u7ba1\u9053\u63a7\u5236 \u2014 \u4e0d\u5141\u8bb8\u540e\u53f0\u8fdb\u7a0b\u3002<\/p>\n<h2> \u83b7\u80dc\u89e3\u51b3\u65b9\u6848\uff1anpm cli <\/h2>\n<p>\u6700\u7ec8\uff0c\u6211\u610f\u8bc6\u5230\u6211\u53ef\u4ee5\u575a\u6301\u4f7f\u7528\u4e45\u7ecf\u8003\u9a8c\u7684 npm cli\u3002\u6b65\u9aa4\u5f88\u7b80\u5355\uff1a<\/p>\n<ol>\n<li>\u4ece\u6ce8\u518c\u8868 a \u672c\u5730\u5b89\u88c5\u8f6f\u4ef6\u5305\u3002\n<ol>\n<li>\u91cd\u65b0\u914d\u7f6e npm \u4ee5\u6307\u5411\u6ce8\u518c\u8868 b\u3002<\/li>\n<li>\u5c06\u5305\u53d1\u5e03\u5230registry b\u3002<\/li>\n<\/ol>\n<\/li>\n<\/ol>\n<p>\u867d\u7136\u8fd9\u5f88\u795e\u5947\uff0c\u4f46\u9700\u8981\u4e00\u4e9b\u989d\u5916\u7684\u6b65\u9aa4\u624d\u80fd\u4f7f\u5176\u5bf9 ci \u53cb\u597d\u3002<\/p>\n<hr>\n<h2> \u4e3a\u591a\u4e2a\u6ce8\u518c\u8868\u914d\u7f6e npm <\/h2>\n<p>\u5728 ci \u7ba1\u9053\u4e2d\u52a8\u6001\u7ba1\u7406\u6ce8\u518c\u8868\u914d\u7f6e\u6709\u70b9\u68d8\u624b\u3002<\/p>\n<p>\u8fd9\u662f\u6211\u89e3\u51b3\u7684\u65b9\u6cd5\uff1a<\/p>\n<h3> \u603b\u4f53\u914d\u7f6e <\/h3>\n<p>\u4f7f\u7528 npm cli\uff0c\u60a8\u53ef\u4ee5\u4e3a\u6bcf\u4e2a\u6ce8\u518c\u8868\u8bbe\u7f6e\u53c2\u6570\uff1a<\/p>\n<pre>npm config set \"\/\/my.awesome.registry.com:&lt;parameter name&gt;=&lt;parameter value&gt;\"\n<\/pre>\n<p><strong>\u91cd\u8981\u95ee\u9898\uff1a<\/strong><br \/> \u914d\u7f6e\u4e2d\u7684 url \u5fc5\u987b\u6392\u9664\u534f\u8bae (https:)\u3002<\/p>\n<h3> \u5305\u5230\u6ce8\u518c\u8868\u5173\u8054 <\/h3>\n<p>\u5c06\u7279\u5b9a\u547d\u540d\u7a7a\u95f4\u6216\u5305\u4e0e\u6ce8\u518c\u8868\u5173\u8054\uff1a<\/p>\n<pre>npm config set \"&lt;your namespace&gt;:registry\" \"&lt;your registry url with https:&gt;\"\n<\/pre>\n<h2> \u5904\u7406 ci \u7ba1\u9053\u4e2d\u7684\u8eab\u4efd\u9a8c\u8bc1 <\/h2>\n<p>\u4e00\u4e9b\u6ce8\u518c\u8868\u9700\u8981\u7528\u6237\u540d\/\u5bc6\u7801\u7ec4\u5408\uff0c\u800c\u5176\u4ed6\u6ce8\u518c\u8868\u5219\u4f7f\u7528\u4ee4\u724c\u3002\u8fd9\u662f\u6211\u5b66\u5230\u7684\uff1a<\/p>\n<h3> <strong>\u4ee3\u5e01<\/strong> <\/h3>\n<p>\u4ee4\u724c\u5f88\u7b80\u5355\uff0c\u4f46\u8bf7\u786e\u4fdd\u5728\u914d\u7f6e\u8eab\u4efd\u9a8c\u8bc1 url \u65f6\u5265\u79bb\u534f\u8bae\uff1a<\/p>\n<pre>npm config set \"\/\/my.registry.com:_authtoken=&lt;token&gt;\"\n<\/pre>\n<h3> \u57fa\u672c\u8ba4\u8bc1 <\/h3>\n<p>\u751f\u6210\u57fa\u672c\u7684\u8eab\u4efd\u9a8c\u8bc1\u54c8\u5e0c\uff08\u7528\u6237\u540d\uff1a\u5bc6\u7801\uff09\u9700\u8981\u6ce8\u610f\u7ec6\u8282\u3002\u5728\u67d0\u4e9b\u53d1\u884c\u7248\u4e2d\uff0cbase64 \u547d\u4ee4\u5177\u6709\u4e0e\u5176\u4ed6\u53d1\u884c\u7248\u4e0d\u540c\u7684\u602a\u7656\u3002<\/p>\n<p><strong>\u5728 macos \u4e0a\uff1a<\/strong><\/p>\n<pre>echo -n \"&lt;my username &amp; password hash&gt;\" | base64\n<\/pre>\n<p>\u4f1a\u7ed9\u4f60\uff08\u5982\u9884\u671f\uff09\uff1a<\/p>\n<pre>d2hhdcbhcmugew91igrvaw5nighlcmu\/igdvdcb5ysegc29tzsbtb3jlihrlehqgdg8gbwfrzsb0aglzihjlywxsesbyzwfsbhkgbg9uzw==\n<\/pre>\n<p><strong>\u4f7f\u7528 docker linuxkit:<\/strong><\/p>\n<pre>d2hhdcbhcmugew91igrvaw5nighlcmu\/igdvdcb5ysegc29tzsbtb3jlihrlehqgdg8gbwfrzsb0\naglzihjlywxsesbyzwfsbhkgbg9uzw==\n<\/pre>\n<p>\u8fd9\u662f\u600e\u4e48\u56de\u4e8b\uff1f\u6362\u884c\u4e86\uff01<\/p>\n<p>\u5728\u67d0\u4e9b\u53d1\u884c\u7248\u4e0a\uff0cwrap \u53c2\u6570\u9ed8\u8ba4\u8bbe\u7f6e\u4e3a 76 \u4e2a\u5b57\u7b26\uff0c\u7528\u4e8e\u683c\u5f0f\u5316\u79c1\u94a5\u7b49\u3002<\/p>\n<p>\u5b83\u7684\u5de5\u4f5c\u539f\u7406\u5982\u4e0b\uff1a<\/p>\n<pre>echo -n \"&lt;my username &amp; password hash&gt;\" | base64 --wrap 0\n<\/pre>\n<p>echo -n \u975e\u5e38\u91cd\u8981\u3002\u5982\u679c\u7701\u7565\uff0cecho \u4f1a\u5728\u5b57\u7b26\u4e32\u672b\u5c3e\u6dfb\u52a0\u6362\u884c\u7b26\uff0c\u8fd9\u5c06\u64cd\u7eb5\u60a8\u7684\u54c8\u5e0c\u503c\u3002<\/p>\n<h2> \u5b8c\u6210\u7684\u811a\u672c <\/h2>\n<p>\u5c06\u5b83\u4eec\u653e\u5728\u4e00\u8d77\uff0c\u811a\u672c\u53ef\u80fd\u5982\u4e0b\u6240\u793a\uff1a<\/p>\n<pre>#!\/usr\/bin\/env bash\n\n# input validation\nif [ \"$#\" -ne 5 ]; then\n  echo \"usage: $0 &lt;source-registry&gt; &lt;target-registry&gt; &lt;source-registry-token&gt; &lt;target-registry-username&gt; &lt;target-registry-password&gt;\"\n  exit 1\nfi\n\nsource_registry=$1\ntarget_registry=$2\nsource_registry_token=$3\ntarget_registry_username=$4\ntarget_registry_password=$5\n\necho \"source_registry=$source_registry\"\necho \"target_registry=$target_registry\"\necho \"source_registry_token=${source_registry_token:0:10}\"\necho \"target_registry_username=${target_registry_username}\"\n\necho \"syncing from '$source_registry' to '$target_registry'...\"\n\nremove_protocol() {\n  sed -e 's\/^https?:\/\/g;t' &lt;&lt;&lt; \"$1\"\n}\n\npackages=(\n  \"@my-namespace\/my-package\"\n)\n\n# info: removing the protocol (^https:) from the authtoken config is crucial. will not work without it.\n\n# auth for source registry\nnpm config set \"$(remove_protocol $source_registry):_authtoken=$source_registry_token\"\n\n# --wrap 0 is super important! if omitted, it will cause the base64 to contain a line break after 76 chars!\nbasic_auth=$(echo -n \"$target_registry_username:$target_registry_password\" | base64 --wrap 0)\n\n# auth for target registry\nnpm config set \"$(remove_protocol $target_registry):_auth\" \"$basic_auth\"\nnpm config set \"$(remove_protocol $target_registry):always-auth=true\"\n\n# set to source registry to fetch metadata\nnpm config set \"@my-namespace:registry\" \"$source_registry\"\n\nfor package in \"${packages[@]}\"; do\n  echo \"syncing '$package'...\"\n\n  for version in $(npm view \"$package\" --json | jq -r '.versions[]'); do\n    # install locally\n    npm install \"$package@${version}\" --ignore-scripts\n\n    # switch to target registry\n    npm config set \"@my-namespace:registry\" \"$target_registry\"\n\n    # publish on target\n    npm publish .\/node_modules\/\"$package\"\n\n    # re-set to source registry\n    npm config set \"@my-namespace:registry\" \"$source_registry\"\n  done\ndone\n\necho \"done syncing packages.\"\n<\/pre>\n<p>\u6240\u4ee5\u4f60\u53ef\u4ee5\u50cf\u8fd9\u6837\u4f7f\u7528\u5b83\uff1a<\/p>\n<pre>#!\/usr\/bin\/env bash\n\nSOURCE_REGISTRY=https:\/\/my.source.registry.com\nSOURCE_REGISTRY_TOKEN=abc-xyz-1234568\nTARGET_REGISTRY=https:\/\/my.target.registry.com\nTARGET_REGISTRY_USERNAME=john_doe\nTARGET_REGISTRY_PASSWORD=supersecret123\n\nsync-registries.sh $SOURCE_REGISTRY $TARGET_REGISTRY $SOURCE_REGISTRY_TOKEN $TARGET_REGISTRY_USERNAME $TARGET_REGISTRY_PASSWORD\n<\/pre>\n<hr>\n<h2> \u4e3b\u8981\u7ecf\u9a8c\u6559\u8bad <\/h2>\n<ol>\n<li>\n<p><strong>\u575a\u6301\u4f7f\u7528\u7b80\u5355\u7684\u5de5\u5177\uff1a<\/strong><br \/> npm cli \u53ef\u80fd\u4e0d\u592a\u9002\u5408\u8fd9\u9879\u4efb\u52a1\uff0c\u4f46\u5b83\u5f88\u53ef\u9760\u5e76\u4e14\u53ef\u4ee5\u5b8c\u6210\u5de5\u4f5c\u3002<\/p>\n<\/li>\n<li>\n<p><strong>\u6ce8\u610f\u7ec6\u8282\uff1a<\/strong><br \/> \u914d\u7f6e\u8eab\u4efd\u9a8c\u8bc1\uff0c\u5c24\u5176\u662f\u4f7f\u7528 base64\uff0c\u53ef\u80fd\u4f1a\u51fa\u73b0\u5fae\u5999\u7684\u7279\u5b9a\u4e8e\u5e73\u53f0\u7684\u602a\u7656\u3002<\/p>\n<\/li>\n<li>\n<p><strong>\u4fdd\u6301 ci \u53cb\u597d\uff1a<\/strong><br \/> \u5728 ci\/cd \u7ba1\u9053\u4e2d\u5de5\u4f5c\u65f6\uff0c\u907f\u514d\u4f7f\u7528\u5b88\u62a4\u8fdb\u7a0b\u6216\u540e\u53f0\u4efb\u52a1\u7b49\u89e3\u51b3\u65b9\u6848\u3002\u8ba9\u6d41\u7a0b\u5904\u4e8e\u7ba1\u9053\u63a7\u5236\u4e4b\u4e0b\u3002<\/p>\n<\/li>\n<\/ol>\n<p>\u5728\u6ce8\u518c\u8868\u4e4b\u95f4\u540c\u6b65 npm \u5305\u662f\u4e00\u6b21\u4ee4\u4eba\u6cae\u4e27\u4f46\u6709\u76ca\u7684\u5b66\u4e60\u7ecf\u5386\u3002\u5982\u679c\u60a8\u9762\u4e34\u7c7b\u4f3c\u7684\u6311\u6218\uff0c\u6211\u5e0c\u671b\u8fd9\u4e9b\u8bfe\u7a0b\u53ef\u4ee5\u5e2e\u52a9\u60a8\u66f4\u8f7b\u677e\u5730\u5ea6\u8fc7\u96be\u5173\uff01<\/p>\n<p>\u4eca\u5929\u5e26\u5927\u5bb6\u4e86\u89e3\u4e86\u7684\u76f8\u5173\u77e5\u8bc6\uff0c\u5e0c\u671b\u5bf9\u4f60\u6709\u6240\u5e2e\u52a9\uff1b\u5173\u4e8e\u6587\u7ae0\u7684\u6280\u672f\u77e5\u8bc6\u6211\u4eec\u4f1a\u4e00\u70b9\u70b9\u6df1\u5165\u4ecb\u7ecd\uff0c\u6b22\u8fce\u5927\u5bb6\u5173\u6ce8\u7c73\u4e91\u516c\u4f17\u53f7\uff0c\u4e00\u8d77\u5b66\u4e60\u7f16\u7a0b~<\/p>\n<p>      \u7248\u672c\u58f0\u660e \u672c\u6587\u8f6c\u8f7d\u4e8e\uff1adev.to \u5982\u6709\u4fb5\u72af\uff0c\u8bf7\u8054\u7cfb\u5220\u9664    <\/p>\n<dl>\n<dt><\/dt>\n<dd>\n   win7\u600e\u4e48\u66f4\u6539\u56fe\u6807\u5b57\u4f53\u5927\u5c0f win7\u56fe\u6807\u5b57\u4f53\u5927\u5c0f\u66f4\u6539\u6559\u7a0b\n <\/dd>\n<\/dl>\n","protected":false},"excerpt":{"rendered":"<p>\u5728\u591a\u4e2a\u6ce8\u518c\u8868\u4e4b\u95f4\u540c\u6b65 NPM \u5305 \u6536\u85cf \u5b66\u4e60\u77e5\u8bc6\u8981\u5584\u4e8e\u601d\u8003\uff0c\u601d\u8003\uff0c\u518d\u601d\u8003\uff01\u4eca\u5929\u7c73\u4e91\u5c0f\u7f16\u5c31\u7ed9\u5927\u5bb6\u5e26\u6765\u300a\u5728\u591a\u4e2a\u6ce8\u518c\u8868\u4e4b\u95f4\u540c\u6b65 NPM \u5305\u300b\uff0c\u4ee5\u4e0b\u5185\u5bb9\u4e3b\u8981\u5305\u542b\u7b49\u77e5\u8bc6\u70b9\uff0c\u5982\u679c\u4f60\u6b63\u5728\u5b66\u4e60\u6216\u51c6\u5907\u5b66\u4e60\u6587\u7ae0\uff0c\u5c31\u90fd\u4e0d\u8981\u9519\u8fc7\u672c\u6587\u5566~\u8ba9\u6211\u4eec\u4e00\u8d77\u6765\u770b\u770b\u5427\uff0c\u80fd\u5e2e\u52a9\u5230\u4f60\u5c31\u66f4\u597d\u4e86\uff01 \u7167\u7247\u7531 nicolas radzimski \u5728 unsplash \u4e0a\u62cd\u6444 \u95ee\u9898 \u6211\u4eec\u7684\u56e2\u961f\u4f9d\u9760\u5185\u90e8 gitlab npm \u6ce8\u518c\u8868\u6765\u7ba1\u7406\u5305\u3002\u8fd9\u975e\u5e38\u9002\u5408\u5185\u90e8\u5206\u53d1\uff0c\u4f46\u5728\u67d0\u4e9b\u60c5\u51b5\u4e0b\u9700\u8981\u4e0e\u5916\u90e8\u534f\u4f5c\u8005\u5171\u4eab\u5305\u3002\u5c06\u5305\u4ece\u5185\u90e8\u6ce8\u518c\u8868\u540c\u6b65\u5230\u5916\u90e8\u6ce8\u518c\u8868\u6210\u4e3a\u4e00\u9879\u65b0\u7684\u6311\u6218\u3002 \u6211\u5f00\u59cb\u5bfb\u627e\u89e3\u51b3\u65b9\u6848\uff0c\u4f46\u50cf\u5f80\u5e38\u4e00\u6837\uff0c\u9047\u5230\u4e86\u4e00\u7cfb\u5217\u969c\u788d\uff0c\u8fd9\u8ba9\u6211\u7684\u5f00\u53d1\u8005\u6597\u4e89\u53c8\u6380\u5f00\u4e86\u65b0\u7684\u7bc7\u7ae0\u3002 \u5c1d\u8bd5 1\uff1a\u4f7f\u7528 http \u8bf7\u6c42\u6a21\u4eff npm cli \u6700\u521d\uff0c\u6211\u8ba4\u4e3a\u6211\u53ef\u4ee5\u4f7f\u7528\u539f\u59cb http \u8bf7\u6c42\u6765\u5904\u7406\u8fd9\u4e2a\u95ee\u9898\uff0c\u672c\u8d28\u4e0a\u662f\u6a21\u4eff npm cli \u5728\u5e55\u540e\u6240\u505a\u7684\u4e8b\u60c5\u3002\u8fd9\u4e2a\u60f3\u6cd5\u5f88\u7b80\u5355\uff1a\u67e5\u8be2\u6e90\u6ce8\u518c\u8868\u4e2d\u7684\u5305\u5143\u6570\u636e\uff0c\u83b7\u53d6 tarball\uff0c\u5e76\u5c06\u5176\u4e0a\u4f20\u5230\u76ee\u6807\u6ce8\u518c\u8868\u3002 \u4e3a\u4ec0\u4e48\u5931\u8d25\uff1a \u2022 \u8fc7\u7a0b\u8fc7\u4e8e\u590d\u6742\u4e14\u8106\u5f31\u3002 \u2022 \u5b83\u9700\u8981\u4e3a\u6bcf\u4e2a\u7248\u672c\u624b\u52a8\u6784\u5efa\u6574\u4e2apackage.json \u6e05\u5355\u3002 \u2022 \u6bcf\u4e00\u4e2a\u5c0f\u5931\u8bef\u90fd\u4f1a\u5bfc\u81f4\u5305\u88f9\u7834\u635f\u3002 \u5c1d\u8bd5 2\uff1a\u5229\u7528 npm-registry-sync \u63a5\u4e0b\u6765\uff0c\u6211\u53d1\u73b0\u4e86 npm-registry-sync\uff0c\u4e00\u4e2a\u4e13\u4e3a\u540c\u6b65 npm \u6ce8\u518c\u8868\u800c\u8bbe\u8ba1\u7684\u5e93\u3002\u8fd9\u4e2a\u5de5\u5177\u51e0\u4e4e\u89e3\u51b3\u4e86\u8fd9\u4e2a\u95ee\u9898\uff1b\u5b83\u53ef\u4ee5\u76d1\u63a7\u66f4\u6539\u5e76\u8de8\u6ce8\u518c\u8868\u590d\u5236\u5b83\u4eec\u3002 \u4e3a\u4ec0\u4e48\u5b83\u5bf9\u6211\u4e0d\u8d77\u4f5c\u7528\uff1a \u2022 \u5b83\u4ee5\u201c\u5b88\u62a4\u7a0b\u5e8f\u6a21\u5f0f\u201d\u8fd0\u884c\uff0c\u4e0d\u65ad\u8f6e\u8be2\u66f4\u65b0\u3002 \u2022 \u5728 gitlab ci \u7ba1\u9053\u4e2d\uff0c\u6211\u9700\u8981\u4e00\u6b21\u6027\u6267\u884c\uff0c\u5b8c\u5168\u7531\u7ba1\u9053\u63a7\u5236 [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[16],"tags":[],"class_list":["post-53499","post","type-post","status-publish","format-standard","hentry","category-16"],"_links":{"self":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/53499","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/comments?post=53499"}],"version-history":[{"count":0,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/53499\/revisions"}],"wp:attachment":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/media?parent=53499"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/categories?post=53499"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/tags?post=53499"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}