{"id":288938,"date":"2023-12-15T21:12:10","date_gmt":"2023-12-15T13:12:10","guid":{"rendered":"https:\/\/lrxjmw.cn\/nqskfwyydsqk.html"},"modified":"2023-12-15T21:12:10","modified_gmt":"2023-12-15T13:12:10","slug":"nqskfwyydsqk","status":"publish","type":"post","link":"https:\/\/lrxjmw.cn\/nqskfwyydsqk.html","title":{"rendered":"Node.js\uff1a\u8f7b\u677e\u5f00\u53d1Web\u5e94\u7528\u7684\u795e\u5668\uff0c\u5feb\u901f\u5b89\u88c5\u6559\u7a0b\u89e3\u5bc6"},"content":{"rendered":"

\u4e00\u3001\u4ec0\u4e48\u662fNode.js\uff1f<\/b><\/p>\n

Node.js\u4f5c\u4e3a\u4e00\u6b3e\u57fa\u4e8eChrome V8\u5f15\u64ce\u6784\u5efa\uff0c\u6781\u4e3a\u9ad8\u6548\u7684JavaScript\u8fd0\u884c\u73af\u5883\uff0c\u56e0\u5176\u5f3a\u5927\u3001\u9ad8\u6548\u3001\u8f7b\u4fbf\u4e14\u6613\u4e8e\u62d3\u5c55\u7b49\u4f18\u70b9\uff0c\u8d62\u5f97\u4e86\u5e7f\u5927Web\u5f00\u53d1\u8005\u7684\u559c\u7231\u548c\u8d5e\u8a89linux\u6570\u636e\u6062\u590d\uff0c\u4e3a\u4ed6\u4eec\u63d0\u4f9b\u4e86\u6781\u5177\u4f18\u52bf\u7684\u9009\u62e9\u548c\u5353\u8d8a\u7684\u8d21\u732e\u3002<\/p>\n

\u4e8c\u3001\u4e3a\u4ec0\u4e48\u8981\u5b89\u88c5<\/a>Node.js\uff1f<\/b><\/p>\n

Node.js\u52a9\u60a8\u8f7b\u677e\u5f00\u53d1\u5404\u7c7b\u5e94\u7528\uff0c\u4f8b\u5982Web\u670d\u52a1\u5668\u6216\u547d\u4ee4<\/a>\u884c\u5de5\u5177\u54e6\uff01<\/p>\n

\u4e09\u3001\u5982\u4f55\u5b89\u88c5Node.js\uff1f<\/b><\/p>\n

1.\u6253\u5f00\u7ec8\u7aef\uff0c\u8f93\u5165\u4ee5\u4e0b\u547d\u4ee4\u4e0b\u8f7dNode.js\u5b89\u88c5\u5305\uff1a<\/p>\n

```<\/p>\n

\u5c0a\u656c\u7684\u8bfb\u8005\uff0c\u6211\u4eec\u671f\u5f85\u60a8\u80fd\u591f\u4f7f\u7528wget\u5de5\u5177\u4ece\u7f51\u7ad9\u4e0a\u4e0b\u8f7d\u5e76\u4fdd\u5b58\u540d\u79f0\u4e3a node-v14.17.0-linux-x64.tar.gz \u7684Node.js v14.17.0 Linux<\/a> x64\u7248\u672c\u7684\u6587\u4ef6\u538b\u7f29\u5305\u3002<\/p>\n

2.\u89e3\u538b\u5b89\u88c5\u5305\uff1a<\/p>\n

\u656c\u7231\u7684\u7528\u6237\uff0c\u8bf7\u91c7\u7eb3\u6b64\u7b80\u5355\u7684\u547d\u4ee4\u5373\u53ef\u8f7b\u677e\u91ca\u653eNode v14.17.0-Linux-x64.tar.gz\u7684\u6253\u5305\u6587\u4ef6\uff1a\u4ec5\u9700\u8f93\u5165tar -zxvf\u5373\u53ef\u3002<\/p>\n

3.\u5c06\u89e3\u538b\u5f97\u5230\u7684\u6587\u4ef6\u5939\u79fb\u52a8\u5230\/opt\u76ee\u5f55\u4e0b\uff1a<\/p>\n

\u611f\u8c22\u60a8\u7684\u914d\u5408\uff0c\u70e6\u8bf7\u5c06'stare-v14.17.0-linux-x64'\u6587\u4ef6\u5939\u79fb\u52a8\u81f3'\/opt\/'\u3002<\/p>\n

4.\u914d\u7f6e\u73af\u5883\u53d8\u91cf\uff1a<\/p>\n

\u6253\u5f00\u7ec8\u7aef\uff0c\u8f93\u5165\u4ee5\u4e0b\u547d\u4ee4\u7f16\u8f91.bashrc\u6587\u4ef6\uff1a<\/p>\n

vi ~\/.bashrc<\/p>\n

\u5728\u6587\u4ef6\u672b\u5c3e\u6dfb\u52a0\u4ee5\u4e0b\u5185\u5bb9\u5e76\u4fdd\u5b58\uff1a<\/p>\n

\u4eb2\u7231\u7684\u7528\u6237\uff0c\u4e3a\u4fdd\u8bc1\u7cfb\u7edf<\/a>\u7a33\u5b9a\uff0c\u656c\u8bf7\u5c06$PATH\u73af\u5883\u53d8\u91cf\u66f4\u6539\u4e3a\uff1a\"\/opt\/node-v14.17.0-linux-x64\/bin\"+\u539f\u6709\u8def\u5f84\u3002<\/p>\n

\u6267\u884c\u4ee5\u4e0b\u547d\u4ee4\u4f7f\u914d\u7f6e\u751f\u6548\uff1a<\/p>\n

source ~\/.bashrc<\/p>\n

\u56db\u3001\u5982\u4f55\u9a8c\u8bc1Node.js\u662f\u5426\u5b89\u88c5\u6210\u529f\uff1f<\/b><\/p>\n

1.\u6253\u5f00\u7ec8\u7aef\uff0c\u8f93\u5165\u4ee5\u4e0b\u547d\u4ee4\u67e5\u770bNode.js\u7248\u672c\uff1a<\/p>\n

node -v<\/p>\n

\u5982\u679c\u6210\u529f\u5b89\u88c5\uff0c\u5c06\u663e\u793a\u5b89\u88c5\u7684Node.js\u7248\u672c\u53f7\u3002<\/p>\n

2.\u8f93\u5165\u4ee5\u4e0b\u547d\u4ee4\u67e5\u770bnpm\uff08Node\u5305\u7ba1\u7406\u5668\uff09\u7248\u672c\uff1a<\/p>\n

npm -v<\/p>\n

\u5982\u679c\u6210\u529f\u5b89\u88c5\uff0c\u5c06\u663e\u793a\u5b89\u88c5\u7684npm\u7248\u672c\u53f7\u3002<\/p>\n

\u4e94\u3001\u5982\u4f55\u5347\u7ea7Node.js\uff1f<\/b><\/p>\n

1.\u9996\u5148\uff0c\u5378\u8f7d\u65e7\u7248\u672c\u7684Node.js\uff1a<\/p>\n

\u6253\u5f00\u7ec8\u7aef\uff0c\u8f93\u5165\u4ee5\u4e0b\u547d\u4ee4\uff1a<\/p>\n

\u5c0a\u656c\u7684\u7528\u6237linux\u4fee\u6539\u6587\u4ef6\u540d\uff0c\u5982\u60a8\u9700\u8981\u5220\u9664\/opt\/node-v14.17.0-linux-x64\u76ee\u5f55\u4e2d\u7684\u6240\u6709\u6587\u4ef6\uff0c\u53ef\u8bd5\u7740\u8fd0\u884c\u4e0b\u8ff0\u6307\u4ee4\uff1a\".\/sudo rm -Rf \/opt\/node-v14.17.0-linux-x64\/\"\u3002\u6b64\u64cd\u4f5c\u5c06\u786e\u4fdd\u60a8\u6570\u636e\u7684\u5b89\u5168\u65e0\u865e\u3002<\/p>\n

2.\u7136\u540e\uff0c\u6309\u7167\u4e0a\u8ff0\u6b65\u9aa4\u91cd\u65b0\u5b89\u88c5\u6700\u65b0\u7248\u7684Node.js\u3002<\/p>\n

\u516d\u3001\u5982\u4f55\u5378\u8f7dNode.js\uff1f<\/b><\/p>\n

1.\u6253\u5f00\u7ec8\u7aef\uff0c\u8f93\u5165\u4ee5\u4e0b\u547d\u4ee4\u5378\u8f7dNode.js\uff1a<\/p>\n

2.\u7f16\u8f91.bashrc\u6587\u4ef6\uff0c\u5220\u9664\u4e4b\u524d\u914d\u7f6e\u7684\u73af\u5883\u53d8\u91cf\uff1a<\/p>\n

\u5220\u9664\u4ee5\u4e0b\u5185\u5bb9\u5e76\u4fdd\u5b58\uff1a<\/p>\n

\u4e03\u3001\u5982\u4f55\u4f7f\u7528\u6dd8\u5b9d\u955c\u50cf\u63d0\u9ad8npm\u4e0b\u8f7d\u901f\u5ea6\uff1f<\/b><\/p>\n

1.\u6253\u5f00\u7ec8\u7aeflinux nodejs\u5b89\u88c5<\/strong>\uff0c\u8f93\u5165\u4ee5\u4e0b\u547d\u4ee4\u914d\u7f6e\u6dd8\u5b9d\u955c\u50cf\uff1a<\/p>\n

\u63d0\u9192\u60a8\u8bf7\u81ea\u89c9\u5c06npm\u4f9d\u8d56\u5e93\u6307\u5411\uff0c\u611f\u8c22\u60a8\u7684\u914d\u5408\uff01<\/p>\n

2.\u9a8c\u8bc1\u662f\u5426\u914d\u7f6e\u6210\u529f\uff1a<\/p>\n

\u8f93\u5165\u4ee5\u4e0b\u547d\u4ee4\u67e5\u770bnpm\u955c\u50cf\u5730\u5740\uff1a<\/p>\n

npm config get registry<\/p>\n

\u82e5\u662f\u770b\u5230\u8fd9\u6837\u7684\u94fe\u63a5\uff0c\u771f\u4e3a\u60a8\u9ad8\u5174\uff01\u8bc1\u660e\u5df2\u6210\u529f\u5b8c\u6210\u914d\u7f6e\u8fc7\u7a0b\u3002<\/p>\n

\u516b\u3001\u5982\u4f55\u5b89\u88c5\u5168\u5c40\u6a21\u5757\uff1f<\/b><\/p>\n

1.\u6253\u5f00\u7ec8\u7aef\uff0c\u8f93\u5165\u4ee5\u4e0b\u547d\u4ee4\u5b89\u88c5\u5168\u5c40\u6a21\u5757\uff1a<\/p>\n

npm install -g\u6a21\u5757\u540d<\/p>\n

\u5176\u4e2d\uff0c\u6a21\u5757\u540d\u4e3a\u9700\u8981\u5b89\u88c5\u7684\u5168\u5c40\u6a21\u5757\u540d\u79f0\u3002<\/p>\n

2.\u5b89\u88c5\u5b8c\u6210\u540elinux nodejs\u5b89\u88c5<\/strong>\uff0c\u53ef\u4ee5\u5728\u4efb\u610f\u76ee\u5f55\u4e0b\u4f7f\u7528\u8be5\u5168\u5c40\u6a21\u5757\u3002<\/p>\n

\u4e5d\u3001\u5982\u4f55\u5b89\u88c5\u9879\u76ee\u4f9d\u8d56\uff1f<\/b><\/p>\n

1.\u6253\u5f00\u7ec8\u7aef\uff0c\u8fdb\u5165\u9879\u76ee\u6839\u76ee\u5f55\u3002<\/p>\n

2.\u8f93\u5165\u4ee5\u4e0b\u547d\u4ee4\u5b89\u88c5\u9879\u76ee\u4f9d\u8d56\uff1a<\/p>\n

npm install<\/p>\n

Node.js\u5c06\u81ea\u52a8\u4e0b\u8f7d\u5e76\u5b89\u88c5\u9879\u76ee\u6240\u9700\u7684\u6240\u6709\u4f9d\u8d56\u3002<\/p>\n

\u5341\u3001\u5982\u4f55\u66f4\u65b0\u9879\u76ee\u4f9d\u8d56\uff1f<\/b><\/p>\n

2.\u8f93\u5165\u4ee5\u4e0b\u547d\u4ee4\u66f4\u65b0\u9879\u76ee\u4f9d\u8d56\uff1a<\/p>\n

npm update<\/p>\n

Node.js\u5c06\u81ea\u52a8\u68c0\u67e5\u5e76\u66f4\u65b0\u9879\u76ee\u6240\u9700\u7684\u4f9d\u8d56\u3002<\/p>\n

\u6b64\u7bc7\u6559\u7a0b\u5c06\u4e3a\u60a8\u4ecb\u7ecd\u5982\u4f55\u4fbf\u6377\u5730\u5728Linux\u73af\u5883\u4e0b\u5b89\u88c5\u5e76\u8fd0\u7528Node.js\u3002\u613f\u60a8\u5728\u6b64\u5b66\u4e60\u548c\u5b9e\u8df5Node.js\u7684\u65c5\u9014\u4e2d\u6536\u83b7\u6ee1\u6ee1\uff0c\u6109\u5feb\u65e0\u9650\uff01<\/p>\n","protected":false},"excerpt":{"rendered":"

js\u52a9\u60a8\u8f7b\u677e\u5f00\u53d1\u5404\u7c7b\u5e94\u7528\uff0c\u4f8b\u5982Web\u670d\u52a1\u5668\u6216\u547d\u4ee4\u884c\u5de5\u5177\u54e6\uff01\u8f93\u5165\u4ee5\u4e0b\u547d\u4ee4\u67e5\u770bnpm\uff08Node\u5305\u7ba1\u7406\u5668\uff09\u7248\u672c\uff1a\u5982\u679c\u6210\u529f\u5b89\u88c5\uff0c\u5c06\u663e\u793a\u5b89\u88c5\u7684npm\u7248\u672c\u53f7\u3002\u4e03\u3001\u5982\u4f55\u4f7f\u7528\u6dd8\u5b9d\u955c\u50cf\u63d0\u9ad8npm\u4e0b\u8f7d\u901f\u5ea6\uff1fjs\u5c06\u81ea\u52a8\u4e0b\u8f7d\u5e76\u5b89\u88c5\u9879\u76ee\u6240\u9700\u7684\u6240\u6709\u4f9d\u8d56\u3002\u6b64\u7bc7\u6559\u7a0b\u5c06\u4e3a\u60a8\u4ecb\u7ecd\u5982\u4f55\u4fbf\u6377\u5730\u5728Linux\u73af\u5883\u4e0b\u5b89\u88c5\u5e76\u8fd0\u7528Node.<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[988],"tags":[999],"class_list":["post-288938","post","type-post","status-publish","format-standard","hentry","category-tougao","tag-999"],"acf":[],"_links":{"self":[{"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/posts\/288938","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/comments?post=288938"}],"version-history":[{"count":0,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/posts\/288938\/revisions"}],"wp:attachment":[{"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/media?parent=288938"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/categories?post=288938"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/tags?post=288938"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}