{"id":448,"date":"2026-01-26T09:15:45","date_gmt":"2026-01-26T09:15:45","guid":{"rendered":"https:\/\/blog.gpst.net.cn:4008\/?p=448"},"modified":"2026-01-28T06:24:13","modified_gmt":"2026-01-28T06:24:13","slug":"yarn%e5%8a%a0%e9%80%9f","status":"publish","type":"post","link":"https:\/\/opshub.com.cn\/?p=448","title":{"rendered":"yarn\u52a0\u901f"},"content":{"rendered":"\n<p>npm install -g yarn<\/p>\n\n\n\n<p>\u4e34\u65f6\u4f7f\u7528\uff1a<\/p>\n\n\n\n<p>yarn &#8211;registry=https:\/\/registry.npmmirror.com<\/p>\n\n\n\n<p>\u5168\u5c40\u8bbe\u7f6e\uff1a<\/p>\n\n\n\n<p>yarn config set registry<a href=\"https:\/\/registry.npmmirror.com\/\">https:\/\/registry.npmmirror.com<\/a><\/p>\n\n\n\n<p>\u6062\u590d\u4e3a\u5b98\u65b9\u6e90\uff1a<\/p>\n\n\n\n<p>yarn config set registry<a href=\"https:\/\/registry.yarnpkg.com\/\">https:\/\/registry.yarnpkg.com<\/a><\/p>\n\n\n\n<p>\u67e5\u770b\u5f53\u524d\u914d\u7f6e\uff1a<\/p>\n\n\n\n<p>yarn config list<\/p>\n\n\n\n<p>\u8bbe\u7f6ehttp\u4ee3\u7406\uff1a<\/p>\n\n\n\n<p>yarn config set proxy<a href=\"http:\/\/127.0.0.1:7890\/\">http:\/\/127.0.0.1:7890<\/a><\/p>\n\n\n\n<p>\u8bbe\u7f6ehttps\u4ee3\u7406\uff1a<\/p>\n\n\n\n<p>yarn config set https-proxy<a href=\"http:\/\/127.0.0.1:7890\/\">http:\/\/127.0.0.1:7890<\/a><\/p>\n\n\n\n<p>\u53d6\u6d88\u4ee3\u7406\u8bbe\u7f6e\u7684\u547d\u4ee4\uff1a<\/p>\n\n\n\n<p>yarn config delete proxy<\/p>\n\n\n\n<p>yarn config delete https-proxy<\/p>\n\n\n\n<figure class=\"wp-block-table\"><table class=\"has-fixed-layout\"><tbody><tr><th>\u547d\u4ee4<\/th><th>\u53d1\u751f\u4e86\u4ec0\u4e48<\/th><th>\u7b49\u4ef7\u547d\u4ee4<\/th><th>\u5e38\u89c1\u7528\u9014<\/th><\/tr><tr><td><code>yarn<\/code>\uff08\u5355\u72ec\u4f7f\u7528\uff09<\/td><td>\u5b89\u88c5\u202f<code>package.json<\/code>\u202f\u91cc\u58f0\u660e\u7684\u6240\u6709\u4f9d\u8d56<\/td><td><code>yarn install<\/code><\/td><td>\u521d\u59cb\u5316 \/ \u66f4\u65b0\u4f9d\u8d56<\/td><\/tr><tr><td><code>yarn run build<\/code><\/td><td>\u5728\u202f<code>package.json<\/code>\u202f\u7684\u202f<code>scripts<\/code>\u202f\u533a\u5757\u91cc\u67e5\u627e\u202f<code>\"build\": \"...\"<\/code>\u202f\u5e76\u6267\u884c\u5bf9\u5e94\u811a\u672c<\/td><td><code>yarn build<\/code>\uff08\u7701\u7565\u202f<code>run<\/code>\uff09<\/td><td>\u6253\u5305\u524d\u7aef\u3001\u7f16\u8bd1 TypeScript\u3001\u6784\u5efa\u53ef\u90e8\u7f72\u4ea7\u7269\u7b49<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<p>yarn &#8211;production&nbsp; &nbsp; &nbsp; &nbsp;&nbsp; # \u53ea\u88c5\u751f\u4ea7\u4f9d\u8d56<\/p>\n\n\n\n<p>yarn &#8211;check-files&nbsp; &nbsp; &nbsp; &nbsp; # \u68c0\u67e5\u5df2\u6709\u6a21\u5757\u5b8c\u6574\u6027<\/p>\n","protected":false},"excerpt":{"rendered":"<p>npm install -g yarn \u4e34\u65f6\u4f7f\u7528\uff1a yarn &#8211;registry=https:\/\/registry.npmmirror.com \u5168\u5c40\u8bbe\u7f6e\uff1a yarn config set registryhttps:\/\/registry.npmmirror.com \u6062\u590d\u4e3a\u5b98\u65b9\u6e90\uff1a yarn config set registryhttps:\/\/registry.yarnpkg.com \u67e5\u770b\u5f53\u524d\u914d\u7f6e\uff1a yarn config list \u8bbe\u7f6ehttp\u4ee3\u7406\uff1a yarn config set proxyhttp:\/\/127.0.0.1:7890 \u8bbe\u7f6ehttps\u4ee3\u7406\uff1a yarn config set https-proxyhttp:\/\/127.0.0.1:7890 \u53d6\u6d88\u4ee3\u7406\u8bbe\u7f6e\u7684\u547d\u4ee4\uff1a yarn config delete proxy yarn config delete https-proxy \u547d\u4ee4 \u53d1\u751f\u4e86\u4ec0\u4e48 \u7b49\u4ef7\u547d\u4ee4 \u5e38\u89c1\u7528\u9014 yarn\uff08\u5355\u72ec\u4f7f\u7528\uff09 \u5b89\u88c5\u202fpackage.json\u202f\u91cc\u58f0\u660e\u7684\u6240\u6709\u4f9d\u8d56 yarn install \u521d\u59cb\u5316 \/ \u66f4\u65b0\u4f9d\u8d56 yarn run build \u5728\u202fpackage.json\u202f\u7684\u202fscripts\u202f\u533a\u5757\u91cc\u67e5\u627e\u202f&#8221;build&#8221;: [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[9],"tags":[],"class_list":["post-448","post","type-post","status-publish","format-standard","hentry","category-9"],"_links":{"self":[{"href":"https:\/\/opshub.com.cn\/index.php?rest_route=\/wp\/v2\/posts\/448","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/opshub.com.cn\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/opshub.com.cn\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/opshub.com.cn\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/opshub.com.cn\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=448"}],"version-history":[{"count":1,"href":"https:\/\/opshub.com.cn\/index.php?rest_route=\/wp\/v2\/posts\/448\/revisions"}],"predecessor-version":[{"id":449,"href":"https:\/\/opshub.com.cn\/index.php?rest_route=\/wp\/v2\/posts\/448\/revisions\/449"}],"wp:attachment":[{"href":"https:\/\/opshub.com.cn\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=448"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/opshub.com.cn\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=448"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/opshub.com.cn\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=448"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}