{"id":1267,"date":"2026-06-26T15:12:04","date_gmt":"2026-06-26T07:12:04","guid":{"rendered":"https:\/\/www.loongdi.net\/blog\/?p=1267"},"modified":"2026-06-26T15:12:04","modified_gmt":"2026-06-26T07:12:04","slug":"node-js%e5%8d%b8%e8%bd%bd%e5%85%a8%e6%94%bb%e7%95%a5","status":"publish","type":"post","link":"https:\/\/www.loongdi.net\/blog\/1267.html","title":{"rendered":"Node.js\u5378\u8f7d\u5168\u653b\u7565"},"content":{"rendered":"<p><h3>Node.js \u5378\u8f7d\u6982\u8ff0<\/h3>\n<\/p>\n<p><p>Node.js \u662f\u4e00\u79cd\u57fa\u4e8e Chrome V8 \u5f15\u64ce\u7684 JavaScript \u8fd0\u884c\u65f6\u73af\u5883\uff0c\u5e7f\u6cdb\u7528\u4e8e\u6784\u5efa\u5404\u79cd\u7f51\u7edc\u5e94\u7528\u3002\u7136\u800c\uff0c\u5f53 Node.js \u4e0d\u518d\u9002\u7528\u4e8e\u4f60\u7684\u9879\u76ee\u6216\u670d\u52a1\u5668\u65f6\uff0c\u5378\u8f7d\u5b83\u6210\u4e3a\u4e00\u4e2a\u5fc5\u8981\u6b65\u9aa4\u3002\u4ee5\u4e0b\u662f\u5173\u4e8e Node.js \u5378\u8f7d\u7684\u8be6\u7ec6\u4fe1\u606f\u3002<\/p>\n<\/p>\n<p><h3>\u5378\u8f7d Node.js \u5305\u542b\u54ea\u4e9b\u5185\u5bb9<\/h3>\n<\/p>\n<p><p>\u5378\u8f7d Node.js \u5305\u542b\u4ee5\u4e0b\u5185\u5bb9\uff1a<\/p>\n<\/p>\n<ul>\n<li>Node.js \u8fd0\u884c\u65f6\u73af\u5883<\/li>\n<li>npm\uff08Node.js \u5305\u7ba1\u7406\u5668\uff09<\/li>\n<li>\u6240\u6709\u5df2\u5b89\u88c5\u7684 Node.js \u5305\u548c\u4f9d\u8d56\u9879<\/li>\n<\/ul>\n<p><h3>\u5728\u54ea\u4e2a\u64cd\u4f5c\u7cfb\u7edf\u4e0a\u5378\u8f7d Node.js<\/h3>\n<\/p>\n<p style=\"text-align:center\"><img decoding=\"async\" src=\"https:\/\/www.loongdi.net\/blog\/wp-content\/uploads\/2026\/03\/3x70dYw.jpg\" alt=\"Node.js\u5378\u8f7d\u5168\u653b\u7565\" title=\"Node.js\u5378\u8f7d\u5168\u653b\u7565\"><\/p>\n<p><p>Node.js \u53ef\u5728\u591a\u79cd\u64cd\u4f5c\u7cfb\u7edf\u4e0a\u5378\u8f7d\uff0c\u5305\u62ec Windows\u3001macOS \u548c Linux\u3002\u4ee5\u4e0b\u5c06\u5206\u522b\u4ecb\u7ecd\u8fd9\u4e9b\u64cd\u4f5c\u7cfb\u7edf\u4e0a\u7684\u5378\u8f7d\u65b9\u6cd5\u3002<\/p>\n<\/p>\n<p><h3>\u5982\u4f55\u5728 Windows \u4e0a\u5378\u8f7d Node.js<\/h3>\n<\/p>\n<p><p>\u5728 Windows \u4e0a\u5378\u8f7d Node.js\uff0c\u4f60\u53ef\u4ee5\u6309\u7167\u4ee5\u4e0b\u6b65\u9aa4\u64cd\u4f5c\uff1a<\/p>\n<\/p>\n<ol>\n<li>\u6253\u5f00\u201c\u63a7\u5236\u9762\u677f\u201d\u3002<\/li>\n<li>\u70b9\u51fb\u201c\u7a0b\u5e8f\u201d\u3002<\/li>\n<li>\u70b9\u51fb\u201c\u7a0b\u5e8f\u548c\u529f\u80fd\u201d\u3002<\/li>\n<li>\u5728\u5217\u8868\u4e2d\u627e\u5230 Node.js\uff0c\u7136\u540e\u70b9\u51fb\u201c\u5378\u8f7d\u201d\u3002<\/li>\n<li>\u6309\u7167\u5378\u8f7d\u5411\u5bfc\u7684\u63d0\u793a\u5b8c\u6210\u64cd\u4f5c\u3002<\/li>\n<\/ol>\n<p><h3>\u5982\u4f55\u5728 macOS \u4e0a\u5378\u8f7d Node.js<\/h3>\n<\/p>\n<p><p>\u5728 macOS \u4e0a\u5378\u8f7d Node.js\uff0c\u4f60\u53ef\u4ee5\u6309\u7167\u4ee5\u4e0b\u6b65\u9aa4\u64cd\u4f5c\uff1a<\/p>\n<\/p>\n<ol>\n<li>\u6253\u5f00\u201c\u5e94\u7528\u7a0b\u5e8f\u201d\u6587\u4ef6\u5939\u3002<\/li>\n<li>\u627e\u5230 Node.js \u5b89\u88c5\u5305\uff08\u901a\u5e38\u662f .pkg \u683c\u5f0f\uff09\u3002<\/li>\n<li>\u53cc\u51fb\u5b89\u88c5\u5305\uff0c\u7136\u540e\u70b9\u51fb\u201c\u7ee7\u7eed\u201d\u3002<\/li>\n<li>\u6309\u7167\u5378\u8f7d\u5411\u5bfc\u7684\u63d0\u793a\u5b8c\u6210\u64cd\u4f5c\u3002<\/li>\n<\/ol>\n<p><h3>\u5982\u4f55\u5728 Linux \u4e0a\u5378\u8f7d Node.js<\/h3>\n<\/p>\n<p><p>\u5728 Linux \u4e0a\u5378\u8f7d Node.js\uff0c\u4f60\u53ef\u4ee5\u4f7f\u7528\u4ee5\u4e0b\u547d\u4ee4\uff1a<\/p>\n<\/p>\n<p><pre><code>sudo apt-get remove nodejs npm<\/p>\r\n<p>sudo apt-get autoremove<\/p>\r\n<p><\/code><\/pre>\n<\/p>\n<p><h3>\u63a8\u8350\u5378\u8f7d Node.js \u7684\u5de5\u5177<\/h3>\n<\/p>\n<p><p>\u63a8\u8350\u4f7f\u7528\u64cd\u4f5c\u7cfb\u7edf\u81ea\u5e26\u7684\u5378\u8f7d\u5de5\u5177\u8fdb\u884c Node.js \u7684\u5378\u8f7d\uff0c\u4f8b\u5982 Windows \u7684\u201c\u63a7\u5236\u9762\u677f\u201d\u548c macOS \u7684\u201c\u5e94\u7528\u7a0b\u5e8f\u201d\u3002\u5bf9\u4e8e Linux \u7528\u6237\uff0c\u4f7f\u7528\u5305\u7ba1\u7406\u5668\u5378\u8f7d\u662f\u4e00\u4e2a\u7b80\u5355\u4e14\u5b89\u5168\u7684\u9009\u62e9\u3002<\/p>\n<\/p>\n<p><h3>\u4e3a\u4ec0\u4e48\u9700\u8981\u5378\u8f7d Node.js<\/h3>\n<\/p>\n<p><p>\u4ee5\u4e0b\u662f\u4e00\u4e9b\u9700\u8981\u5378\u8f7d Node.js \u7684\u539f\u56e0\uff1a<\/p>\n<\/p>\n<ul>\n<li>\u66f4\u6362 Node.js \u7248\u672c<\/li>\n<li>\u8fc1\u79fb\u5230\u5176\u4ed6\u6280\u672f\u6808<\/li>\n<li>\u6e05\u7406\u4e0d\u5fc5\u8981\u7684\u8f6f\u4ef6\u5305<\/li>\n<\/ul>\n<p><h3>\u5e38\u89c1\u95ee\u9898\u89e3\u7b54<\/h3>\n<\/p>\n<p><b>\u5982\u4f55\u786e\u8ba4 Node.js \u5df2\u7ecf\u88ab\u5b8c\u5168\u5378\u8f7d\uff1f<\/b><\/p>\n<p><p>\u5728 Windows \u4e0a\uff0c\u4f60\u53ef\u4ee5\u6253\u5f00\u547d\u4ee4\u63d0\u793a\u7b26\u5e76\u8fd0\u884c `where node` \u548c `where npm` \u547d\u4ee4\uff0c\u5982\u679c\u8fd9\u4e9b\u547d\u4ee4\u6ca1\u6709\u8f93\u51fa\u7ed3\u679c\uff0c\u5219\u8868\u793a Node.js \u548c npm \u5df2\u7ecf\u88ab\u5b8c\u5168\u5378\u8f7d\u3002\u5728 macOS \u548c Linux \u4e0a\uff0c\u4f60\u53ef\u4ee5\u8fd0\u884c `which node` \u548c `which npm` \u547d\u4ee4\uff0c\u5982\u679c\u6ca1\u6709\u8f93\u51fa\u7ed3\u679c\uff0c\u5219\u8868\u793a\u5b83\u4eec\u5df2\u7ecf\u88ab\u5378\u8f7d\u3002<\/p>\n<\/p>\n<p><b>\u5378\u8f7d Node.js \u4f1a\u5f71\u54cd\u5176\u4ed6\u9879\u76ee\u5417\uff1f<\/b><\/p>\n<p><p>\u901a\u5e38\u60c5\u51b5\u4e0b\uff0c\u5378\u8f7d Node.js \u4e0d\u4f1a\u5f71\u54cd\u5176\u4ed6\u9879\u76ee\u3002\u4f46\u662f\uff0c\u5982\u679c\u4f60\u5728\u5378\u8f7d\u8fc7\u7a0b\u4e2d\u5220\u9664\u4e86\u67d0\u4e9b\u7cfb\u7edf\u6587\u4ef6\u6216\u914d\u7f6e\u6587\u4ef6\uff0c\u53ef\u80fd\u4f1a\u5f71\u54cd\u5176\u4ed6\u9879\u76ee\u3002\u56e0\u6b64\uff0c\u8bf7\u786e\u4fdd\u5728\u5378\u8f7d\u8fc7\u7a0b\u4e2d\u8c28\u614e\u64cd\u4f5c\u3002<\/p>\n<\/p>\n<p><b>\u5378\u8f7d Node.js \u540e\uff0c\u5982\u4f55\u91cd\u65b0\u5b89\u88c5\uff1f<\/b><\/p>\n<p><p>\u5378\u8f7d Node.js \u540e\uff0c\u4f60\u53ef\u4ee5\u4ece Node.js \u5b98\u7f51\u4e0b\u8f7d\u6700\u65b0\u7684\u5b89\u88c5\u5305\uff0c\u5e76\u6309\u7167\u76f8\u5e94\u7684\u6b65\u9aa4\u8fdb\u884c\u5b89\u88c5\u3002\u5982\u679c\u4f60\u4f7f\u7528\u7684\u662f\u5305\u7ba1\u7406\u5668\uff0c\u53ef\u4ee5\u4f7f\u7528\u4ee5\u4e0b\u547d\u4ee4\u91cd\u65b0\u5b89\u88c5 Node.js\uff1a<\/p>\n<\/p>\n<p><pre><code>npm install -g n<\/p>\r\n<p>n latest<\/p>\r\n<p><\/code><\/pre><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Node.js \u5378\u8f7d\u6982\u8ff0 Node.js \u662f\u4e00\u79cd\u57fa\u4e8e Chrome V8 \u5f15\u64ce\u7684 JavaScript \u8fd0\u884c\u65f6\u73af\u5883\uff0c\u5e7f\u6cdb\u7528\u4e8e\u6784\u5efa\u5404\u79cd\u7f51\u7edc\u5e94\u7528\u3002\u7136\u800c\uff0c\u5f53 Node.js \u4e0d\u518d\u9002\u7528\u4e8e\u4f60\u7684\u9879\u76ee\u6216\u670d\u52a1\u5668\u65f6\uff0c\u5378\u8f7d\u5b83\u6210\u4e3a\u4e00\u4e2a\u5fc5\u8981\u6b65\u9aa4\u3002\u4ee5\u4e0b\u662f\u5173\u4e8e Nod&#8230;<\/p>\n","protected":false},"author":1,"featured_media":63,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"topic":[],"class_list":["post-1267","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-yun"],"_links":{"self":[{"href":"https:\/\/www.loongdi.net\/blog\/wp-json\/wp\/v2\/posts\/1267","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.loongdi.net\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.loongdi.net\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.loongdi.net\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.loongdi.net\/blog\/wp-json\/wp\/v2\/comments?post=1267"}],"version-history":[{"count":1,"href":"https:\/\/www.loongdi.net\/blog\/wp-json\/wp\/v2\/posts\/1267\/revisions"}],"predecessor-version":[{"id":1268,"href":"https:\/\/www.loongdi.net\/blog\/wp-json\/wp\/v2\/posts\/1267\/revisions\/1268"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.loongdi.net\/blog\/wp-json\/wp\/v2\/media\/63"}],"wp:attachment":[{"href":"https:\/\/www.loongdi.net\/blog\/wp-json\/wp\/v2\/media?parent=1267"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.loongdi.net\/blog\/wp-json\/wp\/v2\/categories?post=1267"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.loongdi.net\/blog\/wp-json\/wp\/v2\/tags?post=1267"},{"taxonomy":"topic","embeddable":true,"href":"https:\/\/www.loongdi.net\/blog\/wp-json\/wp\/v2\/topic?post=1267"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}