text: "use strict";(globalThis["webpackChunkquasar_dev"]=globalThis["webpackChunkquasar_dev"]||[]).push([[48666],{48666:(a,s,n)=>{n.r(s),n.d(s,{default:()=>sa});var e=n(83673);const o=(0,e._)("p",null,"确保你的机器上安装了Node >=12.22.1和NPM >=6.14.12。",-1),c=(0,e._)("div",{class:"doc-note doc-note--warning"},[(0,e._)("p",{class:"doc-note__title"},"WARNING"),(0,e._)("p",null,[(0,e._)("strong",null,"不要使用奇数的Node版本，如13、15等。"),(0,e.Uk)(" 这些版本没有经过 Quasar 的测试，由于其实验性质，经常会出现问题。我们强烈建议始终使用Node的LTS版本。")])],-1),t=(0,e._)("pre",{class:"doc-code language-bash"},[(0,e._)("code",{class:"doc-code__inner doc-code__inner--prerendered language-bash"},[(0,e._)("span",{class:"token comment"},"# Node.js 版本必须：>=12.22.1"),(0,e.Uk)("\n\n$ "),(0,e._)("span",{class:"token function"},"yarn"),(0,e.Uk)(" global "),(0,e._)("span",{class:"token function"},"add"),(0,e.Uk)(" @quasar/cli\n"),(0,e._)("span",{class:"token comment"},"# or"),(0,e.Uk)("\n$ "),(0,e._)("span",{class:"token function"},"npm"),(0,e.Uk)(),(0,e._)("span",{class:"token function"},"install"),(0,e.Uk)(" -g @quasar/cli\n")])],-1),l={class:"doc-note doc-note--tip"},r=(0,e._)("p",{class:"doc-note__title"},"TIP",-1),p=(0,e.Uk)("如果你使用 yarn，确保 yarn "),d=(0,e.Uk)("全局安装位置"),k=(0,e.Uk)(" 在你的PATH中。"),_=(0,e._)("pre",{class:"doc-code language-bash"},[(0,e._)("code",{class:"doc-code__inner doc-code__inner--prerendered language-bash"},[(0,e._)("span",{class:"token comment"},"# 在 ~/.bashrc 或等效的文件中"),(0,e.Uk)("\n"),(0,e._)("span",{class:"token builtin class-name"},"export"),(0,e.Uk)(),(0,e._)("span",{class:"token assign-left variable"},[(0,e._)("span",{class:"token environment constant"},"PATH")]),(0,e._)("span",{class:"token operator"},"="),(0,e._)("span",{class:"token string"},[(0,e.Uk)('"'),(0,e._)("span",{class:"token variable"},[(0,e._)("span",{class:"token variable"},"$("),(0,e._)("span",{class:"token function"},"yarn"),(0,e.Uk)(" global bin"),(0,e._)("span",{class:"token variable"},")")]),(0,e.Uk)(":"),(0,e._)("span",{class:"token environment constant"},"$PATH"),(0,e.Uk)('"')]),(0,e.Uk)("\n\n"),(0,e._)("span",{class:"token comment"},"# 用于 fish-shell:"),(0,e.Uk)("\n"),(0,e._)("span",{class:"token builtin class-name"},"set"),(0,e.Uk)(" -U fish_user_paths "),(0,e._)("span",{class:"token punctuation"},"("),(0,e.Uk)("yarn global bin"),(0,e._)("span",{class:"token punctuation"},")"),(0,e.Uk)(),(0,e._)("span",{class:"token variable"},"$fish_user_paths"),(0,e.Uk)("\n")])],-1),u=(0,e._)("p",null,[(0,e.Uk)("在 Windows 下，修改用户的 PATH 环境变量。如果你使用 yarn，那么添加"),(0,e._)("code",{class:"doc-token"},"%LOCALAPPDATA%\\yarn\\bin"),(0,e.Uk)("，否则如果你使用npm，那么添加"),(0,e._)("code",{class:"doc-token"},"%APPDATA%\\npm"),(0,e.Uk)("。")],-1),i=(0,e._)("p",null,"然后我们用 Quasar CLI 创建一个项目文件夹。",-1),U=(0,e._)("pre",{class:"doc-code language-bash"},[(0,e._)("code",{class:"doc-code__inner doc-code__inner--prerendered language-bash"},[(0,e._)("span",{class:"token comment"},"## Quasar UI v2"),(0,e.Uk)("\n$ quasar create "),(0,e._)("span",{class:"token operator"},"<"),(0,e.Uk)("folder_name"),(0,e._)("span",{class:"token operator"},">"),(0,e.Uk)("\n")])],-1),m={class:"doc-note doc-note--tip"},g=(0,e._)("p",{class:"doc-note__title"},"TIP",-1),b=(0,e.Uk)("一些"),h=(0,e._)("strong",null,"先进的",-1),f=(0,e.Uk)("情况需要使用自定义的启动套件(例如，测试或个人预设)。在这些"),v=(0,e._)("strong",null,"罕见的",-1),w=(0,e.Uk)("情况下，你可以使用"),y=(0,e._)("code",{class:"doc-token"},"--套件",-1),q=(0,e.Uk)("选项。在"),L=(0,e.Uk)("create command"),Q=(0,e.Uk)(" 描述中阅读更多关于这个的信息。请记住，推荐的方法是通过编写 Quasar 应用扩展来实现。"),C={class:"doc-note doc-note--tip"},I=(0,e._)("p",{class:"doc-note__title"},"WSL2",-1),W=(0,e.Uk)("微软推荐的 "),T=(0,e.Uk)("WSL2中的Nodejs开发环境设置"),j=(0,e.Uk)(" 。"),A=(0,e.Uk)("当使用WSL2(Windows Subsystem for Linux)时，"),P=(0,e.Uk)("微软建议"),$=(0,e.Uk)(" 将文件保留在linux文件系统中，以最大限度地提高性能。 如果项目文件在Windows上而不是在本地Linux文件系统上，项目的构建速度会慢3倍左右，而且HMR(热模块重载)将无法工作("),N=(0,e.Uk)("没有黑客"),x=(0,e.Uk)(" )。 这在基于Windows的Docker开发环境中也是如此。"),H=(0,e._)("p",null,"注意，如果你想建立任何可用的平台，你不需要单独的项目。这一个项目可以无缝地处理所有的项目。",-1),D=(0,e._)("p",null,"为了继续学习 Quasar ，你应该深入地熟悉 Quasar CLI ，因为你会经常使用它。",-1),S=(0,e._)("p",null,[(0,e.Uk)("Quasar CLI 是由两个包组成的。"),(0,e._)("code",{class:"doc-token"},"@quasar/cli"),(0,e.Uk)("和"),(0,e._)("code",{class:"doc-token"},"@quasar/app"),(0,e.Uk)("。第一个包是可选的，只允许你创建一个项目文件夹和全局运行 Quasar 命令。第二个包是它的核心，它被安装到每个 Quasar 项目文件夹中。")],-1),M=(0,e._)("p",null,[(0,e.Uk)("一旦项目文件夹被生成， Quasar CLI 将只帮助全局运行"),(0,e._)("code",{class:"doc-token"},"@quasar/app"),(0,e.Uk)("的命令。在这一点上，你不需要它做其他事情。为了确保完全独立于 Quasar CLI ，你可以编写npm脚本(在你的"),(0,e._)("code",{class:"doc-token"},"package.json"),(0,e.Uk)("中)来运行 Quasar 命令。"),(0,e._)("code",{class:"doc-token"},"@quasar/app"),(0,e.Uk)("(每个项目都有特定的)将运行所有的CLI命令。")],-1),R=(0,e._)("p",null,[(0,e.Uk)("在你的"),(0,e._)("code",{class:"doc-token"},"package.json"),(0,e.Uk)("中添加一些npm脚本的示例。")],-1),E=(0,e._)("pre",{class:"doc-code language-js"},[(0,e._)("code",{class:"doc-code__inner doc-code__inner--prerendered language-js"},[(0,e._)("span",{class:"token comment"},"// package.json"),(0,e.Uk)("\n"),(0,e._)("span",{class:"token string-property property"},'"scripts"'),(0,e._)("span",{class:"token operator"},":"),(0,e.Uk)(),(0,e._)("span",{class:"token punctuation"},"{"),(0,e.Uk)("\n  "),(0,e._)("span",{class:"token string-property property"},'"dev"'),(0,e._)("span",{class:"token operator"},":"),(0,e.Uk)(),(0,e._)("span",{class:"token string"},'"quasar dev"'),(0,e._)("span",{class:"token punctuation"},","),(0,e.Uk)("\n  "),(0,e._)("span",{class:"token string-property property"},'"build"'),(0,e._)("span",{class:"token operator"},":"),(0,e.Uk)(),(0,e._)("span",{class:"token string"},'"quasar build"'),(0,e._)("span",{class:"token punctuation"},","),(0,e.Uk)("\n  "),(0,e._)("span",{class:"token string-property property"},'"build:pwa"'),(0,e._)("span",{class:"token operator"},":"),(0,e.Uk)(),(0,e._)("span",{class:"token string"},'"quasar build -m pwa"'),(0,e.Uk)("\n"),(0,e._)("span",{class:"token punctuation"},"}"),(0,e.Uk)("\n")])],-1),G=(0,e._)("p",null,[(0,e.Uk)("如果你想这样做，上述做法将允许你运行"),(0,e._)("code",{class:"doc-token"},"$ yarn dev"),(0,e.Uk)("或"),(0,e._)("code",{class:"doc-token"},"$ yarn build"),(0,e.Uk)("，而不需要全局安装的"),(0,e._)("code",{class:"doc-token"},"@quasar/cli"),(0,e.Uk)("。")],-1),O=(0,e.Uk)("另外，你甚至可以使用"),Z=(0,e.Uk)("npx"),z=(0,e.Uk)(" 来运行 quasar 命令而不需要全局安装的"),B=(0,e._)("code",{class:"doc-token"},"@quasar/cli",-1),F=(0,e.Uk)("。"),J=(0,e._)("pre",{class:"doc-code language-bash"},[(0,e._)("code",{class:"doc-code__inner doc-code__inner--prerendered language-bash"},"$ npx quasar dev\n")],-1);function K(a,s,n,K,V,X){const Y=(0,e.up)("doc-link"),aa=(0,e.up)("doc-page");return(0,e.wg)(),(0,e.j4)(aa,{"meta-title":K.metaTitle,title:"Quasar CLI 安装",nav:K.nav,toc:K.toc,"meta-desc":K.metaDesc},{default:(0,e.w5)((()=>[o,c,t,(0,e._)("div",l,[r,(0,e._)("p",null,[p,(0,e.Wm)(Y,{to:"https://yarnpkg.com/lang/en/docs/cli/global/"},{default:(0,e.w5)((()=>[d])),_:1}),k]),_,u]),i,U,(0,e._)("div",m,[g,(0,e._)("p",null,[b,h,f,v,w,y,q,(0,e.Wm)(Y,{to:"/quasar-cli/commands-list#create"},{default:(0,e.w5)((()=>[L])),_:1}),Q])]),(0,e._)("div",C,[I,(0,e._)("p",null,[W,(0,e.Wm)(Y,{to:"https://docs.microsoft.com/en-us/windows/nodejs/setup-on-wsl2"},{default:(0,e.w5)((()=>[T])),_:1}),j]),(0,e._)("p",null,[A,(0,e.Wm)(Y,{to:"https://docs.microsoft.com/en-us/windows/wsl/compare-versions#performance-across-os-file-systems"},{default:(0,e.w5)((()=>[P])),_:1}),$,(0,e.Wm)(Y,{to:"/quasar-cli/quasar-conf-js#docker-and-wsl-issues-with-hmr"},{default:(0,e.w5)((()=>[N])),_:1}),x])]),H,D,(0,e._)("h2",{id:"它是如何工作的",class:"doc-heading doc-h2",onClick:s[0]||(s[0]=a=>K.copyHeading("它是如何工作的"))},"它是如何工作的"),S,M,R,E,G,(0,e._)("p",null,[O,(0,e.Wm)(Y,{to:"https://github.com/npm/npx"},{default:(0,e.w5)((()=>[Z])),_:1}),z,B,F]),J])),_:1},8,["meta-title","nav","toc","meta-desc"])}var V=n(17536);const X={name:"DocMarkdownPage",setup(){return{metaTitle:"Quasar CLI 安装",metaDesc:"如何在你的开发机器上安装 Quasar CLI 。",nav:[{name:"报告一个漏洞",category:"安全问题",path:"/security/report-a-vulnerability",dir:"left"},{name:"quasar.conf.js",category:"Quasar CLI",path:"/quasar-cli/quasar-conf-js",dir:"right"}],toc:[{id:"它是如何工作的",title:"它是如何工作的"}],copyHeading:V.Et}}};var Y=n(74260);const aa=(0,Y.Z)(X,[["render",K]]),sa=aa}}]);