NuxtJS Commands
In this article, we are going to learn about NuxtJS Commands that are present in the NuxtJS framework. It comes with some useful commands for development and production. All the Nuxtjs commands are described with the output images.
Step 1: You can create a new NuxtJs project using the below command:
npx create-nuxt-app gfg
Step 2: Now navigate to your app using the following command:
cd gfg
Project Structure: It will look like this.
If you open your package.json you can see 4 commands in the script section.
Commands: Let’s look into these commands in detail.
Dev: This command is used to run the development server on your device. You can start the development server by typing the below command in the terminal:
for npm:
npm run dev
for yarn:
yarn dev
Output: In terminal, now you can use your app on localhost on port 3000.
Build: This command will build an optimized version of your app for production. You can start the production build using the below commands in the terminal.
for npm:
npm run build
for yarn:
yarn build
Output:
Generate: This command will build a static version ( HTML files ) of your app for production. You can start the build using the below commands in the terminal.
for npm:
npm run build
for yarn:
yarn build
Output:
Start: This command will start your production build ( static or server). You can start the build using the below commands in the terminal:
Note:To run the start command first you have to build a production build of your application. Otherwise, you will see a “No build found” error.
for npm:
npm run start
- for yarn:
yarn start
Output:
Please Login to comment...