{"id":10006718,"date":"2022-10-24T11:34:56","date_gmt":"2022-10-24T03:34:56","guid":{"rendered":"https:\/\/ityet.com\/?p=10006718"},"modified":"2022-10-24T11:34:56","modified_gmt":"2022-10-24T03:34:56","slug":"%e8%bf%81%e7%a7%bb%e5%88%b0nvsnodeversionswitcher%e6%9d%a5%e7%ae%a1%e7%90%86nodejs%e7%89%88%e6%9c%ac","status":"publish","type":"post","link":"https:\/\/itmax.cn\/?p=10006718","title":{"rendered":"\u8fc1\u79fb\u5230NVS(NodeVersionSwitcher)\u6765\u7ba1\u7406NodeJS\u7248\u672c"},"content":{"rendered":"<blockquote><p>\u80cc\u666f\uff1a\u6700\u8fd1\u5de5\u4f5c\u5728\u6709\u4fe1\u606f\u7ba1\u63a7\u7684\u5382\u5185\uff0c\u914d\u53d1\u7684\u7535\u8111\u662f\u53d7\u9650\u57df\u8d26\u6237\uff0c\u4f7f\u7528 <code>NVM for Windows<\/code> \u6765\u5207\u6362\u7248\u672c\u7684\u8bdd\uff0c\u4f1a\u6709\u8bbf\u95ee\u88ab\u62d2\u7edd\u7684\u60c5\u51b5\uff0c\u9700\u8981\u4f7f\u7528\u7ba1\u7406\u5458\u6743\u9650\u6765\u5207\u6362\u3002\u8fd9\u5728\u65e5\u5e38\u5de5\u4f5c\u4e2d\u4f1a\u662f\u4e00\u4ef6\u5341\u5206\u9ebb\u70e6\u7684\u4e8b\u60c5\uff0c\u6bcf\u6b21\u5207\u6362\u7248\u672c\u90fd\u9700\u8981\u53bb\u627e <code>IT Admin<\/code> \u6388\u6743\u3002<\/p><\/blockquote>\n<p>\u4e4b\u524d\u521a\u5165\u804c\u914d\u7f6e\u5f00\u53d1\u73af\u5883\u7684\u65f6\u5019\u5c31\u9047\u5230\u8fc7\u4f7f\u7528 <strong>NVM4W<\/strong> \u5207\u6362\u7248\u672c\u7684\u65f6\u5019\u4f1a\u51fa\u73b0\u8bbf\u95ee\u88ab\u62d2\u7edd\u7684\u95ee\u9898\uff08\u63d0\u793a <code>exit status 1: Access is denied.<\/code>\uff09\uff0c\u9700\u8981\u7ba1\u7406\u5458\u6743\u9650\u624d\u53ef\u4ee5\u5207\u6362\uff0c\u53ea\u4e0d\u8fc7\u73b0\u5728\u8d1f\u8d23\u7684\u90fd\u662f\u65b0\u9879\u76ee\u4e0d\u9700\u8981\u5207\u6362 <code>NodeJS<\/code> \u7684\u7248\u672c\uff0c\u6240\u4ee5\u5f53\u65f6\u6307\u5b9a\u5b8c\u5f53\u524d <strong>Node<\/strong> \u7248\u672c\u4e3a <code>LTS<\/code> \u4e4b\u540e\u5c31\u653e\u5f03\u7ea0\u7ed3\u4e86\u3002<\/p>\n<p>\u6628\u5929\u5c0f\u4f19\u4f34\u4e5f\u9047\u5230\u4e86\u9700\u8981\u5207\u6362\u7248\u672c\u7684\u60c5\u51b5\uff0c\u6211\u4e5f\u56e0\u4e3a\u65f6\u95f4\u95f4\u9694\u592a\u4e45\u4e86\u5c31\u548c\u4ed6\u8bf4\u53ef\u4ee5\u4f7f\u7528<strong>NVM4W<\/strong>\u6765\u5207\u6362\uff0c\u4ed6\u5c1d\u8bd5\u4e4b\u540e\u53d1\u73b0\u5e76\u4e0d\u884c\u3002<\/p>\n<p>\u6b63\u597d\u6211\u624b\u5934\u4e0a\u4e5f\u5fd9\u5b8c\u4e86\u5927\u90e8\u5206\u5de5\u4f5c\u5185\u5bb9\u5c31\u7814\u7a76\u4e86\u4e00\u4e0b\u5982\u679c\u6765\u89e3\u51b3\u8fd9\u4e2a\u60c5\u51b5\u3002\u5728\u6d4f\u89c8 <code>NVM4W<\/code> \u7684 <code>Discussions<\/code> \u65f6\uff0c\u770b\u5230\u4e86 <a href=\"https:\/\/link.segmentfault.com\/?enc=qQYN6YQDBetjaPZFL8tltw%3D%3D.eMn6UO%2FbmwXMTIlGIdimMuhTYO%2BwJ68DrZ2KV8Rmj6iz6mhpyW9uHlSvWyrGdDNORvYAtLkGDvJBQgyl5XqlyQ%3D%3D\" rel=\"nofollow\">\u4e00\u7bc7\u5e16\u5b50<\/a>\uff0c\u5176\u4e2d\u6709\u4eba\u63d0\u5230\u4e86 <code>NVS<\/code>\uff0c\u6240\u4ee5\u5728V2EX\u63d0\u95ee\u4e4b\u540e\u5c31\u53bb\u4e86\u89e3\u4e86\u4e00\u4e0b\uff0c\u4ee5\u4e0b\u6b65\u9aa4\u7686\u4e3a <code>Win10<\/code> \u73af\u5883\u4e0b\uff0c<code>Mac<\/code> \u53ca <code>Linux<\/code> \u53ef\u4ee5\u67e5\u770b\u4ed3\u5e93\u7684 <a href=\"https:\/\/link.segmentfault.com\/?enc=28ag%2BMEp4%2FIzTWJK2zRtUQ%3D%3D.KENO1wyq94OkRPl13DLDRV8oo37DNOa47tR2pAfKRHTJ%2BZ1YtTW1QJWYgvNF8LdjiYTuD5uJFoRvsw2HsdoOVA%3D%3D\" rel=\"nofollow\">README<\/a>\u3002<\/p>\n<hr>\n<h2>\ud83d\udcbe \u5b89\u88c5<\/h2>\n<p>\u5b89\u88c5\u5f88\u7b80\u5355\uff0c\u901a\u8fc7\u4ed3\u5e93\u7684 <code>releases<\/code> \u76f4\u63a5\u4e0b\u8f7d\u6700\u65b0\u7684 <code>.msi<\/code> \u6587\u4ef6\u5c31\u53ef\u4ee5\u4e86\uff0c\u53cc\u51fb\u8fd0\u884c\u5373\u53ef\uff0c\u9ed8\u8ba4\u5b89\u88c5\u5230\u5f53\u524d\u7528\u6237\u4e0b\uff08\u65e2\u4e0d\u4f1a\u51fa\u73b0\u53d7\u9650\u7528\u6237\u8d26\u6237\u7684\u6388\u6743\u5f39\u7a97\uff09\u3002<\/p>\n<p><small>&#8211; <em>\u539f\u6765\u5b89\u88c5\u7684 <strong>NVM4W<\/strong> \u548c <strong>NodeJS<\/strong> \u53ef\u4ee5\u4e0d\u7528\u5378\u8f7d\uff0c\u5982\u679c\u6709\u5f3a\u8feb\u75c7\u53ef\u4ee5\u5148\u5220\u9664\u518d\u5b89\u88c5 <strong>NVS<\/strong> \uff08\u53d1\u6587\u65f6\u6700\u65b0\u7248\u672c\u4e3a <code>v1.6.2<\/code> \uff09\u3002<\/em><\/small><br \/><small>&#8211; \u8bb0\u5f97\u5148\u67e5\u770b\u4e00\u4e0b\u5168\u5c40\u4f9d\u8d56\u9879\uff0c\u907f\u514d\u4e4b\u540e\u56e0\u4e3a\u5378\u8f7d <strong>NodeJS<\/strong> \u4e4b\u540e\u8bb0\u4e0d\u8d77\u6765\u88c5\u4e86\u4e9b\u4ec0\u4e48\uff0c\u5982\u679c\u662f\u7ef4\u62a4\u5728\u5916\u90e8\u76ee\u5f55\u7684\u53ef\u4ee5\u4e0d\u7528\u7ba1\uff0c\u4e4b\u540e\u91cd\u65b0\u8bbe\u7f6e\u5230\u65e7\u76ee\u5f55\u5373\u53ef\u3002<\/small><\/p>\n<h2>\ud83d\udce5 \u4e0b\u8f7d Node \u7248\u672c<\/h2>\n<ol>\n<li>\u53ef\u4ee5\u76f4\u63a5\u5728\u7ec8\u7aef\u952e\u5165 <code>nvs<\/code> \u901a\u8fc7\u7ec8\u7aef\u64cd\u4f5c\u754c\u9762\u6765\u4e0b\u8f7d\u548c\u5207\u6362Node\u7248\u672c\u3002<\/li>\n<li>\u4f7f\u7528 <code>nvs ls-remove<\/code> \u67e5\u770b\u53ef\u7528\u7248\u672c\u540e\u4f7f\u7528 <code>nvs add x.y.z<\/code> \u6765\u4e0b\u8f7d\u6307\u5b9a\u7248\u672c\u3002<\/li>\n<li>\u4f7f\u7528 <code>nvs add lts<\/code> \u901a\u8fc7\u522b\u540d\u5feb\u901f\u4e0b\u8f7d\u5bf9\u5e94\u7248\u672c\uff0c\u53ef\u7528\u522b\u540d\uff1a<code>lts<\/code>\u3001<code>latest<\/code>\u3001<code>Argon<\/code> \u7b49\u3002<\/li>\n<\/ol>\n<h2>\ud83d\udd13 \u5207\u6362\/\u6307\u5b9a Node \u7248\u672c<\/h2>\n<ol>\n<li>\n<p><strong>\u6307\u5b9a\u5f53\u524d\u7ec8\u7aef\u7684 Node \u7248\u672c<\/strong><\/p>\n<ul>\n<li><code>nvs use [version]<\/code><\/li>\n<\/ul>\n<\/li>\n<li>\n<p><strong>\u6307\u5b9a\u5168\u5c40\u73af\u5883\u4e0b\u7684 Node \u7248\u672c<\/strong><\/p>\n<ul>\n<li><code>nvs link [version]<\/code><\/li>\n<\/ul>\n<\/li>\n<li>\n<p><strong>\u6839\u636e\u9879\u76ee\u81ea\u52a8\u5207\u6362 Node \u7248\u672c<\/strong><\/p>\n<ul>\n<li>\n<p>\u9879\u76ee\u76ee\u5f55\u4e0b\u5982\u679c\u6709 <code>.node-version<\/code> \u6216\u8005 <code>.nvmrc<\/code>\uff0c<code>NVS<\/code> \u4f1a\u81ea\u52a8\u5207\u6362 <strong>Node<\/strong> \u4e3a\u6307\u5b9a\u7248\u672c\uff1b<\/p>\n<ul>\n<li>\u6587\u4ef6\u4e2d\u76f4\u63a5\u6307\u5b9a\u7248\u672c\u53f7\u6216\u8005\u522b\u540d\u90fd\u53ef\uff0c\u5177\u4f53\u53ef\u4ee5\u67e5\u770b <a href=\"https:\/\/link.segmentfault.com\/?enc=5IGDBfymqezWGDBSJSHt8A%3D%3D.xu%2FclzbE4muHEONFOtVNpWjD%2BST1pHtZE3AFq9e2EnvU4VXZT3HVOoSJtLku7FZgpst6XBkGp7ta%2FsGd6GPhHw%3D%3D\" rel=\"nofollow\">doc\/AUTO Command<\/a>;<\/li>\n<li>\u4f8b\u5982\u76f4\u63a5\u5728\u6587\u4ef6\u4e2d\u952e\u5165 <code>lts<\/code> \u5e76\u4fdd\u5b58\u3002<\/li>\n<\/ul>\n<\/li>\n<li>\u8be5\u529f\u80fd\u9ed8\u8ba4\u662f\u5173\u95ed\u7684\uff0c\u9700\u8981\u624b\u52a8\u952e\u5165 <code>nvs auto on<\/code> \u6253\u5f00\uff1b<\/li>\n<li>\u8be5\u529f\u80fd\u5728<code>CMD<\/code>\u7ec8\u7aef\u4e2d\u5e76\u4e0d\u652f\u6301\uff0c\u9700\u8981\u5728 <code>PowerShell<\/code> \u4e2d\u4f7f\u7528\u3002<\/li>\n<\/ul>\n<\/li>\n<\/ol>\n<h2>\ud83c\udf0f \u6307\u5b9a npm \u5168\u5c40\u4f9d\u8d56\u4f4d\u7f6e<\/h2>\n<p>\u4e00\u822c\u6765\u8bf4\u6211\u4f1a\u76f4\u63a5\u6307\u5b9a\u4e00\u4e2a\u5916\u90e8\u76ee\u5f55\u4e3a\u5168\u5c40\u4f9d\u8d56\u5b89\u88c5\u76ee\u5f55\uff0c\u8fd9\u6837\u7684\u8bdd\u5728\u5207\u6362\u4e0d\u540c\u7248\u672c\u7684 Node \u65f6\uff0c\u4e0d\u9700\u8981\u91cd\u65b0\u5b89\u88c5\u5168\u5c40\u4f9d\u8d56\u4e86\u3002<\/p>\n<ul>\n<li><strong>NVS<\/strong> \u63d0\u4f9b\u4e86\u4e00\u4e2a <code>nvs migrate<\/code> \u547d\u4ee4\u53ef\u4ee5\u6307\u5b9a\u67d0\u4e00\u4e2a\u7248\u672c\u7684\u5168\u5c40\u6a21\u5757\uff0c\u4f46\u662f\u8fd9\u4e2a\u547d\u4ee4\u8fd8\u6ca1\u63a5\u89e6\u8fc7\u5c31\u4e0d\u591a\u9610\u8ff0\u4e86\uff0c\u60f3\u8981\u4e86\u89e3\u7684\u53ef\u4ee5\u76f4\u63a5\u67e5\u770b<a href=\"https:\/\/link.segmentfault.com\/?enc=sdKlGnI7TGcKpjefy0o7GA%3D%3D.BdhttTG1Lg1%2FJraZX4bL283Iim%2Bv%2FgwCLXe%2FnWLG%2FjvsopzdIrLosN6lkogDMmaxNE3p9HZ1KBkW4MCYcCNI0g%3D%3D\" rel=\"nofollow\">\u6587\u6863<\/a>\u3002<\/li>\n<\/ul>\n<hr>\n<h2>\u9047\u5230\u95ee\u9898<\/h2>\n<h3>\u4f7f\u7528 <code>nvs ls-remote<\/code> \u67e5\u770b\u53ef\u7528\u7248\u672c\u65f6\u63d0\u793a\u8d85\u65f6<\/h3>\n<p>\u8fdc\u7a0b\u8282\u70b9\u5207\u6362\u5230\u963f\u91cc\u955c\u50cf\u5c31\u53ef\u4ee5\u4e86:<\/p>\n<pre><code class=\"cmd\">nvs remote node https:\/\/npmmirror.com\/mirrors\/node\/<\/code><\/pre>\n<hr>\n<h2>\ud83d\udcda \u6587\u6863<\/h2>\n<p><a href=\"https:\/\/link.segmentfault.com\/?enc=mLCd0TO79PgKNZv4fZaAwQ%3D%3D.e%2B%2Fj7GeO%2BdxqS0Y8NrYdSHzM%2Bv2hVit36r%2Bh6OXqp0U%3D\" rel=\"nofollow\">Node Version Switcher &#8211; A cross-platform tool for switching between versions and forks of Node.js<\/a><br \/><a href=\"https:\/\/link.segmentfault.com\/?enc=SwURFQyYln8%2FgqriBXgurQ%3D%3D.i1A8DlV8BmOdtuER35OD82KKmfr2vdw06NYwaENrKFYWB%2Br6rehzjPkyJkRSXcNB\" rel=\"nofollow\">\u79d1\u666e\u6587\uff1a\u4f7f\u7528 nvs \u7ba1\u7406\u672c\u5730 Node.js \u7248\u672c &#8211; \u77e5\u4e4e<\/a><br \/><a href=\"https:\/\/link.segmentfault.com\/?enc=MGVnpsdnN7iU49HWZ2IMSw%3D%3D.ByOCdvBzwscjrwGHjVCMSqY65huFBlNvgguZX7hifTbu%2B87M2%2FV%2FSYarMUQlDMaF\" rel=\"nofollow\">\u4ece nvm \u8fc1\u79fb\u5230 nvs | Unknown Me<\/a><br \/><a href=\"https:\/\/link.segmentfault.com\/?enc=uRX%2FWg1eIqVPCV69CqYnwg%3D%3D.p5%2FZE5ExwPEWIKDW9UWhFc33zReMGzXJbQKx4P9UfVePmCt1cCCL3WnsK6P6ciyd\" rel=\"nofollow\">[node]nvs\u4f7f\u7528\u7684\u6ce8\u610f\u4e8b\u9879 &#8211; \u6398\u91d1<\/a><br \/><a href=\"https:\/\/link.segmentfault.com\/?enc=BtysR7Gj%2Fb06kw%2FGfjPSIQ%3D%3D.8U6S1MjqeoIzZT5ZunvUHsWGtEQko8v6z4Ecl7TiEFM%3D\" rel=\"nofollow\">\u5728\u4fe1\u606f\u7ba1\u63a7\u7684\u5382\u5185\u5982\u4f55\u4f7f\u7528\u6bd4\u5982\u8bf4 NVM \u4e4b\u7c7b\u4f1a\u6267\u884c\u811a\u672c\u7684\u5de5\u5177 &#8211; V2EX<\/a><\/p>\n<p><a href=\"https:\/\/segmentfault.com\/a\/1190000042673166\">https:\/\/segmentfault.com\/a\/1190000042673166<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u80cc\u666f\uff1a\u6700\u8fd1\u5de5\u4f5c\u5728\u6709\u4fe1\u606f\u7ba1\u63a7\u7684\u5382\u5185\uff0c\u914d\u53d1\u7684\u7535\u8111\u662f\u53d7\u9650\u57df\u8d26\u6237\uff0c\u4f7f\u7528 NVM for Windows \u6765\u5207\u6362\u7248\u672c\u7684\u8bdd [&hellip;]<\/p>\n","protected":false},"author":0,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[],"tags":[],"class_list":["post-10006718","post","type-post","status-publish","format-standard","hentry"],"jetpack_sharing_enabled":true,"jetpack_featured_media_url":"","_links":{"self":[{"href":"https:\/\/itmax.cn\/index.php?rest_route=\/wp\/v2\/posts\/10006718","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/itmax.cn\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/itmax.cn\/index.php?rest_route=\/wp\/v2\/types\/post"}],"replies":[{"embeddable":true,"href":"https:\/\/itmax.cn\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=10006718"}],"version-history":[{"count":0,"href":"https:\/\/itmax.cn\/index.php?rest_route=\/wp\/v2\/posts\/10006718\/revisions"}],"wp:attachment":[{"href":"https:\/\/itmax.cn\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=10006718"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/itmax.cn\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=10006718"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/itmax.cn\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=10006718"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}