{"id":56461,"date":"2024-10-10T11:57:14","date_gmt":"2024-10-10T03:57:14","guid":{"rendered":"https:\/\/server.hk\/cnblog\/56461\/"},"modified":"2024-10-10T11:57:14","modified_gmt":"2024-10-10T03:57:14","slug":"wordpress-%e6%95%99%e7%a8%8b%ef%bc%9a%e5%a6%82%e4%bd%95%e5%9c%a8-windows%e3%80%81macos-%e5%92%8c-linux-%e4%b8%8a%e5%ae%89%e8%a3%9d-node-js-%e5%92%8c-npm","status":"publish","type":"post","link":"https:\/\/server.hk\/cnblog\/56461\/","title":{"rendered":"WordPress \u6559\u7a0b\uff1a\u5982\u4f55\u5728 Windows\u3001macOS \u548c Linux \u4e0a\u5b89\u88dd Node.js \u548c npm"},"content":{"rendered":"<h1 id=\"wordpress-%e6%95%99%e7%a8%8b%ef%bc%9a%e5%a6%82%e4%bd%95%e5%9c%a8-windows%e3%80%81macos-%e5%92%8c-linux-%e4%b8%8a%e5%ae%89%e8%a3%9d-node-js-%e5%92%8c-npm-CdlaoDpNyJ\">WordPress \u6559\u7a0b\uff1a\u5982\u4f55\u5728 Windows\u3001macOS \u548c Linux \u4e0a\u5b89\u88dd Node.js \u548c npm<\/h1>\n<p>Node.js \u662f\u4e00\u500b\u958b\u6e90\u7684 JavaScript \u57f7\u884c\u74b0\u5883\uff0c\u80fd\u5920\u8b93\u958b\u767c\u8005\u5728\u4f3a\u670d\u5668\u7aef\u904b\u884c JavaScript\u3002npm\uff08Node Package Manager\uff09\u5247\u662f Node.js \u7684\u5957\u4ef6\u7ba1\u7406\u5de5\u5177\uff0c\u65b9\u4fbf\u7528\u6236\u5b89\u88dd\u548c\u7ba1\u7406 JavaScript \u5957\u4ef6\u3002\u672c\u6587\u5c07\u4ecb\u7d39\u5982\u4f55\u5728 Windows\u3001macOS \u548c Linux \u7cfb\u7d71\u4e0a\u5b89\u88dd Node.js \u548c npm\u3002<\/p>\n<h2 id=\"%e5%9c%a8-windows-%e4%b8%8a%e5%ae%89%e8%a3%9d-node-js-%e5%92%8c-npm-CdlaoDpNyJ\">\u5728 Windows \u4e0a\u5b89\u88dd Node.js \u548c npm<\/h2>\n<p>\u5728 Windows \u7cfb\u7d71\u4e0a\u5b89\u88dd Node.js \u548c npm \u7684\u6b65\u9a5f\u5982\u4e0b\uff1a<\/p>\n<ol>\n<li><strong>\u4e0b\u8f09 Node.js \u5b89\u88dd\u5305\uff1a<\/strong>\u8a2a\u554f <a href=\"https:\/\/nodejs.org\/en\/download\/\" rel=\"nofollow noopener\" target=\"_blank\">Node.js \u5b98\u65b9\u7db2\u7ad9<\/a>\uff0c\u9078\u64c7\u9069\u5408 Windows \u7684\u5b89\u88dd\u5305\uff08LTS \u7248\u672c\u5efa\u8b70\u7528\u65bc\u751f\u7522\u74b0\u5883\uff09\u3002<\/li>\n<li><strong>\u904b\u884c\u5b89\u88dd\u7a0b\u5f0f\uff1a<\/strong>\u96d9\u64ca\u4e0b\u8f09\u7684\u5b89\u88dd\u5305\uff0c\u6309\u7167\u63d0\u793a\u9032\u884c\u5b89\u88dd\u3002\u78ba\u4fdd\u9078\u64c7\u4e86\u201cAdd to PATH\u201d\u9078\u9805\uff0c\u4ee5\u4fbf\u5728\u547d\u4ee4\u884c\u4e2d\u4f7f\u7528 Node.js \u548c npm\u3002<\/li>\n<li><strong>\u9a57\u8b49\u5b89\u88dd\uff1a<\/strong>\u5b89\u88dd\u5b8c\u6210\u5f8c\uff0c\u6253\u958b\u547d\u4ee4\u63d0\u793a\u7b26\uff0c\u8f38\u5165\u4ee5\u4e0b\u547d\u4ee4\u4f86\u6aa2\u67e5 Node.js \u548c npm \u662f\u5426\u5b89\u88dd\u6210\u529f\uff1a<\/strong>\n<pre><code>node -v\nnpm -v<\/code><\/pre>\n<\/li>\n<\/ol>\n<h2 id=\"%e5%9c%a8-macos-%e4%b8%8a%e5%ae%89%e8%a3%9d-node-js-%e5%92%8c-npm-CdlaoDpNyJ\">\u5728 macOS \u4e0a\u5b89\u88dd Node.js \u548c npm<\/h2>\n<p>\u5728 macOS \u7cfb\u7d71\u4e0a\u5b89\u88dd Node.js \u548c npm \u7684\u65b9\u6cd5\u6709\u591a\u7a2e\uff0c\u6700\u5e38\u898b\u7684\u662f\u4f7f\u7528 Homebrew\u3002\u4ee5\u4e0b\u662f\u5177\u9ad4\u6b65\u9a5f\uff1a<\/p>\n<ol>\n<li><strong>\u5b89\u88dd Homebrew\uff1a<\/strong>\u5982\u679c\u5c1a\u672a\u5b89\u88dd Homebrew\uff0c\u53ef\u4ee5\u5728\u7d42\u7aef\u4e2d\u904b\u884c\u4ee5\u4e0b\u547d\u4ee4\uff1a<\/strong>\n<pre><code>\/bin\/bash -c \"$(curl -fsSL https:\/\/raw.githubusercontent.com\/Homebrew\/install\/HEAD\/install.sh)\"<\/code><\/pre>\n<\/li>\n<li><strong>\u4f7f\u7528 Homebrew \u5b89\u88dd Node.js\uff1a<\/strong>\u5728\u7d42\u7aef\u4e2d\u904b\u884c\u4ee5\u4e0b\u547d\u4ee4\uff1a<\/strong>\n<pre><code>brew install node<\/code><\/pre>\n<\/li>\n<li><strong>\u9a57\u8b49\u5b89\u88dd\uff1a<\/strong>\u5b89\u88dd\u5b8c\u6210\u5f8c\uff0c\u8f38\u5165\u4ee5\u4e0b\u547d\u4ee4\u4f86\u6aa2\u67e5 Node.js \u548c npm \u662f\u5426\u5b89\u88dd\u6210\u529f\uff1a<\/strong>\n<pre><code>node -v\nnpm -v<\/code><\/pre>\n<\/li>\n<\/ol>\n<h2 id=\"%e5%9c%a8-linux-%e4%b8%8a%e5%ae%89%e8%a3%9d-node-js-%e5%92%8c-npm-CdlaoDpNyJ\">\u5728 Linux \u4e0a\u5b89\u88dd Node.js \u548c npm<\/h2>\n<p>\u5728 Linux \u7cfb\u7d71\u4e0a\u5b89\u88dd Node.js \u548c npm \u7684\u65b9\u6cd5\u53d6\u6c7a\u65bc\u6240\u4f7f\u7528\u7684\u767c\u884c\u7248\u3002\u4ee5\u4e0b\u662f\u57fa\u65bc Ubuntu \u7684\u5b89\u88dd\u6b65\u9a5f\uff1a<\/p>\n<ol>\n<li><strong>\u66f4\u65b0\u7cfb\u7d71\uff1a<\/strong>\u5728\u7d42\u7aef\u4e2d\u904b\u884c\u4ee5\u4e0b\u547d\u4ee4\u4ee5\u66f4\u65b0\u7cfb\u7d71\uff1a<\/strong>\n<pre><code>sudo apt update\nsudo apt upgrade<\/code><\/pre>\n<\/li>\n<li><strong>\u5b89\u88dd Node.js \u548c npm\uff1a<\/strong>\u904b\u884c\u4ee5\u4e0b\u547d\u4ee4\u4f86\u5b89\u88dd Node.js \u548c npm\uff1a<\/strong>\n<pre><code>sudo apt install nodejs npm<\/code><\/pre>\n<\/li>\n<li><strong>\u9a57\u8b49\u5b89\u88dd\uff1a<\/strong>\u5b89\u88dd\u5b8c\u6210\u5f8c\uff0c\u8f38\u5165\u4ee5\u4e0b\u547d\u4ee4\u4f86\u6aa2\u67e5 Node.js \u548c npm \u662f\u5426\u5b89\u88dd\u6210\u529f\uff1a<\/strong>\n<pre><code>node -v\nnpm -v<\/code><\/pre>\n<\/li>\n<\/ol>\n<h2 id=\"%e7%b8%bd%e7%b5%90-CdlaoDpNyJ\">\u7e3d\u7d50<\/h2>\n<p>\u672c\u6587\u4ecb\u7d39\u4e86\u5982\u4f55\u5728 Windows\u3001macOS \u548c Linux \u7cfb\u7d71\u4e0a\u5b89\u88dd Node.js \u548c npm\u3002\u9019\u4e9b\u6b65\u9a5f\u7c21\u55ae\u6613\u884c\uff0c\u80fd\u5920\u5e6b\u52a9\u958b\u767c\u8005\u5feb\u901f\u642d\u5efa\u958b\u767c\u74b0\u5883\u3002\u7121\u8ad6\u60a8\u662f\u521d\u5b78\u8005\u9084\u662f\u7d93\u9a57\u8c50\u5bcc\u7684\u958b\u767c\u8005\uff0c\u638c\u63e1 Node.js \u548c npm \u5c07\u6709\u52a9\u65bc\u63d0\u5347\u60a8\u7684\u958b\u767c\u6548\u7387\u3002\u5982\u679c\u60a8\u9700\u8981\u7a69\u5b9a\u7684 <a href=\"https:\/\/server.hk\">VPS<\/a> \u4f86\u904b\u884c\u60a8\u7684\u61c9\u7528\u7a0b\u5f0f\uff0cServer.HK \u63d0\u4f9b\u591a\u7a2e\u9078\u64c7\uff0c\u6eff\u8db3\u4e0d\u540c\u9700\u6c42\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u5b78\u7fd2\u5982\u4f55\u5728 Windows\u3001macOS \u548c Linux \u4e0a\u5b89\u88dd Node.js \u548c npm\uff0c\u8f15\u9b06\u958b\u59cb\u60a8\u7684 WordPress \u958b\u767c\u4e4b\u65c5\u3002<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[4925],"tags":[],"class_list":["post-56461","post","type-post","status-publish","format-standard","hentry","category-4925"],"_links":{"self":[{"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/posts\/56461","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/comments?post=56461"}],"version-history":[{"count":1,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/posts\/56461\/revisions"}],"predecessor-version":[{"id":56462,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/posts\/56461\/revisions\/56462"}],"wp:attachment":[{"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/media?parent=56461"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/categories?post=56461"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/tags?post=56461"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}