{"id":52290,"date":"2024-12-03T17:59:22","date_gmt":"2024-12-03T09:59:22","guid":{"rendered":"https:\/\/fwq.ai\/blog\/52290\/"},"modified":"2024-12-03T17:59:22","modified_gmt":"2024-12-03T09:59:22","slug":"%e6%b2%a1%e6%9c%89%e6%96%87%e6%a1%a3%e7%9a%84-npm-%e5%8c%85%ef%bc%8c%e5%a6%82%e4%bd%95%e6%ad%a3%e7%a1%ae%e8%b0%83%e7%94%a8%ef%bc%9f","status":"publish","type":"post","link":"https:\/\/fwq.ai\/blog\/52290\/","title":{"rendered":"\u6ca1\u6709\u6587\u6863\u7684 npm \u5305\uff0c\u5982\u4f55\u6b63\u786e\u8c03\u7528\uff1f"},"content":{"rendered":"<p><b><\/b>     <\/p>\n<h1>\u6ca1\u6709\u6587\u6863\u7684 npm \u5305\uff0c\u5982\u4f55\u6b63\u786e\u8c03\u7528\uff1f<\/h1>\n<p>\u7f16\u7a0b\u5e76\u4e0d\u662f\u4e00\u4e2a\u673a\u68b0\u6027\u7684\u5de5\u4f5c\uff0c\u800c\u662f\u9700\u8981\u6709\u601d\u8003\uff0c\u6709\u521b\u65b0\u7684\u5de5\u4f5c\uff0c\u8bed\u6cd5\u662f\u56fa\u5b9a\u7684\uff0c\u4f46\u89e3\u51b3\u95ee\u9898\u7684\u601d\u8def\u5219\u662f\u4f9d\u9760\u4eba\u7684\u601d\u7ef4\uff0c\u8fd9\u5c31\u9700\u8981\u6211\u4eec\u575a\u6301\u5b66\u4e60\u548c\u66f4\u65b0\u81ea\u5df1\u7684\u77e5\u8bc6\u3002\u4eca\u5929\u7c73\u4e91\u5c31\u6574\u7406\u5206\u4eab\u300a\u6ca1\u6709\u6587\u6863\u7684 npm \u5305\uff0c\u5982\u4f55\u6b63\u786e\u8c03\u7528\uff1f\u300b\uff0c\u6587\u7ae0\u8bb2\u89e3\u7684\u77e5\u8bc6\u70b9\u4e3b\u8981\u5305\u62ec\uff0c\u5982\u679c\u4f60\u5bf9\u6587\u7ae0\u65b9\u9762\u7684\u77e5\u8bc6\u70b9\u611f\u5174\u8da3\uff0c\u5c31\u4e0d\u8981\u9519\u8fc7\u7c73\u4e91\uff0c\u5728\u8fd9\u53ef\u4ee5\u5bf9\u5927\u5bb6\u7684\u77e5\u8bc6\u79ef\u7d2f\u6709\u6240\u5e2e\u52a9\uff0c\u52a9\u529b\u5f00\u53d1\u80fd\u529b\u7684\u63d0\u5347\u3002<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/www.17golang.com\/uploads\/20241119\/1732023767673c95d770a33.jpg\" class=\"aligncenter\" title=\"\u6ca1\u6709\u6587\u6863\u7684 npm \u5305\uff0c\u5982\u4f55\u6b63\u786e\u8c03\u7528\uff1f\u63d2\u56fe\" alt=\"\u6ca1\u6709\u6587\u6863\u7684 npm \u5305\uff0c\u5982\u4f55\u6b63\u786e\u8c03\u7528\uff1f\u63d2\u56fe\" \/><\/p>\n<p><strong>\u9762\u5bf9\u65e0\u8c03\u7528\u6587\u6863\uff0c\u5982\u4f55\u89e3\u51b3 npm \u5305\u8c03\u7528\u96be\u9898\uff1f<\/strong><\/p>\n<p>\u5728\u4f7f\u7528 npm \u5305\u65f6\uff0c\u6709\u65f6\u53ef\u80fd\u4f1a\u9047\u5230\u5b98\u7f51\u548c\u7f51\u7edc\u4e0a\u90fd\u6ca1\u6709\u63d0\u4f9b\u8c03\u7528\u65b9\u5f0f\u7684\u60c5\u51b5\uff0c\u5c1d\u8bd5\u8c03\u7528\u53c8\u62a5\u9519\uff0c\u4ee4\u4eba\u675f\u624b\u65e0\u7b56\u3002\u9488\u5bf9\u6b64\u95ee\u9898\uff0c\u8fd9\u91cc\u63d0\u4f9b\u4e00\u79cd\u89e3\u51b3\u601d\u8def\uff1a<\/p>\n<p>\u9996\u5148\uff0c\u786e\u8ba4\u662f\u5426\u5df2\u6b63\u786e\u5b89\u88c5\u4e86\u8be5\u5305\uff0c\u5982\u679c\u5df2\u5b89\u88c5\uff0c\u53ef\u4ee5\u68c0\u67e5\u5305\u7684\u5165\u53e3\u914d\u7f6e\u662f\u5426\u6b63\u786e\u3002\u524d\u5f80 node_modules \u76ee\u5f55\uff0c\u627e\u5230\u8be5\u5305\u7684 package.json \u6587\u4ef6\uff0c\u68c0\u67e5 &#8220;main&#8221; \u5b57\u6bb5\u662f\u5426\u6307\u5411\u6b63\u786e\u7684\u5165\u53e3\u6587\u4ef6\u3002<\/p>\n<p>\u5176\u6b21\uff0c\u5982\u679c\u786e\u4fe1\u5df2\u5b89\u88c5\u4e86\u5305\uff0c\u4f46\u4ecd\u7136\u62a5\u9519\uff0c\u5f88\u53ef\u80fd\u662f\u5305\u6253\u5305\u65f6\u51fa\u73b0\u9519\u8bef\u3002\u68c0\u67e5\u5305\u7684 dist \u76ee\u5f55\uff0c\u67e5\u770b\u662f\u5426\u5305\u542b\u9884\u671f\u5165\u53e3\u6587\u4ef6\u3002\u5982\u679c\u7f3a\u5c11\u76f8\u5e94\u6587\u4ef6\uff0c\u5219\u53ef\u80fd\u662f\u4f5c\u8005\u5728\u6253\u5305\u65f6\u51fa\u9519\u3002<\/p>\n<p>\u8fd9\u79cd\u60c5\u51b5\u4e0b\u7684\u89e3\u51b3\u65b9\u6848\u662f\u67e5\u770b\u5305\u7684\u6e90\u7801\uff0c\u901a\u5e38\u5728 GitHub \u4e0a\u53ef\u4ee5\u627e\u5230\u3002\u901a\u8fc7\u68c0\u67e5\u6e90\u7801\uff0c\u53ef\u4ee5\u627e\u5230\u6b63\u786e\u7684\u5165\u53e3\u6587\u4ef6\uff0c\u5e76\u624b\u52a8\u5f15\u5165\u5230\u81ea\u5df1\u7684\u9879\u76ee\u4e2d\uff0c\u4ece\u800c\u89e3\u51b3\u8c03\u7528\u96be\u9898\u3002<\/p>\n<p>\u7406\u8bba\u8981\u638c\u63e1\uff0c\u5b9e\u64cd\u4e0d\u80fd\u843d\uff01\u4ee5\u4e0a\u5173\u4e8e\u300a\u6ca1\u6709\u6587\u6863\u7684 npm \u5305\uff0c\u5982\u4f55\u6b63\u786e\u8c03\u7528\uff1f\u300b\u7684\u8be6\u7ec6\u4ecb\u7ecd\uff0c\u5927\u5bb6\u90fd\u638c\u63e1\u4e86\u5427\uff01\u5982\u679c\u60f3\u8981\u7ee7\u7eed\u63d0\u5347\u81ea\u5df1\u7684\u80fd\u529b\uff0c\u90a3\u4e48\u5c31\u6765\u5173\u6ce8\u7c73\u4e91\u516c\u4f17\u53f7\u5427\uff01<\/p>\n<dl>\n<dt><\/dt>\n<dd>\n   \u706b\u5f71\u5fcd\u8005\u624b\u6e38\u600e\u4e48\u5728\u7535\u8111\u73a9\uff1f\n <\/dd>\n<\/dl>\n","protected":false},"excerpt":{"rendered":"<p>\u6ca1\u6709\u6587\u6863\u7684 npm \u5305\uff0c\u5982\u4f55\u6b63\u786e\u8c03\u7528\uff1f \u7f16\u7a0b\u5e76\u4e0d\u662f\u4e00\u4e2a\u673a\u68b0\u6027\u7684\u5de5\u4f5c\uff0c\u800c\u662f\u9700\u8981\u6709\u601d\u8003\uff0c\u6709\u521b\u65b0\u7684\u5de5\u4f5c\uff0c\u8bed\u6cd5\u662f\u56fa\u5b9a\u7684\uff0c\u4f46\u89e3\u51b3\u95ee\u9898\u7684\u601d\u8def\u5219\u662f\u4f9d\u9760\u4eba\u7684\u601d\u7ef4\uff0c\u8fd9\u5c31\u9700\u8981\u6211\u4eec\u575a\u6301\u5b66\u4e60\u548c\u66f4\u65b0\u81ea\u5df1\u7684\u77e5\u8bc6\u3002\u4eca\u5929\u7c73\u4e91\u5c31\u6574\u7406\u5206\u4eab\u300a\u6ca1\u6709\u6587\u6863\u7684 npm \u5305\uff0c\u5982\u4f55\u6b63\u786e\u8c03\u7528\uff1f\u300b\uff0c\u6587\u7ae0\u8bb2\u89e3\u7684\u77e5\u8bc6\u70b9\u4e3b\u8981\u5305\u62ec\uff0c\u5982\u679c\u4f60\u5bf9\u6587\u7ae0\u65b9\u9762\u7684\u77e5\u8bc6\u70b9\u611f\u5174\u8da3\uff0c\u5c31\u4e0d\u8981\u9519\u8fc7\u7c73\u4e91\uff0c\u5728\u8fd9\u53ef\u4ee5\u5bf9\u5927\u5bb6\u7684\u77e5\u8bc6\u79ef\u7d2f\u6709\u6240\u5e2e\u52a9\uff0c\u52a9\u529b\u5f00\u53d1\u80fd\u529b\u7684\u63d0\u5347\u3002 \u9762\u5bf9\u65e0\u8c03\u7528\u6587\u6863\uff0c\u5982\u4f55\u89e3\u51b3 npm \u5305\u8c03\u7528\u96be\u9898\uff1f \u5728\u4f7f\u7528 npm \u5305\u65f6\uff0c\u6709\u65f6\u53ef\u80fd\u4f1a\u9047\u5230\u5b98\u7f51\u548c\u7f51\u7edc\u4e0a\u90fd\u6ca1\u6709\u63d0\u4f9b\u8c03\u7528\u65b9\u5f0f\u7684\u60c5\u51b5\uff0c\u5c1d\u8bd5\u8c03\u7528\u53c8\u62a5\u9519\uff0c\u4ee4\u4eba\u675f\u624b\u65e0\u7b56\u3002\u9488\u5bf9\u6b64\u95ee\u9898\uff0c\u8fd9\u91cc\u63d0\u4f9b\u4e00\u79cd\u89e3\u51b3\u601d\u8def\uff1a \u9996\u5148\uff0c\u786e\u8ba4\u662f\u5426\u5df2\u6b63\u786e\u5b89\u88c5\u4e86\u8be5\u5305\uff0c\u5982\u679c\u5df2\u5b89\u88c5\uff0c\u53ef\u4ee5\u68c0\u67e5\u5305\u7684\u5165\u53e3\u914d\u7f6e\u662f\u5426\u6b63\u786e\u3002\u524d\u5f80 node_modules \u76ee\u5f55\uff0c\u627e\u5230\u8be5\u5305\u7684 package.json \u6587\u4ef6\uff0c\u68c0\u67e5 &#8220;main&#8221; \u5b57\u6bb5\u662f\u5426\u6307\u5411\u6b63\u786e\u7684\u5165\u53e3\u6587\u4ef6\u3002 \u5176\u6b21\uff0c\u5982\u679c\u786e\u4fe1\u5df2\u5b89\u88c5\u4e86\u5305\uff0c\u4f46\u4ecd\u7136\u62a5\u9519\uff0c\u5f88\u53ef\u80fd\u662f\u5305\u6253\u5305\u65f6\u51fa\u73b0\u9519\u8bef\u3002\u68c0\u67e5\u5305\u7684 dist \u76ee\u5f55\uff0c\u67e5\u770b\u662f\u5426\u5305\u542b\u9884\u671f\u5165\u53e3\u6587\u4ef6\u3002\u5982\u679c\u7f3a\u5c11\u76f8\u5e94\u6587\u4ef6\uff0c\u5219\u53ef\u80fd\u662f\u4f5c\u8005\u5728\u6253\u5305\u65f6\u51fa\u9519\u3002 \u8fd9\u79cd\u60c5\u51b5\u4e0b\u7684\u89e3\u51b3\u65b9\u6848\u662f\u67e5\u770b\u5305\u7684\u6e90\u7801\uff0c\u901a\u5e38\u5728 GitHub \u4e0a\u53ef\u4ee5\u627e\u5230\u3002\u901a\u8fc7\u68c0\u67e5\u6e90\u7801\uff0c\u53ef\u4ee5\u627e\u5230\u6b63\u786e\u7684\u5165\u53e3\u6587\u4ef6\uff0c\u5e76\u624b\u52a8\u5f15\u5165\u5230\u81ea\u5df1\u7684\u9879\u76ee\u4e2d\uff0c\u4ece\u800c\u89e3\u51b3\u8c03\u7528\u96be\u9898\u3002 \u7406\u8bba\u8981\u638c\u63e1\uff0c\u5b9e\u64cd\u4e0d\u80fd\u843d\uff01\u4ee5\u4e0a\u5173\u4e8e\u300a\u6ca1\u6709\u6587\u6863\u7684 npm \u5305\uff0c\u5982\u4f55\u6b63\u786e\u8c03\u7528\uff1f\u300b\u7684\u8be6\u7ec6\u4ecb\u7ecd\uff0c\u5927\u5bb6\u90fd\u638c\u63e1\u4e86\u5427\uff01\u5982\u679c\u60f3\u8981\u7ee7\u7eed\u63d0\u5347\u81ea\u5df1\u7684\u80fd\u529b\uff0c\u90a3\u4e48\u5c31\u6765\u5173\u6ce8\u7c73\u4e91\u516c\u4f17\u53f7\u5427\uff01 \u706b\u5f71\u5fcd\u8005\u624b\u6e38\u600e\u4e48\u5728\u7535\u8111\u73a9\uff1f<\/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-52290","post","type-post","status-publish","format-standard","hentry","category-16"],"_links":{"self":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/52290","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=52290"}],"version-history":[{"count":0,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/52290\/revisions"}],"wp:attachment":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/media?parent=52290"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/categories?post=52290"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/tags?post=52290"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}