{"id":33556,"date":"2024-11-25T09:21:46","date_gmt":"2024-11-25T01:21:46","guid":{"rendered":"https:\/\/fwq.ai\/blog\/33556\/"},"modified":"2024-11-25T09:21:46","modified_gmt":"2024-11-25T01:21:46","slug":"%e5%ad%a6%e4%b9%a0%e5%9c%a8ubuntu-18-04-%e4%b8%8a%e6%90%ad%e5%bb%ba%e5%be%ae%e4%bf%a1%e5%b0%8f%e7%a8%8b%e5%ba%8f%e5%92%8c%e5%85%ac%e4%bc%97%e5%8f%b7%e5%ba%94%e7%94%a8%e5%bc%80%e5%8f%91%e7%8e%af","status":"publish","type":"post","link":"https:\/\/fwq.ai\/blog\/33556\/","title":{"rendered":"\u5b66\u4e60\u5728Ubuntu 18.04 \u4e0a\u642d\u5efa\u5fae\u4fe1\u5c0f\u7a0b\u5e8f\u548c\u516c\u4f17\u53f7\u5e94\u7528\u5f00\u53d1\u73af\u5883"},"content":{"rendered":"<p><img decoding=\"async\" src=\"https:\/\/img.php.cn\/upload\/article\/000\/000\/052\/5f3a425045d49289.jpg\" class=\"aligncenter\" title=\"\u5b66\u4e60\u5728Ubuntu 18.04 \u4e0a\u642d\u5efa\u5fae\u4fe1\u5c0f\u7a0b\u5e8f\u548c\u516c\u4f17\u53f7\u5e94\u7528\u5f00\u53d1\u73af\u5883\u63d2\u56fe\" alt=\"\u5b66\u4e60\u5728Ubuntu 18.04 \u4e0a\u642d\u5efa\u5fae\u4fe1\u5c0f\u7a0b\u5e8f\u548c\u516c\u4f17\u53f7\u5e94\u7528\u5f00\u53d1\u73af\u5883\u63d2\u56fe\" \/><\/p>\n<p>\u3010\u76f8\u5173\u5b66\u4e60\u63a8\u8350\uff1a\u3011<\/p>\n<h1>\u5728Ubuntu 18.04\u4e0a \u642d\u5efa\u5fae\u4fe1\u5c0f\u7a0b\u5e8f\u548c\u516c\u4f17\u53f7\u5e94\u7528\u7684\u5f00\u53d1\u73af\u5883<\/h1>\n<h2>\u5b89\u88c5NVM<\/h2>\n<p>\u5982\u679c\u5728Ubuntu\u4e0a\u4f7f\u7528apt-get\u5b89\u88c5\u4e86Node.js\uff0c\u9700\u8981\u5148\u624b\u52a8\u79fb\u9664\uff1a<\/p>\n<pre>$ sudo apt-get purge nodejs &amp;&amp; sudo apt-get autoremove &amp;&amp; sudo apt-get autoclean<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<p>\u5b89\u88c5NVM\uff1a<\/p>\n<pre>curl -o- https:\/\/raw.githubusercontent.com\/nvm-sh\/nvm\/v0.35.1\/install.sh | bash<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<p>\u6216<\/p>\n<pre>wget -qO- https:\/\/raw.githubusercontent.com\/nvm-sh\/nvm\/v0.35.1\/install.sh | bash<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<p>\u5b89\u88c5\u5b8c\u6bd5\u540e\uff0c\u5c06\u4ee5\u4e0b\u4ee3\u7801\u52a0\u5230~\/.bash_profile, ~\/.zshrc, ~\/.profile, \u6216\u8005 ~\/.bashrc\u4e2d\uff1a<\/p>\n<pre>export NVM_DIR=\"$([ -z \"${XDG_CONFIG_HOME-}\" ] &amp;&amp; printf %s \"${HOME}\/.nvm\" || printf %s \"${XDG_CONFIG_HOME}\/nvm\")\"\n[ -s \"$NVM_DIR\/nvm.sh\" ] &amp;&amp; . \"$NVM_DIR\/nvm.sh\" # This loads nvm<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<p>\u6d4b\u8bd5\uff1a<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/img.php.cn\/upload\/article\/000\/000\/052\/60f9d14fd83378c7a8740056e2b4d0ea-0.png\" class=\"aligncenter\" title=\"\u5b66\u4e60\u5728Ubuntu 18.04 \u4e0a\u642d\u5efa\u5fae\u4fe1\u5c0f\u7a0b\u5e8f\u548c\u516c\u4f17\u53f7\u5e94\u7528\u5f00\u53d1\u73af\u5883\u63d2\u56fe1\" alt=\"\u5b66\u4e60\u5728Ubuntu 18.04 \u4e0a\u642d\u5efa\u5fae\u4fe1\u5c0f\u7a0b\u5e8f\u548c\u516c\u4f17\u53f7\u5e94\u7528\u5f00\u53d1\u73af\u5883\u63d2\u56fe1\" \/><\/p>\n<p><strong>\u4f7f\u7528\u6dd8\u5b9d\u955c\u50cf<\/strong><\/p>\n<pre>export NVM_NODEJS_ORG_MIRROR=http:\/\/npm.taobao.org\/mirrors\/node<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<h2>NVM \u5e38\u7528\u6307\u4ee4<\/h2>\n<p><strong>\u67e5\u770b\u672c\u5730\u6240\u6709\u53ef\u4ee5\u7528\u7684 Node.js \u7248\u672c<\/strong><\/p>\n<pre>$ nvm list<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<p><strong>\u67e5\u770b\u670d\u52a1\u5668\u7aef\u53ef\u7528\u7684 Node.js \u7248\u672c<\/strong><\/p>\n<pre>$ nvm ls-remote<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<p>*<em>\u5b89\u88c5 `8.<\/em>` LTS \u7248\u672c (\u957f\u4e45\u7ef4\u62a4\u7248\u672c) **<\/p>\n<pre>$ nvm install 8.16.2<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<p><strong>\u8bbe\u7f6e\u9ed8\u8ba4\u7248\u672c<\/strong><\/p>\n<pre>$ nvm use  8.16.2\n$ nvm alias default  8.16.2<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<p><strong>\u4f7f\u7528\u6dd8\u5b9d\u8fdb\u884c\u52a0\u901f NPM <\/strong><\/p>\n<pre>$ npm config set registry=https:\/\/registry.npm.taobao.org<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<p><strong>\u5c06 NPM \u66f4\u65b0\u5230\u6700\u65b0<\/strong><\/p>\n<pre>$ npm install -g npm<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<p><strong>\u68c0\u6d4b\u7248\u672c<\/strong><\/p>\n<pre>$ npm -v<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<h2>\u5b89\u88c5Yarn<\/h2>\n<p><strong>\u7b2c\u4e00\u79cd\u65b9\u6cd5\uff1a\u5b89\u88c5\u7a33\u5b9a\u72481.19.1<\/strong><\/p>\n<p>\u914d\u7f6e\u4ed3\u5e93\uff1a<\/p>\n<pre>url -sS https:\/\/dl.yarnpkg.com\/debian\/pubkey.gpg | sudo apt-key add -\necho \"deb https:\/\/dl.yarnpkg.com\/debian\/ stable main\" | sudo tee \/etc\/apt\/sources.list.d\/yarn.list<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<p>\u5b89\u88c5:<\/p>\n<pre>sudo apt-get update &amp;&amp; sudo apt-get install --no-install-recommends yarn<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<p>\u7b2c\u4e8c\u79cd\u65b9\u6cd5\uff1a \u901a\u8fc7npm\u5b89\u88c5<\/p>\n<pre>npm install --global yarn<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<p>\u7136\u540e\u5728\u7ec8\u7aef\u4e2d\u8bbe\u7f6ePATH\u73af\u5883\u53d8\u91cf\uff08\u5373\u628a\u4ee5\u4e0b\u4ee3\u7801\u6dfb\u52a0\u5230 ~\/.bash_profile, ~\/.zshrc, ~\/.profile, \u6216\u8005 ~\/.bashrc\uff09<\/p>\n<pre>export PATH=\"$PATH:`yarn global bin`\"<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<p>\u6700\u540e\u8fd0\u884c\u547d\u4ee4\u6d4b\u8bd5Yarn\u662f\u5426\u5b89\u88c5\u6210\u529f:<\/p>\n<pre>yarn --version<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<p><img decoding=\"async\" src=\"https:\/\/img.php.cn\/upload\/article\/000\/000\/052\/ef28cde4a095cb039bddb7bc2e48652c-1.png\" class=\"aligncenter\" title=\"\u5b66\u4e60\u5728Ubuntu 18.04 \u4e0a\u642d\u5efa\u5fae\u4fe1\u5c0f\u7a0b\u5e8f\u548c\u516c\u4f17\u53f7\u5e94\u7528\u5f00\u53d1\u73af\u5883\u63d2\u56fe2\" alt=\"\u5b66\u4e60\u5728Ubuntu 18.04 \u4e0a\u642d\u5efa\u5fae\u4fe1\u5c0f\u7a0b\u5e8f\u548c\u516c\u4f17\u53f7\u5e94\u7528\u5f00\u53d1\u73af\u5883\u63d2\u56fe2\" \/><\/p>\n<h2>\u5b89\u88c5 Linux\u5fae\u4fe1web\u5f00\u53d1\u8005\u5de5\u5177<\/h2>\n<p><strong>\u4e0b\u8f7d\u9879\u76ee\u548c\u521d\u59cb\u5316<\/strong><\/p>\n<pre>git clone https:\/\/github.com\/cytle\/wechat_web_devtools.git\ncd wechat_web_devtools\n# \u81ea\u52a8\u4e0b\u8f7d\u6700\u65b0 `nw.js` , \u540c\u65f6\u90e8\u7f72\u76ee\u5f55 `~\/.config\/wechat_web_devtools\/`\n.\/bin\/wxdt install<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<p><strong>\u5b89\u88c5Wine<\/strong><\/p>\n<pre>sudo apt-get install wine-binfmt\nsudo update-binfmts --import \/usr\/share\/binfmts\/wine<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<p><strong>\u542f\u52a8ide\uff0c\u5f00\u53d1\u548c\u8c03\u8bd5\u7f51\u9875<\/strong><\/p>\n<pre>.\/bin\/wxdt # \u542f\u52a8<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<p><img decoding=\"async\" src=\"https:\/\/img.php.cn\/upload\/article\/000\/000\/052\/ef28cde4a095cb039bddb7bc2e48652c-2.png\" class=\"aligncenter\" title=\"\u5b66\u4e60\u5728Ubuntu 18.04 \u4e0a\u642d\u5efa\u5fae\u4fe1\u5c0f\u7a0b\u5e8f\u548c\u516c\u4f17\u53f7\u5e94\u7528\u5f00\u53d1\u73af\u5883\u63d2\u56fe3\" alt=\"\u5b66\u4e60\u5728Ubuntu 18.04 \u4e0a\u642d\u5efa\u5fae\u4fe1\u5c0f\u7a0b\u5e8f\u548c\u516c\u4f17\u53f7\u5e94\u7528\u5f00\u53d1\u73af\u5883\u63d2\u56fe3\" \/><\/p>\n<h2>\u5c0f\u7a0b\u5e8f\u57fa\u7840\u73af\u5883\u642d\u5efa<\/h2>\n<p><strong>\u5b89\u88c5wepy-ci<\/strong><\/p>\n<p>WePY \u662f\u4e00\u4e2a\u5c0f\u7a0b\u5e8f\u7ec4\u4ef6\u5316\u5f00\u53d1\u6846\u67b6\uff0c\u5f00\u53d1\u98ce\u683c\u63a5\u8fd1 Vue.js\uff0c\u66f4\u8d34\u8fd1\u4e8e MVVM \u67b6\u6784\u6a21\u5f0f\uff0c\u76f8\u6bd4\u5c0f\u7a0b\u5e8f\u539f\u751f\u5f00\u53d1\u8981\u66f4\u52a0\u7684\u65b9\u4fbf\u5feb\u6377\u3002<\/p>\n<pre>yarn global add wepy-cli<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<p><strong>\u521d\u59cb\u5316\u9879\u76ee<\/strong><\/p>\n<pre>mkdir helloworld\ncd helloworld \nhelloworld  wepy init standard .\/<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<p><img decoding=\"async\" src=\"https:\/\/img.php.cn\/upload\/article\/000\/000\/052\/ef28cde4a095cb039bddb7bc2e48652c-3.png\" class=\"aligncenter\" title=\"\u5b66\u4e60\u5728Ubuntu 18.04 \u4e0a\u642d\u5efa\u5fae\u4fe1\u5c0f\u7a0b\u5e8f\u548c\u516c\u4f17\u53f7\u5e94\u7528\u5f00\u53d1\u73af\u5883\u63d2\u56fe4\" alt=\"\u5b66\u4e60\u5728Ubuntu 18.04 \u4e0a\u642d\u5efa\u5fae\u4fe1\u5c0f\u7a0b\u5e8f\u548c\u516c\u4f17\u53f7\u5e94\u7528\u5f00\u53d1\u73af\u5883\u63d2\u56fe4\" \/><\/p>\n<p>\u5bf9\u9879\u76ee\u8fdb\u884c\u7f16\u8bd1\uff0c\u5e76\u6301\u7eed\u76d1\u542c\u4ee3\u7801\u53d8\u5316**<\/p>\n<pre>wepy build --watch<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<p><img decoding=\"async\" src=\"https:\/\/img.php.cn\/upload\/article\/000\/000\/052\/fc43c650fc60e2ac814970ca711b2358-4.png\" class=\"aligncenter\" title=\"\u5b66\u4e60\u5728Ubuntu 18.04 \u4e0a\u642d\u5efa\u5fae\u4fe1\u5c0f\u7a0b\u5e8f\u548c\u516c\u4f17\u53f7\u5e94\u7528\u5f00\u53d1\u73af\u5883\u63d2\u56fe5\" alt=\"\u5b66\u4e60\u5728Ubuntu 18.04 \u4e0a\u642d\u5efa\u5fae\u4fe1\u5c0f\u7a0b\u5e8f\u548c\u516c\u4f17\u53f7\u5e94\u7528\u5f00\u53d1\u73af\u5883\u63d2\u56fe5\" \/><\/p>\n<blockquote><p>\n  \u76f8\u5173\u5b66\u4e60\u63a8\u8350\uff1a\u5fae\u4fe1\u516c\u4f17\u53f7\u5f00\u53d1\u6559\u7a0b\n<\/p><\/blockquote>\n<p>\u4ee5\u4e0a\u5c31\u662f\u5b66\u4e60\u5728Ubuntu 18.04 \u4e0a\u642d\u5efa\u5fae\u4fe1\u5c0f\u7a0b\u5e8f\u548c\u516c\u4f17\u53f7\u5e94\u7528\u5f00\u53d1\u73af\u5883\u7684\u8be6\u7ec6\u5185\u5bb9\uff0c\u66f4\u591a\u8bf7\u5173\u6ce8\u7c73\u4e91\u5176\u5b83\u76f8\u5173\u6587\u7ae0\uff01<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u3010\u76f8\u5173\u5b66\u4e60\u63a8\u8350\uff1a\u3011 \u5728Ubuntu 18.04\u4e0a \u642d\u5efa\u5fae\u4fe1\u5c0f\u7a0b\u5e8f\u548c\u516c\u4f17\u53f7\u5e94\u7528\u7684\u5f00\u53d1\u73af\u5883 \u5b89\u88c5NVM \u5982\u679c\u5728Ubuntu\u4e0a\u4f7f\u7528apt-get\u5b89\u88c5\u4e86Node.js\uff0c\u9700\u8981\u5148\u624b\u52a8\u79fb\u9664\uff1a $ sudo apt-get purge nodejs &amp;&amp; sudo apt-get autoremove &amp;&amp; sudo apt-get autoclean \u767b\u5f55\u540e\u590d\u5236 \u5b89\u88c5NVM\uff1a curl -o- https:\/\/raw.githubusercontent.com\/nvm-sh\/nvm\/v0.35.1\/install.sh | bash \u767b\u5f55\u540e\u590d\u5236 \u6216 wget -qO- https:\/\/raw.githubusercontent.com\/nvm-sh\/nvm\/v0.35.1\/install.sh | bash \u767b\u5f55\u540e\u590d\u5236 \u5b89\u88c5\u5b8c\u6bd5\u540e\uff0c\u5c06\u4ee5\u4e0b\u4ee3\u7801\u52a0\u5230~\/.bash_profile, ~\/.zshrc, ~\/.profile, \u6216\u8005 ~\/.bashrc\u4e2d\uff1a export NVM_DIR=&#8221;$([ -z &#8220;${XDG_CONFIG_HOME-}&#8221; ] &amp;&amp; printf %s &#8220;${HOME}\/.nvm&#8221; || printf %s &#8220;${XDG_CONFIG_HOME}\/nvm&#8221;)&#8221; [ -s &#8220;$NVM_DIR\/nvm.sh&#8221; [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[19],"tags":[],"class_list":["post-33556","post","type-post","status-publish","format-standard","hentry","category-19"],"_links":{"self":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/33556","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/comments?post=33556"}],"version-history":[{"count":0,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/33556\/revisions"}],"wp:attachment":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/media?parent=33556"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/categories?post=33556"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/tags?post=33556"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}