{"id":38440,"date":"2025-05-20T13:02:36","date_gmt":"2025-05-20T05:02:36","guid":{"rendered":"https:\/\/www.wsisp.com\/helps\/38440.html"},"modified":"2025-05-20T13:02:36","modified_gmt":"2025-05-20T05:02:36","slug":"%e4%bd%bf%e7%94%a8-nvm-%e7%ae%a1%e7%90%86-node-js-%e5%92%8c-npm-%e7%89%88%e6%9c%ac","status":"publish","type":"post","link":"https:\/\/www.wsisp.com\/helps\/38440.html","title":{"rendered":"\u4f7f\u7528 nvm \u7ba1\u7406 Node.js \u548c npm \u7248\u672c"},"content":{"rendered":"<p>\u4ee5\u4e0b\u4ecb\u7ecd\u5728 macOS \u4e0a\u4f7f\u7528 nvm \u5bf9 node \u548c npm \u8fdb\u884c\u7248\u672c\u7ba1\u7406&#xff0c;\u6e90\u7801\u901f\u9012\u3002<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2025\/05\/20250520050234-682c0ceaa7efb.png\" alt=\"\u5728\u8fd9\u91cc\u63d2\u5165\u56fe\u7247\u63cf\u8ff0\" \/><\/p>\n<ul>\n<li>\u5728 macOS \u4e0a\u4f7f\u7528 nvm \u7ba1\u7406 Node.js \u548c npm \u7248\u672c<\/li>\n<li>\u76ee\u5f55<\/li>\n<li>\u5b89\u88c5 nvm\n<ul>\n<li>1. \u68c0\u67e5\u662f\u5426\u5df2\u5b89\u88c5 nvm<\/li>\n<li>2. \u5b89\u88c5 nvm<\/li>\n<li>3. \u91cd\u65b0\u52a0\u8f7d\u914d\u7f6e\u6587\u4ef6<\/li>\n<li>4. \u9a8c\u8bc1\u5b89\u88c5<\/li>\n<\/ul>\n<\/li>\n<li>\u4f7f\u7528 nvm \u5b89\u88c5 Node.js\n<ul>\n<li>1. \u67e5\u770b\u53ef\u7528\u7684 Node.js \u7248\u672c<\/li>\n<li>2. \u5b89\u88c5\u7279\u5b9a\u7248\u672c\u7684 Node.js<\/li>\n<\/ul>\n<\/li>\n<li>\u8bbe\u7f6e\u9ed8\u8ba4\u7684 Node.js \u7279\u5b9a\u7248\u672c<\/li>\n<li>\u5207\u6362 Node.js \u7248\u672c<\/li>\n<li>\u6307\u5b9a\u955c\u50cf\u6e90\u52a0\u901f\u4e0b\u8f7d<\/li>\n<li>\u9a8c\u8bc1\u5f53\u524d\u7248\u672c<\/li>\n<li>\u603b\u7ed3<\/li>\n<\/ul>\n<h3>\u5728 macOS \u4e0a\u4f7f\u7528 nvm \u7ba1\u7406 Node.js \u548c npm \u7248\u672c<\/h3>\n<p>\u5728\u5f00\u53d1\u8fc7\u7a0b\u4e2d&#xff0c;\u6211\u4eec\u53ef\u80fd\u9700\u8981\u5728\u4e0d\u540c\u7684\u9879\u76ee\u4e2d\u4f7f\u7528\u4e0d\u540c\u7248\u672c\u7684 Node.js \u548c npm\u3002\u4e3a\u4e86\u65b9\u4fbf\u5730\u5207\u6362\u548c\u7ba1\u7406\u8fd9\u4e9b\u7248\u672c&#xff0c;\u53ef\u4ee5\u4f7f\u7528 nvm&#xff08;Node Version Manager&#xff09;\u5de5\u5177\u3002nvm \u662f\u4e00\u4e2a\u57fa\u4e8e Shell \u7684\u5de5\u5177&#xff0c;\u53ef\u4ee5\u5728 macOS \u548c Linux \u4e0a\u8f7b\u677e\u5b89\u88c5\u548c\u7ba1\u7406\u591a\u4e2a Node.js \u7248\u672c\u3002<\/p>\n<p>\u672c\u6587\u5c06\u8be6\u7ec6\u4ecb\u7ecd\u5982\u4f55\u901a\u8fc7 nvm \u5b89\u88c5\u3001\u914d\u7f6e\u548c\u7ba1\u7406 Node.js \u53ca\u5176\u5bf9\u5e94\u7684 npm \u7248\u672c&#xff0c;\u5e76\u63d0\u4f9b\u6307\u5b9a\u955c\u50cf\u6e90\u4e0b\u8f7d\u7684\u6280\u5de7\u3002<\/p>\n<hr \/>\n<h3>\u76ee\u5f55<\/h3>\n<ul>\n<li>\u5728 macOS \u4e0a\u4f7f\u7528 nvm \u7ba1\u7406 Node.js \u548c npm \u7248\u672c<\/li>\n<li>\u76ee\u5f55<\/li>\n<li>\u5b89\u88c5 nvm\n<ul>\n<li>1. \u68c0\u67e5\u662f\u5426\u5df2\u5b89\u88c5 nvm<\/li>\n<li>2. \u5b89\u88c5 nvm<\/li>\n<li>3. \u91cd\u65b0\u52a0\u8f7d\u914d\u7f6e\u6587\u4ef6<\/li>\n<li>4. \u9a8c\u8bc1\u5b89\u88c5<\/li>\n<\/ul>\n<\/li>\n<li>\u4f7f\u7528 nvm \u5b89\u88c5 Node.js\n<ul>\n<li>1. \u67e5\u770b\u53ef\u7528\u7684 Node.js \u7248\u672c<\/li>\n<li>2. \u5b89\u88c5\u7279\u5b9a\u7248\u672c\u7684 Node.js<\/li>\n<\/ul>\n<\/li>\n<li>\u8bbe\u7f6e\u9ed8\u8ba4\u7684 Node.js \u7279\u5b9a\u7248\u672c<\/li>\n<li>\u5207\u6362 Node.js \u7248\u672c<\/li>\n<li>\u6307\u5b9a\u955c\u50cf\u6e90\u52a0\u901f\u4e0b\u8f7d<\/li>\n<li>\u9a8c\u8bc1\u5f53\u524d\u7248\u672c<\/li>\n<li>\u603b\u7ed3<\/li>\n<\/ul>\n<hr \/>\n<h3>\u5b89\u88c5 nvm<\/h3>\n<h4>1. \u68c0\u67e5\u662f\u5426\u5df2\u5b89\u88c5 nvm<\/h4>\n<p>\u9996\u5148&#xff0c;\u5728\u7ec8\u7aef\u8fd0\u884c\u4ee5\u4e0b\u547d\u4ee4\u68c0\u67e5\u662f\u5426\u5df2\u7ecf\u5b89\u88c5\u4e86 nvm&#xff1a;<\/p>\n<p>nvm &#8211;version<\/p>\n<p>\u5982\u679c\u8f93\u51fa\u7c7b\u4f3c 0.39.x \u7684\u7248\u672c\u53f7&#xff0c;\u5219\u8868\u793a nvm \u5df2\u7ecf\u5b89\u88c5\u3002\u5426\u5219&#xff0c;\u8bf7\u7ee7\u7eed\u6309\u7167\u4ee5\u4e0b\u6b65\u9aa4\u8fdb\u884c\u5b89\u88c5\u3002<\/p>\n<p>$ nvm &#8211;version<br \/>\n<span class=\"token number\">0.39<\/span>.5<\/p>\n<h4>2. \u5b89\u88c5 nvm<\/h4>\n<p>\u901a\u8fc7 curl \u4e0b\u8f7d\u5e76\u5b89\u88c5 nvm \u811a\u672c&#xff1a;<\/p>\n<p><span class=\"token function\">curl<\/span> -o- https:\/\/raw.githubusercontent.com\/nvm-sh\/nvm\/v0.39.7\/install.sh <span class=\"token operator\">|<\/span> <span class=\"token function\">bash<\/span><\/p>\n<p>&#x1f4cc; \u6ce8\u610f&#xff1a;\u8bf7\u786e\u4fdd\u4f60\u7684 shell \u662f bash \u6216 zsh\u3002\u5982\u679c\u662f zsh&#xff0c;\u4f60\u53ef\u80fd\u8fd8\u9700\u8981\u624b\u52a8\u5c06\u4ee5\u4e0b\u4ee3\u7801\u6dfb\u52a0\u5230 ~\/.zshrc \u6587\u4ef6\u4e2d\u3002<\/p>\n<h4>3. \u91cd\u65b0\u52a0\u8f7d\u914d\u7f6e\u6587\u4ef6<\/h4>\n<p>\u5b89\u88c5\u5b8c\u6210\u540e&#xff0c;\u91cd\u65b0\u52a0\u8f7d\u4f60\u7684 shell \u914d\u7f6e\u6587\u4ef6&#xff1a;<\/p>\n<p><span class=\"token builtin class-name\">source<\/span> ~\/.bashrc   <span class=\"token comment\"># \u5982\u679c\u4f60\u4f7f\u7528\u7684\u662f bash<\/span><br \/>\n<span class=\"token builtin class-name\">source<\/span> ~\/.zshrc    <span class=\"token comment\"># \u5982\u679c\u4f60\u4f7f\u7528\u7684\u662f zsh<\/span><\/p>\n<h4>4. \u9a8c\u8bc1\u5b89\u88c5<\/h4>\n<p>\u518d\u6b21\u8fd0\u884c\u4ee5\u4e0b\u547d\u4ee4\u6765\u786e\u8ba4 nvm \u662f\u5426\u5b89\u88c5\u6210\u529f&#xff1a;<\/p>\n<p>nvm &#8211;version<\/p>\n<p>\u5982\u679c\u770b\u5230\u7c7b\u4f3c 0.39.7 \u7684\u7248\u672c\u53f7&#xff0c;\u5219\u8868\u793a\u5b89\u88c5\u6210\u529f\u3002<\/p>\n<hr \/>\n<h3>\u4f7f\u7528 nvm \u5b89\u88c5 Node.js<\/h3>\n<h4>1. \u67e5\u770b\u53ef\u7528\u7684 Node.js \u7248\u672c<\/h4>\n<p>\u4f60\u53ef\u4ee5\u901a\u8fc7\u4ee5\u4e0b\u547d\u4ee4\u67e5\u770b\u6240\u6709\u53ef\u5b89\u88c5\u7684 Node.js \u7248\u672c&#xff1a;<\/p>\n<p>nvm ls-remote<\/p>\n<p>\u8fd9\u4f1a\u5217\u51fa\u6240\u6709\u8fdc\u7a0b\u53ef\u7528\u7684 Node.js \u7248\u672c\u3002<\/p>\n<h4>2. \u5b89\u88c5\u7279\u5b9a\u7248\u672c\u7684 Node.js<\/h4>\n<p>\u5047\u8bbe\u4f60\u60f3\u5b89\u88c5 v20.11.0&#xff0c;\u53ef\u4ee5\u8fd0\u884c\u4ee5\u4e0b\u547d\u4ee4&#xff1a;<\/p>\n<p>nvm <span class=\"token function\">install<\/span> <span class=\"token number\">20.11<\/span>.0<\/p>\n<p>\u2705 \u63d0\u793a&#xff1a;\u5982\u679c\u4f60\u53ea\u9700\u8981\u5b89\u88c5\u6700\u65b0\u7248&#xff0c;\u53ef\u4ee5\u76f4\u63a5\u8fd0\u884c nvm install node\u3002<\/p>\n<p>\u5b89\u88c5\u5b8c\u6210\u540e&#xff0c;nvm \u4f1a\u81ea\u52a8\u5c06\u8be5\u7248\u672c\u8bbe\u7f6e\u4e3a\u5f53\u524d\u4f7f\u7528\u7684\u7248\u672c\u3002<\/p>\n<hr \/>\n<h3>\u8bbe\u7f6e\u9ed8\u8ba4\u7684 Node.js \u7279\u5b9a\u7248\u672c<\/h3>\n<p>\u5982\u679c\u4f60\u6709\u591a\u4e2a Node.js \u7248\u672c&#xff0c;\u5e76\u5e0c\u671b\u6bcf\u6b21\u6253\u5f00\u7ec8\u7aef\u65f6\u90fd\u4f7f\u7528\u67d0\u4e2a\u7279\u5b9a\u7248\u672c&#xff0c;\u53ef\u4ee5\u8bbe\u7f6e\u9ed8\u8ba4\u7248\u672c&#xff1a;<\/p>\n<p>nvm <span class=\"token builtin class-name\">alias<\/span> default <span class=\"token number\">20.11<\/span>.0<\/p>\n<p>\u8fd9\u6837&#xff0c;\u6bcf\u6b21\u6253\u5f00\u7ec8\u7aef\u65f6\u90fd\u4f1a\u9ed8\u8ba4\u4f7f\u7528 v20.11.0\u3002<\/p>\n<hr \/>\n<h3>\u5207\u6362 Node.js \u7248\u672c<\/h3>\n<p>\u5982\u679c\u4f60\u5df2\u7ecf\u5b89\u88c5\u4e86\u591a\u4e2a Node.js \u7248\u672c&#xff0c;\u53ef\u4ee5\u901a\u8fc7\u4ee5\u4e0b\u547d\u4ee4\u6765\u67e5\u8be2&#xff1a;<\/p>\n<p>$ nvm <span class=\"token function\">ls<\/span><br \/>\n         v8.0.0<br \/>\n        v8.16.0<br \/>\n        v12.4.0<br \/>\n       v14.15.0<br \/>\n       v18.19.1<br \/>\n&#8211;<span class=\"token operator\">&gt;<\/span>       system<br \/>\ndefault &#8211;<span class=\"token operator\">&gt;<\/span> stable <span class=\"token punctuation\">(<\/span>&#8211;<span class=\"token operator\">&gt;<\/span> v18.19.1<span class=\"token punctuation\">)<\/span><\/p>\n<p>\u53ef\u4ee5\u901a\u8fc7\u4ee5\u4e0b\u547d\u4ee4\u5207\u6362&#xff1a;<\/p>\n<p>nvm use <span class=\"token number\">18.19<\/span>.0<\/p>\n<p>\u6216\u8005\u76f4\u63a5\u8fd0\u884c&#xff1a;<\/p>\n<p>nvm use <span class=\"token operator\">&lt;<\/span>version<span class=\"token operator\">&gt;<\/span><\/p>\n<p>\u5176\u4e2d &lt;version&gt; \u662f\u4f60\u60f3\u8981\u5207\u6362\u7684\u7248\u672c\u53f7\u3002<\/p>\n<hr \/>\n<h3>\u6307\u5b9a\u955c\u50cf\u6e90\u52a0\u901f\u4e0b\u8f7d<\/h3>\n<p>\u5728\u56fd\u5185\u7f51\u7edc\u73af\u5883\u4e0b&#xff0c;\u4ece\u5b98\u65b9\u6e90\u4e0b\u8f7d Node.js \u901f\u5ea6\u53ef\u80fd\u8f83\u6162\u3002\u6211\u4eec\u53ef\u4ee5\u4f7f\u7528\u6dd8\u5b9d\u7684\u955c\u50cf\u6e90\u6765\u52a0\u901f\u4e0b\u8f7d&#xff1a;<\/p>\n<p><span class=\"token builtin class-name\">export<\/span> <span class=\"token assign-left variable\">NVM_NODEJS_ORG_MIRROR<\/span><span class=\"token operator\">&#061;<\/span>https:\/\/npmmirror.com\/mirrors\/node<\/p>\n<p>\u7136\u540e\u518d\u6b21\u5b89\u88c5 Node.js&#xff1a;<\/p>\n<p>nvm <span class=\"token function\">install<\/span> <span class=\"token number\">20.11<\/span>.0<\/p>\n<p>\u4f60\u4e5f\u53ef\u4ee5\u5c06\u4e0a\u9762\u7684\u955c\u50cf\u5730\u5740\u5199\u5165 .bashrc \u6216 .zshrc \u6587\u4ef6\u4e2d&#xff0c;\u4f7f\u5176\u6c38\u4e45\u751f\u6548&#xff1a;<\/p>\n<p><span class=\"token builtin class-name\">echo<\/span> <span class=\"token string\">&#039;export NVM_NODEJS_ORG_MIRROR&#061;https:\/\/npmmirror.com\/mirrors\/node&#039;<\/span> <span class=\"token operator\">&gt;&gt;<\/span> ~\/.bashrc<br \/>\n<span class=\"token builtin class-name\">source<\/span> ~\/.bashrc<\/p>\n<p>\u6216\u8005\u4e00\u6b21\u6027\u6307\u5b9a&#xff1a;<\/p>\n<p><span class=\"token assign-left variable\">NVM_NODEJS_ORG_MIRROR<\/span><span class=\"token operator\">&#061;<\/span>https:\/\/npmmirror.com\/mirrors\/node nvm <span class=\"token function\">install<\/span> <span class=\"token number\">18.19<\/span>.1<\/p>\n<hr \/>\n<h3>\u9a8c\u8bc1\u5f53\u524d\u7248\u672c<\/h3>\n<p>\u5b89\u88c5\u5b8c\u6210\u540e&#xff0c;\u9a8c\u8bc1\u5f53\u524d\u4f7f\u7528\u7684 Node.js \u548c npm \u7248\u672c&#xff1a;<\/p>\n<p>node -v<br \/>\n<span class=\"token function\">npm<\/span> -v<\/p>\n<p>\u4f60\u5e94\u8be5\u4f1a\u770b\u5230\u7c7b\u4f3c\u4ee5\u4e0b\u8f93\u51fa&#xff1a;<\/p>\n<p>v20.11.0<br \/>\nv10.2.0<\/p>\n<p>\u8fd9\u8868\u660e\u4f60\u5df2\u7ecf\u6210\u529f\u4f7f\u7528 nvm \u5b89\u88c5\u5e76\u5207\u6362\u4e86 Node.js \u548c npm \u7248\u672c\u3002<\/p>\n<hr \/>\n<h3>\u603b\u7ed3<\/h3>\n<p>\u901a\u8fc7 nvm&#xff0c;\u4f60\u53ef\u4ee5\u8f7b\u677e\u7ba1\u7406\u591a\u4e2a Node.js \u7248\u672c&#xff0c;\u5e76\u6839\u636e\u9879\u76ee\u9700\u6c42\u5feb\u901f\u5207\u6362\u3002\u7ed3\u5408\u56fd\u5185\u955c\u50cf\u6e90&#xff0c;\u8fd8\u80fd\u663e\u8457\u63d0\u5347\u4e0b\u8f7d\u901f\u5ea6\u3002\u4ee5\u4e0b\u662f\u5e38\u7528\u547d\u4ee4\u603b\u7ed3&#xff1a;<\/p>\n<table>\n<tr>\u529f\u80fd\u547d\u4ee4<\/tr>\n<tbody>\n<tr>\n<td>\u5b89\u88c5 nvm<\/td>\n<td>&#096;curl -o- https:\/\/raw.githubusercontent.com\/nvm-sh\/nvm\/v0.39.7\/install.sh<\/td>\n<\/tr>\n<tr>\n<td>\u67e5\u770b\u8fdc\u7a0b\u7248\u672c<\/td>\n<td>nvm ls-remote<\/td>\n<\/tr>\n<tr>\n<td>\u5b89\u88c5\u7279\u5b9a\u7248\u672c<\/td>\n<td>nvm install &lt;version&gt;<\/td>\n<\/tr>\n<tr>\n<td>\u5207\u6362\u7248\u672c<\/td>\n<td>nvm use &lt;version&gt;<\/td>\n<\/tr>\n<tr>\n<td>\u8bbe\u7f6e\u9ed8\u8ba4\u7248\u672c<\/td>\n<td>nvm alias default &lt;version&gt;<\/td>\n<\/tr>\n<tr>\n<td>\u67e5\u770b\u5f53\u524d\u7248\u672c<\/td>\n<td>node -v \/ npm -v<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n","protected":false},"excerpt":{"rendered":"<p>\u6587\u7ae0\u6d4f\u89c8\u9605\u8bfb640\u6b21\uff0c\u70b9\u8d5e10\u6b21\uff0c\u6536\u85cf20\u6b21\u3002\u672c\u6587\u4ecb\u7ecd\u4e86\u5982\u4f55\u5728 macOS \u4e0a\u4f7f\u7528 nvm\uff08Node Version Manager\uff09\u7ba1\u7406 Node.js \u548c npm \u7684\u7248\u672c\u3002nvm \u662f\u4e00\u4e2a\u57fa\u4e8e Shell \u7684\u5de5\u5177\uff0c\u80fd\u591f\u65b9\u4fbf\u5730\u5b89\u88c5\u3001\u5207\u6362\u548c\u7ba1\u7406\u591a\u4e2a Node.js \u7248\u672c\u3002\u6587\u7ae0\u8be6\u7ec6\u8bb2\u89e3\u4e86 nvm \u7684\u5b89\u88c5\u6b65\u9aa4\uff0c\u5305\u62ec\u68c0\u67e5\u662f\u5426\u5df2\u5b89\u88c5\u3001\u901a\u8fc7 curl \u5b89\u88c5\u3001\u91cd\u65b0\u52a0\u8f7d\u914d\u7f6e\u6587\u4ef6\u4ee5\u53ca\u9a8c\u8bc1\u5b89\u88c5\u3002\u6b64\u5916\uff0c\u8fd8\u4ecb\u7ecd\u4e86\u5982\u4f55\u4f7f\u7528 nvm \u5b89\u88c5\u7279\u5b9a\u7248\u672c\u7684 Node.js\u3001\u8bbe\u7f6e\u9ed8\u8ba4\u7248\u672c\u3001\u5207\u6362\u7248\u672c\u4ee5\u53ca\u901a\u8fc7\u6307\u5b9a\u955c\u50cf\u6e90\u52a0\u901f\u4e0b\u8f7d\u3002\u6700\u540e\uff0c\u6587\u7ae0\u603b\u7ed3\u4e86\u5e38\u7528\u547d\u4ee4\uff0c\u5e2e\u52a9\u5f00\u53d1\u8005\u5feb\u901f\u4e0a\u624b nvm\uff0c\u63d0\u5347\u5f00\u53d1\u6548\u7387<\/p>\n","protected":false},"author":2,"featured_media":38439,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[1056,186,90,87,3370],"topic":[],"class_list":["post-38440","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-server","tag-javaweb","tag-node-js","tag-npm","tag-87","tag-3370"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v20.3 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>\u4f7f\u7528 nvm \u7ba1\u7406 Node.js \u548c npm \u7248\u672c - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.wsisp.com\/helps\/38440.html\" \/>\n<meta property=\"og:locale\" content=\"zh_CN\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"\u4f7f\u7528 nvm \u7ba1\u7406 Node.js \u548c npm \u7248\u672c - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\" \/>\n<meta property=\"og:description\" content=\"\u6587\u7ae0\u6d4f\u89c8\u9605\u8bfb640\u6b21\uff0c\u70b9\u8d5e10\u6b21\uff0c\u6536\u85cf20\u6b21\u3002\u672c\u6587\u4ecb\u7ecd\u4e86\u5982\u4f55\u5728 macOS \u4e0a\u4f7f\u7528 nvm\uff08Node Version Manager\uff09\u7ba1\u7406 Node.js \u548c npm \u7684\u7248\u672c\u3002nvm \u662f\u4e00\u4e2a\u57fa\u4e8e Shell \u7684\u5de5\u5177\uff0c\u80fd\u591f\u65b9\u4fbf\u5730\u5b89\u88c5\u3001\u5207\u6362\u548c\u7ba1\u7406\u591a\u4e2a Node.js \u7248\u672c\u3002\u6587\u7ae0\u8be6\u7ec6\u8bb2\u89e3\u4e86 nvm \u7684\u5b89\u88c5\u6b65\u9aa4\uff0c\u5305\u62ec\u68c0\u67e5\u662f\u5426\u5df2\u5b89\u88c5\u3001\u901a\u8fc7 curl \u5b89\u88c5\u3001\u91cd\u65b0\u52a0\u8f7d\u914d\u7f6e\u6587\u4ef6\u4ee5\u53ca\u9a8c\u8bc1\u5b89\u88c5\u3002\u6b64\u5916\uff0c\u8fd8\u4ecb\u7ecd\u4e86\u5982\u4f55\u4f7f\u7528 nvm \u5b89\u88c5\u7279\u5b9a\u7248\u672c\u7684 Node.js\u3001\u8bbe\u7f6e\u9ed8\u8ba4\u7248\u672c\u3001\u5207\u6362\u7248\u672c\u4ee5\u53ca\u901a\u8fc7\u6307\u5b9a\u955c\u50cf\u6e90\u52a0\u901f\u4e0b\u8f7d\u3002\u6700\u540e\uff0c\u6587\u7ae0\u603b\u7ed3\u4e86\u5e38\u7528\u547d\u4ee4\uff0c\u5e2e\u52a9\u5f00\u53d1\u8005\u5feb\u901f\u4e0a\u624b nvm\uff0c\u63d0\u5347\u5f00\u53d1\u6548\u7387\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.wsisp.com\/helps\/38440.html\" \/>\n<meta property=\"og:site_name\" content=\"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\" \/>\n<meta property=\"article:published_time\" content=\"2025-05-20T05:02:36+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2025\/05\/20250520050234-682c0ceaa7efb.png\" \/>\n<meta name=\"author\" content=\"admin\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"\u4f5c\u8005\" \/>\n\t<meta name=\"twitter:data1\" content=\"admin\" \/>\n\t<meta name=\"twitter:label2\" content=\"\u9884\u8ba1\u9605\u8bfb\u65f6\u95f4\" \/>\n\t<meta name=\"twitter:data2\" content=\"2 \u5206\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/38440.html\",\"url\":\"https:\/\/www.wsisp.com\/helps\/38440.html\",\"name\":\"\u4f7f\u7528 nvm \u7ba1\u7406 Node.js \u548c npm \u7248\u672c - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\",\"isPartOf\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/#website\"},\"datePublished\":\"2025-05-20T05:02:36+00:00\",\"dateModified\":\"2025-05-20T05:02:36+00:00\",\"author\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41\"},\"breadcrumb\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/38440.html#breadcrumb\"},\"inLanguage\":\"zh-Hans\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.wsisp.com\/helps\/38440.html\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/38440.html#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"\u9996\u9875\",\"item\":\"https:\/\/www.wsisp.com\/helps\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"\u4f7f\u7528 nvm \u7ba1\u7406 Node.js \u548c npm \u7248\u672c\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/#website\",\"url\":\"https:\/\/www.wsisp.com\/helps\/\",\"name\":\"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\",\"description\":\"\u9999\u6e2f\u670d\u52a1\u5668_\u9999\u6e2f\u4e91\u670d\u52a1\u5668\u8d44\u8baf_\u670d\u52a1\u5668\u5e2e\u52a9\u6587\u6863_\u670d\u52a1\u5668\u6559\u7a0b\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/www.wsisp.com\/helps\/?s={search_term_string}\"},\"query-input\":\"required name=search_term_string\"}],\"inLanguage\":\"zh-Hans\"},{\"@type\":\"Person\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41\",\"name\":\"admin\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"zh-Hans\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery\",\"contentUrl\":\"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery\",\"caption\":\"admin\"},\"sameAs\":[\"http:\/\/wp.wsisp.com\"],\"url\":\"https:\/\/www.wsisp.com\/helps\/author\/admin\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"\u4f7f\u7528 nvm \u7ba1\u7406 Node.js \u548c npm \u7248\u672c - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.wsisp.com\/helps\/38440.html","og_locale":"zh_CN","og_type":"article","og_title":"\u4f7f\u7528 nvm \u7ba1\u7406 Node.js \u548c npm \u7248\u672c - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","og_description":"\u6587\u7ae0\u6d4f\u89c8\u9605\u8bfb640\u6b21\uff0c\u70b9\u8d5e10\u6b21\uff0c\u6536\u85cf20\u6b21\u3002\u672c\u6587\u4ecb\u7ecd\u4e86\u5982\u4f55\u5728 macOS \u4e0a\u4f7f\u7528 nvm\uff08Node Version Manager\uff09\u7ba1\u7406 Node.js \u548c npm \u7684\u7248\u672c\u3002nvm \u662f\u4e00\u4e2a\u57fa\u4e8e Shell \u7684\u5de5\u5177\uff0c\u80fd\u591f\u65b9\u4fbf\u5730\u5b89\u88c5\u3001\u5207\u6362\u548c\u7ba1\u7406\u591a\u4e2a Node.js \u7248\u672c\u3002\u6587\u7ae0\u8be6\u7ec6\u8bb2\u89e3\u4e86 nvm \u7684\u5b89\u88c5\u6b65\u9aa4\uff0c\u5305\u62ec\u68c0\u67e5\u662f\u5426\u5df2\u5b89\u88c5\u3001\u901a\u8fc7 curl \u5b89\u88c5\u3001\u91cd\u65b0\u52a0\u8f7d\u914d\u7f6e\u6587\u4ef6\u4ee5\u53ca\u9a8c\u8bc1\u5b89\u88c5\u3002\u6b64\u5916\uff0c\u8fd8\u4ecb\u7ecd\u4e86\u5982\u4f55\u4f7f\u7528 nvm \u5b89\u88c5\u7279\u5b9a\u7248\u672c\u7684 Node.js\u3001\u8bbe\u7f6e\u9ed8\u8ba4\u7248\u672c\u3001\u5207\u6362\u7248\u672c\u4ee5\u53ca\u901a\u8fc7\u6307\u5b9a\u955c\u50cf\u6e90\u52a0\u901f\u4e0b\u8f7d\u3002\u6700\u540e\uff0c\u6587\u7ae0\u603b\u7ed3\u4e86\u5e38\u7528\u547d\u4ee4\uff0c\u5e2e\u52a9\u5f00\u53d1\u8005\u5feb\u901f\u4e0a\u624b nvm\uff0c\u63d0\u5347\u5f00\u53d1\u6548\u7387","og_url":"https:\/\/www.wsisp.com\/helps\/38440.html","og_site_name":"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","article_published_time":"2025-05-20T05:02:36+00:00","og_image":[{"url":"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2025\/05\/20250520050234-682c0ceaa7efb.png"}],"author":"admin","twitter_card":"summary_large_image","twitter_misc":{"\u4f5c\u8005":"admin","\u9884\u8ba1\u9605\u8bfb\u65f6\u95f4":"2 \u5206"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/www.wsisp.com\/helps\/38440.html","url":"https:\/\/www.wsisp.com\/helps\/38440.html","name":"\u4f7f\u7528 nvm \u7ba1\u7406 Node.js \u548c npm \u7248\u672c - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","isPartOf":{"@id":"https:\/\/www.wsisp.com\/helps\/#website"},"datePublished":"2025-05-20T05:02:36+00:00","dateModified":"2025-05-20T05:02:36+00:00","author":{"@id":"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41"},"breadcrumb":{"@id":"https:\/\/www.wsisp.com\/helps\/38440.html#breadcrumb"},"inLanguage":"zh-Hans","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.wsisp.com\/helps\/38440.html"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.wsisp.com\/helps\/38440.html#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"\u9996\u9875","item":"https:\/\/www.wsisp.com\/helps"},{"@type":"ListItem","position":2,"name":"\u4f7f\u7528 nvm \u7ba1\u7406 Node.js \u548c npm \u7248\u672c"}]},{"@type":"WebSite","@id":"https:\/\/www.wsisp.com\/helps\/#website","url":"https:\/\/www.wsisp.com\/helps\/","name":"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","description":"\u9999\u6e2f\u670d\u52a1\u5668_\u9999\u6e2f\u4e91\u670d\u52a1\u5668\u8d44\u8baf_\u670d\u52a1\u5668\u5e2e\u52a9\u6587\u6863_\u670d\u52a1\u5668\u6559\u7a0b","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.wsisp.com\/helps\/?s={search_term_string}"},"query-input":"required name=search_term_string"}],"inLanguage":"zh-Hans"},{"@type":"Person","@id":"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41","name":"admin","image":{"@type":"ImageObject","inLanguage":"zh-Hans","@id":"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/image\/","url":"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery","contentUrl":"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery","caption":"admin"},"sameAs":["http:\/\/wp.wsisp.com"],"url":"https:\/\/www.wsisp.com\/helps\/author\/admin"}]}},"_links":{"self":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/posts\/38440","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/comments?post=38440"}],"version-history":[{"count":0,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/posts\/38440\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/media\/38439"}],"wp:attachment":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/media?parent=38440"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/categories?post=38440"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/tags?post=38440"},{"taxonomy":"topic","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/topic?post=38440"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}