{"id":105,"date":"2026-02-15T09:10:54","date_gmt":"2026-02-15T01:10:54","guid":{"rendered":"https:\/\/blog.leawsic.site\/?p=105"},"modified":"2026-02-15T09:26:32","modified_gmt":"2026-02-15T01:26:32","slug":"linux%e5%ae%89%e8%a3%85node-js","status":"publish","type":"post","link":"https:\/\/blog.leawsic.site\/index.php\/2026\/02\/15\/linux%e5%ae%89%e8%a3%85node-js\/","title":{"rendered":"Linux\u5b89\u88c5Node.js"},"content":{"rendered":"\n<pre class=\"wp-block-code\"><code># \u4e0b\u8f7d\u5e76\u5b89\u88c5nvm:\ncurl -o- https:\/\/raw.githubusercontent.com\/nvm-sh\/nvm\/v0.40.3\/install.sh | bash\n# \u6dfb\u52a0\u73af\u5883\u53d8\u91cf\n\\. \"$HOME\/.nvm\/nvm.sh\"\n# \u4e0b\u8f7d\u5e76\u5b89\u88c5\u5408\u9002\u7248\u672c\u7684 Node.js:\nnvm install 24\n# Verify the Node.js version:\nnode -v \n# Verify npm version:\nnpm -v <\/code><\/pre>\n\n\n\n<p>\u82e5\u8981\u66f4\u65b0\u7248\u672c\uff0c\u4f7f\u7528nvm\u5b89\u88c5\u6700\u65b0\u7248\u5373\u53ef<\/p>\n\n\n\n<p>\u5e38\u7528\u6307\u4ee4<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code class=\"language-markdown\">nvm --version\nnvm install &#91;<version>] --lts --latest-npm --save --default\nnvm uninstall <version>\nnvm use &#91;<version>]\nnvm current\nnvm ls &#91;<version>]\nnvm unload\nnvm which &#91;current | <version>]<\/version><\/version><\/version><\/version><\/version><\/code><\/pre>\n\n\n\n<p>\u6307\u4ee4argument\u4ecb\u7ecd<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>--latest-npm    After installing, attempt to upgrade to the latest working npm on the given node version\n--save    After installing, write the specified version to .nvmrc\n--default    After installing, set default alias to the version specified. (same as: nvm alias default \\<version\\>)<\/code><\/pre>\n\n\n\n<p>\u7528\u4f8b<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>nvm install 8.0.0                     Install a specific version number\n  nvm use 8.0                           Use the latest available 8.0.x release\n  nvm run 6.10.3 app.js                 Run app.js using node 6.10.3\n  nvm exec 4.8.3 node app.js            Run `node app.js` with the PATH pointing to node 4.8.3\n  nvm alias default 8.1.0               Set default node version on a shell\n  nvm alias default node                Always default to the latest available node version on a shell\n\n  nvm install node                      Install the latest available version\n  nvm use node                          Use the latest version\n  nvm install --lts                     Install the latest LTS version\n  nvm use --lts                         Use the latest LTS version<\/code><\/pre>\n\n\n\n<p>Note:<br>to remove, delete, or uninstall nvm - just remove the <code>$NVM_DIR<\/code> folder (usually <code>~\/.nvm<\/code>)<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u82e5\u8981\u66f4\u65b0\u7248\u672c\uff0c\u4f7f\u7528nvm\u5b89\u88c5\u6700\u65b0\u7248\u5373\u53ef \u5e38\u7528\u6307\u4ee4 \u6307\u4ee4argument\u4ecb\u7ecd \u7528\u4f8b Note:to remove, delete,  &#8230;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"emotion":"","emotion_color":"","title_style":"","license":"","footnotes":""},"categories":[2],"tags":[],"class_list":["post-105","post","type-post","status-publish","format-standard","hentry","category-tech"],"_links":{"self":[{"href":"https:\/\/blog.leawsic.site\/index.php\/wp-json\/wp\/v2\/posts\/105","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/blog.leawsic.site\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blog.leawsic.site\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blog.leawsic.site\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/blog.leawsic.site\/index.php\/wp-json\/wp\/v2\/comments?post=105"}],"version-history":[{"count":3,"href":"https:\/\/blog.leawsic.site\/index.php\/wp-json\/wp\/v2\/posts\/105\/revisions"}],"predecessor-version":[{"id":110,"href":"https:\/\/blog.leawsic.site\/index.php\/wp-json\/wp\/v2\/posts\/105\/revisions\/110"}],"wp:attachment":[{"href":"https:\/\/blog.leawsic.site\/index.php\/wp-json\/wp\/v2\/media?parent=105"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.leawsic.site\/index.php\/wp-json\/wp\/v2\/categories?post=105"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.leawsic.site\/index.php\/wp-json\/wp\/v2\/tags?post=105"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}