Make sure that you have Node >=10 and NPM >=5 installed on your machine.
WARNING
Do not use uneven versions of Node i.e. 11, 13, etc. These versions are not tested with Quasar and often cause issues due to their experimental nature. We highly recommend always using the LTS version of Node.
# Node.js >=10 is required.
$ yarn global add @quasar/cli
# or
$ npm install -g @quasar/cli
TIP
If you are using Yarn, make sure that the Yarn global install location is in your PATH:
# in ~/.bashrc or equivalent
export PATH="$(yarn global bin):$PATH"
Under Windows, modify user’s PATH environment variable. If you are using yarn then add %LOCALAPPDATA%\yarn\bin
, otherwise if you’re using npm then add %APPDATA%\npm
.
Then we create a project folder with Quasar CLI:
$ yarn create quasar
# or:
$ npm init quasar
# ..then select "App with Quasar CLI" and "Quasar v1" options
TIP
Some advanced scenarios require to use a custom starter kit (eg. testing or personal presets). In those rare cases, you can use --kit
option. Read more about this into create command description. Remember that the recommended way to go is through writing a Quasar App Extension though.
WSL2
Microsoft’s recommended Nodejs development environment setup in WSL2.
When using WSL2 (Windows Subsystem for Linux) Microsoft recommends keeping files in the linux file sytem to maximize performance. Projects will build around 3X slower and HMR (Hot Module Reload) will not work (without a hack) if the project files are on the Windows mount instead of the local linux file system. This is also true in Docker for Windows based development environments.
Note that you don’t need separate projects if you want to build any of the available platforms. This one project can seamlessly handle all of them.
To continue your learning about Quasar, you should familiarize yourself with the Quasar CLI in depth, because you will be using it a lot.
How it works
Quasar CLI is made up of two packages: @quasar/cli
and @quasar/app
. The first one is optional and only allows you to create a project folder and globally run Quasar commands. The second package is the heart of it and it gets installed into every Quasar project folder.
Once a project folder has been generated, Quasar CLI will only help in running @quasar/app
's commands globally. You don’t need it for anything else at this point. To ensure full independence from Quasar CLI you can write npm scripts (in your package.json
) to run Quasar commands. It is @quasar/app
(which is specific to each project) that will run all the CLI commands.
Example of adding a few npm scripts into your package.json
:
// package.json
"scripts": {
"dev": "quasar dev",
"build": "quasar build",
"build:pwa": "quasar build -m pwa"
}
The above will allow you to run $ yarn dev
or $ yarn build
without the need of a globally installed @quasar/cli
, should you wish to do so.
Alternatively, you can even use npx to run quasar commands without the need of a globally installed @quasar/cli
.
$ npx quasar dev