{"id":32034,"date":"2024-09-22T21:53:39","date_gmt":"2024-09-22T16:23:39","guid":{"rendered":"https:\/\/codeforgeek.com\/?p=32034"},"modified":"2024-09-22T21:53:40","modified_gmt":"2024-09-22T16:23:40","slug":"nextjs-cli","status":"publish","type":"post","link":"https:\/\/codeforgeek.com\/nextjs-cli\/","title":{"rendered":"Next.js CLI: Commands You Must Know"},"content":{"rendered":"\n<p>Next.js provides a command line interface using which we can save our time spent in building and configuring a Next.js app. These include commands to start a local development server, change the default port, run ESLint, generate static HTML files and much more. Let&#8217;s start exploring these commands to increase our productivity!<\/p>\n\n\n\n<p><a href=\"https:\/\/codeforgeek.com\/nextjs-deploying-to-vercel\/\" data-type=\"link\" data-id=\"https:\/\/codeforgeek.com\/nextjs-deploying-to-vercel\/\">Ready to deploy your Next.js app to Vercel? Click here for a quick guide.<\/a><\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Getting Started with Next.js CLI<\/h2>\n\n\n\n<p>To test Next.js CLI commands we first need a demo Next.js app. Let&#8217;s create one in a few easy steps.<\/p>\n\n\n\n<p><strong>Step 1:<\/strong> Make sure that <strong>Node.js version 18.17 <\/strong>or higher is installed on your system<\/p>\n\n\n\n<figure class=\"wp-block-image aligncenter size-full\"><img decoding=\"async\" width=\"538\" height=\"135\" src=\"https:\/\/codeforgeek.com\/wp-content\/uploads\/2024\/08\/image-7.png\" alt=\"Checking Node.js version\" class=\"wp-image-31616\" srcset=\"https:\/\/codeforgeek.com\/wp-content\/uploads\/2024\/08\/image-7.png 538w, https:\/\/codeforgeek.com\/wp-content\/uploads\/2024\/08\/image-7-300x75.png 300w\" sizes=\"(max-width: 538px) 100vw, 538px\" \/><\/figure>\n\n\n\n<p><strong>Step 2: <\/strong>Open the terminal and run the below command to initialize a new Next.js app:<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: bash; title: ; notranslate\" title=\"\">\nnpx create-next-app@latest\n<\/pre><\/div>\n\n\n<p>Choose any project name you want &#8211; <strong>all in lowercase<\/strong>, <strong>use hyphens (\u2013) for space<\/strong>, and <strong>no whitespace<\/strong>.<\/p>\n\n\n\n<p>For the other parameters let&#8217;s go with the default option for now. Just check &#8220;Yes&#8221; for both TypeScript and App Router to follow along with us.<\/p>\n\n\n\n<figure class=\"wp-block-image aligncenter size-full\"><img decoding=\"async\" width=\"742\" height=\"250\" src=\"https:\/\/codeforgeek.com\/wp-content\/uploads\/2024\/08\/image-85.png\" alt=\"Initialize a new Next.js app\" class=\"wp-image-31942\" srcset=\"https:\/\/codeforgeek.com\/wp-content\/uploads\/2024\/08\/image-85.png 742w, https:\/\/codeforgeek.com\/wp-content\/uploads\/2024\/08\/image-85-300x101.png 300w\" sizes=\"(max-width: 742px) 100vw, 742px\" \/><\/figure>\n\n\n\n<p>Once the project is set up, you will get the project path:<\/p>\n\n\n\n<figure class=\"wp-block-image aligncenter size-full\"><img decoding=\"async\" width=\"997\" height=\"740\" src=\"https:\/\/codeforgeek.com\/wp-content\/uploads\/2024\/08\/image-86.png\" alt=\"Copy the project path\" class=\"wp-image-31943\" srcset=\"https:\/\/codeforgeek.com\/wp-content\/uploads\/2024\/08\/image-86.png 997w, https:\/\/codeforgeek.com\/wp-content\/uploads\/2024\/08\/image-86-300x223.png 300w, https:\/\/codeforgeek.com\/wp-content\/uploads\/2024\/08\/image-86-768x570.png 768w\" sizes=\"(max-width: 997px) 100vw, 997px\" \/><\/figure>\n\n\n\n<p><strong>Step 3:<\/strong> Copy the project path and navigate to it:<\/p>\n\n\n\n<figure class=\"wp-block-image aligncenter size-full\"><img decoding=\"async\" width=\"683\" height=\"47\" src=\"https:\/\/codeforgeek.com\/wp-content\/uploads\/2024\/08\/image-87.png\" alt=\"Navigate to the project path\" class=\"wp-image-31944\" srcset=\"https:\/\/codeforgeek.com\/wp-content\/uploads\/2024\/08\/image-87.png 683w, https:\/\/codeforgeek.com\/wp-content\/uploads\/2024\/08\/image-87-300x21.png 300w\" sizes=\"(max-width: 683px) 100vw, 683px\" \/><\/figure>\n\n\n\n<p><strong>Step 4:<\/strong> Once the project is set up, open it inside a code editor and remove all the files inside the&nbsp;<strong>app<\/strong>&nbsp;directory and create a <strong>page.tsx<\/strong> file with the following code:<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: jscript; title: ; notranslate\" title=\"\">\nconst Main = () =&gt; {\n    return &lt;h1&gt;Hello World!&lt;\/h1&gt;;\n};\n\nexport default Main;\n<\/pre><\/div>\n\n\n<p><strong>Step 5:<\/strong> Now execute the below command to test the application:<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: bash; title: ; notranslate\" title=\"\">\nnpm run dev\n<\/pre><\/div>\n\n\n<figure class=\"wp-block-image aligncenter size-full\"><img decoding=\"async\" width=\"557\" height=\"180\" src=\"https:\/\/codeforgeek.com\/wp-content\/uploads\/2024\/08\/image-88.png\" alt=\"Test the application\" class=\"wp-image-31945\" srcset=\"https:\/\/codeforgeek.com\/wp-content\/uploads\/2024\/08\/image-88.png 557w, https:\/\/codeforgeek.com\/wp-content\/uploads\/2024\/08\/image-88-300x97.png 300w\" sizes=\"(max-width: 557px) 100vw, 557px\" \/><\/figure>\n\n\n\n<p>Here we are running the development server which listens on&nbsp;&#8220;http:\/\/localhost:3000&#8221;:<\/p>\n\n\n\n<figure class=\"wp-block-image aligncenter size-large\"><img decoding=\"async\" width=\"1024\" height=\"565\" src=\"https:\/\/codeforgeek.com\/wp-content\/uploads\/2024\/08\/image-89-1024x565.png\" alt=\"Next.js app output\" class=\"wp-image-31946\" srcset=\"https:\/\/codeforgeek.com\/wp-content\/uploads\/2024\/08\/image-89-1024x565.png 1024w, https:\/\/codeforgeek.com\/wp-content\/uploads\/2024\/08\/image-89-300x165.png 300w, https:\/\/codeforgeek.com\/wp-content\/uploads\/2024\/08\/image-89-768x423.png 768w, https:\/\/codeforgeek.com\/wp-content\/uploads\/2024\/08\/image-89.png 1061w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<blockquote class=\"wp-block-quote is-layout-flow wp-block-quote-is-layout-flow\">\n<p>The &#8220;create-next-app&#8221; we used above is also a Next.js CLI tool that is used to initiate a new Next.js application with a default template (which we did) or from the Next.js GitHub repository.<\/p>\n<\/blockquote>\n\n\n\n<h2 class=\"wp-block-heading\">How to Execute Next.js CLI Commands<\/h2>\n\n\n\n<p>If you directly try to execute these Next.js CLI commands, like let&#8217;s run &#8220;next dev&#8221;, you will see the system says it is not found:<\/p>\n\n\n\n<figure class=\"wp-block-image aligncenter size-large\"><img decoding=\"async\" width=\"1024\" height=\"164\" src=\"https:\/\/codeforgeek.com\/wp-content\/uploads\/2024\/09\/image-58-1024x164.png\" alt=\"next dev\" class=\"wp-image-32223\" srcset=\"https:\/\/codeforgeek.com\/wp-content\/uploads\/2024\/09\/image-58-1024x164.png 1024w, https:\/\/codeforgeek.com\/wp-content\/uploads\/2024\/09\/image-58-300x48.png 300w, https:\/\/codeforgeek.com\/wp-content\/uploads\/2024\/09\/image-58-768x123.png 768w, https:\/\/codeforgeek.com\/wp-content\/uploads\/2024\/09\/image-58-1536x246.png 1536w, https:\/\/codeforgeek.com\/wp-content\/uploads\/2024\/09\/image-58.png 1572w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<p>This is because when we install Next.js, it is installed for that particular project inside the node_modules folder. This makes the next commands accessible within that project but not globally.<\/p>\n\n\n\n<p>So either you install Next.js globally using the command &#8220;npm install -g next&#8221; or using the NPX.<\/p>\n\n\n\n<p><strong>Installing Next.js globally:<\/strong><\/p>\n\n\n\n<figure class=\"wp-block-image aligncenter size-full\"><img decoding=\"async\" width=\"742\" height=\"245\" src=\"https:\/\/codeforgeek.com\/wp-content\/uploads\/2024\/09\/image-59.png\" alt=\"Installing Next.js globally\" class=\"wp-image-32224\" srcset=\"https:\/\/codeforgeek.com\/wp-content\/uploads\/2024\/09\/image-59.png 742w, https:\/\/codeforgeek.com\/wp-content\/uploads\/2024\/09\/image-59-300x99.png 300w\" sizes=\"(max-width: 742px) 100vw, 742px\" \/><\/figure>\n\n\n\n<p><strong>Now run &#8220;next dev&#8221; again:<\/strong><\/p>\n\n\n\n<figure class=\"wp-block-image aligncenter size-full\"><img decoding=\"async\" width=\"507\" height=\"126\" src=\"https:\/\/codeforgeek.com\/wp-content\/uploads\/2024\/09\/image-60.png\" alt=\" Running next dev again\" class=\"wp-image-32225\" srcset=\"https:\/\/codeforgeek.com\/wp-content\/uploads\/2024\/09\/image-60.png 507w, https:\/\/codeforgeek.com\/wp-content\/uploads\/2024\/09\/image-60-300x75.png 300w\" sizes=\"(max-width: 507px) 100vw, 507px\" \/><\/figure>\n\n\n\n<p>See, it works.<\/p>\n\n\n\n<p><strong>Using NPX:<\/strong><\/p>\n\n\n\n<p>NPX comes with npm version 5.2.0+ which lets us execute binaries from the node_modules\/.bin directory.&nbsp;<\/p>\n\n\n\n<p>So it means if we run the command &#8220;npx next dev&#8221;, NPX search the local node_modules\/.bin directory for the next binary and executes it. So eventually we don&#8217;t have to install Next.js globally.<\/p>\n\n\n\n<figure class=\"wp-block-image aligncenter size-full\"><img decoding=\"async\" width=\"538\" height=\"132\" src=\"https:\/\/codeforgeek.com\/wp-content\/uploads\/2024\/09\/image-61.png\" alt=\"Using NPX\" class=\"wp-image-32226\" srcset=\"https:\/\/codeforgeek.com\/wp-content\/uploads\/2024\/09\/image-61.png 538w, https:\/\/codeforgeek.com\/wp-content\/uploads\/2024\/09\/image-61-300x74.png 300w\" sizes=\"(max-width: 538px) 100vw, 538px\" \/><\/figure>\n\n\n\n<p>The choice is yours but for this tutorial, we will use NPX as it comes with npm and is available on most computers.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Next CLI Commands&nbsp;<\/h2>\n\n\n\n<p>Let&#8217;s demonstrate the highly used Next.js CLI commands.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">1. next dev<\/h3>\n\n\n\n<p>This is the most common command and we have also used this to start a development server. It works like &#8220;nodemon&#8221; and updates the server as soon as we change anything in the code.<\/p>\n\n\n\n<figure class=\"wp-block-image aligncenter size-full\"><img decoding=\"async\" width=\"567\" height=\"170\" src=\"https:\/\/codeforgeek.com\/wp-content\/uploads\/2024\/09\/image-62.png\" alt=\"next dev\" class=\"wp-image-32228\" srcset=\"https:\/\/codeforgeek.com\/wp-content\/uploads\/2024\/09\/image-62.png 567w, https:\/\/codeforgeek.com\/wp-content\/uploads\/2024\/09\/image-62-300x90.png 300w\" sizes=\"(max-width: 567px) 100vw, 567px\" \/><\/figure>\n\n\n\n<blockquote class=\"wp-block-quote is-layout-flow wp-block-quote-is-layout-flow\">\n<p>For each Next.js CLI command, we can use the &#8220;-h or &#8211;help&#8221; option to list all the available options and flags we can use with that command.<\/p>\n\n\n\n<figure class=\"wp-block-image aligncenter size-large\"><img decoding=\"async\" width=\"1024\" height=\"272\" src=\"https:\/\/codeforgeek.com\/wp-content\/uploads\/2024\/09\/image-63-1024x272.png\" alt=\"--help option\" class=\"wp-image-32229\" srcset=\"https:\/\/codeforgeek.com\/wp-content\/uploads\/2024\/09\/image-63-1024x272.png 1024w, https:\/\/codeforgeek.com\/wp-content\/uploads\/2024\/09\/image-63-300x80.png 300w, https:\/\/codeforgeek.com\/wp-content\/uploads\/2024\/09\/image-63-768x204.png 768w, https:\/\/codeforgeek.com\/wp-content\/uploads\/2024\/09\/image-63.png 1233w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n<\/blockquote>\n\n\n\n<p>One interesting option among them is the &#8220;-p or &#8211;port &lt;port&gt;&#8221;, which can be used to change the default port from 3000 to whatever we want.<\/p>\n\n\n\n<figure class=\"wp-block-image aligncenter size-full\"><img decoding=\"async\" width=\"635\" height=\"147\" src=\"https:\/\/codeforgeek.com\/wp-content\/uploads\/2024\/09\/image-64.png\" alt=\"--port <port&gt;option\" class=\"wp-image-32230\" srcset=\"https:\/\/codeforgeek.com\/wp-content\/uploads\/2024\/09\/image-64.png 635w, https:\/\/codeforgeek.com\/wp-content\/uploads\/2024\/09\/image-64-300x69.png 300w\" sizes=\"(max-width: 635px) 100vw, 635px\" \/><\/figure>\n\n\n\n<p><strong>Note: <\/strong>The -p option can also be used with &#8220;next start&#8221;.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">2. next build<\/h3>\n\n\n\n<p>This command is used when our Next.js app is completed and ready to be deployed. It generates a production build or we can say an optimized version of the application in the .next folder.\u00a0<\/p>\n\n\n\n<figure class=\"wp-block-image aligncenter size-full\"><img decoding=\"async\" width=\"825\" height=\"437\" src=\"https:\/\/codeforgeek.com\/wp-content\/uploads\/2024\/09\/image-65.png\" alt=\"next build\" class=\"wp-image-32232\" srcset=\"https:\/\/codeforgeek.com\/wp-content\/uploads\/2024\/09\/image-65.png 825w, https:\/\/codeforgeek.com\/wp-content\/uploads\/2024\/09\/image-65-300x159.png 300w, https:\/\/codeforgeek.com\/wp-content\/uploads\/2024\/09\/image-65-768x407.png 768w\" sizes=\"(max-width: 825px) 100vw, 825px\" \/><\/figure>\n\n\n\n<h3 class=\"wp-block-heading\">3. next start<\/h3>\n\n\n\n<p>After building the application for production, we can use this command to run the optimized application. It starts a Node.js server that serves the production build.<\/p>\n\n\n\n<figure class=\"wp-block-image aligncenter size-full\"><img decoding=\"async\" width=\"542\" height=\"141\" src=\"https:\/\/codeforgeek.com\/wp-content\/uploads\/2024\/09\/image-66.png\" alt=\"next start\" class=\"wp-image-32233\" srcset=\"https:\/\/codeforgeek.com\/wp-content\/uploads\/2024\/09\/image-66.png 542w, https:\/\/codeforgeek.com\/wp-content\/uploads\/2024\/09\/image-66-300x78.png 300w\" sizes=\"(max-width: 542px) 100vw, 542px\" \/><\/figure>\n\n\n\n<h3 class=\"wp-block-heading\">4. next export<\/h3>\n\n\n\n<p>This command exports the Next.js app as a static site, but this has been removed in favour of &#8220;output&#8221;: &#8220;export&#8221; in Next.js v14.0.0.<\/p>\n\n\n\n<p>Now to export static assets, you need to modify the output mode to &#8220;export&#8221; in the &#8216;next.config.js&#8217; or &#8216;next.config.mjs&#8217; file located in your project directory:<\/p>\n\n\n\n<figure class=\"wp-block-image aligncenter size-full\"><img decoding=\"async\" width=\"877\" height=\"317\" src=\"https:\/\/codeforgeek.com\/wp-content\/uploads\/2024\/07\/image-49.png\" alt=\"Changing Output Mode to Export\" class=\"wp-image-31260\" srcset=\"https:\/\/codeforgeek.com\/wp-content\/uploads\/2024\/07\/image-49.png 877w, https:\/\/codeforgeek.com\/wp-content\/uploads\/2024\/07\/image-49-300x108.png 300w, https:\/\/codeforgeek.com\/wp-content\/uploads\/2024\/07\/image-49-768x278.png 768w\" sizes=\"(max-width: 877px) 100vw, 877px\" \/><\/figure>\n\n\n\n<p>Then run the &#8216;next build&#8217; command to generate an &#8216;out&#8217; folder containing HTML, CSS, and JS assets from your Next.js app.<\/p>\n\n\n\n<figure class=\"wp-block-image aligncenter size-full\"><img decoding=\"async\" width=\"955\" height=\"502\" src=\"https:\/\/codeforgeek.com\/wp-content\/uploads\/2024\/09\/image-67.png\" alt=\"next build\" class=\"wp-image-32234\" srcset=\"https:\/\/codeforgeek.com\/wp-content\/uploads\/2024\/09\/image-67.png 955w, https:\/\/codeforgeek.com\/wp-content\/uploads\/2024\/09\/image-67-300x158.png 300w, https:\/\/codeforgeek.com\/wp-content\/uploads\/2024\/09\/image-67-768x404.png 768w\" sizes=\"(max-width: 955px) 100vw, 955px\" \/><\/figure>\n\n\n\n<p><strong>For more information on this:<\/strong> <a href=\"https:\/\/codeforgeek.com\/nextjs-export-static-html-files\/\" data-type=\"link\" data-id=\"https:\/\/codeforgeek.com\/nextjs-export-static-html-files\/\">Export Static HTML Files from Next.js Ap<\/a>p<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">5. next info<\/h3>\n\n\n\n<p>This command returns different details about our system like operating system, package versions, etc which is used when asking for help from the community.<\/p>\n\n\n\n<figure class=\"wp-block-image aligncenter size-large\"><img decoding=\"async\" width=\"1024\" height=\"397\" src=\"https:\/\/codeforgeek.com\/wp-content\/uploads\/2024\/09\/image-68-1024x397.png\" alt=\"next info\" class=\"wp-image-32235\" srcset=\"https:\/\/codeforgeek.com\/wp-content\/uploads\/2024\/09\/image-68-1024x397.png 1024w, https:\/\/codeforgeek.com\/wp-content\/uploads\/2024\/09\/image-68-300x116.png 300w, https:\/\/codeforgeek.com\/wp-content\/uploads\/2024\/09\/image-68-768x298.png 768w, https:\/\/codeforgeek.com\/wp-content\/uploads\/2024\/09\/image-68.png 1150w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<h3 class=\"wp-block-heading\">6. next lint<\/h3>\n\n\n\n<p>This command runs ESLint, a tool to identify and fix errors in JavaScript code.<\/p>\n\n\n\n<figure class=\"wp-block-image aligncenter size-full\"><img decoding=\"async\" width=\"757\" height=\"132\" src=\"https:\/\/codeforgeek.com\/wp-content\/uploads\/2024\/09\/image-69.png\" alt=\"next lint\" class=\"wp-image-32236\" srcset=\"https:\/\/codeforgeek.com\/wp-content\/uploads\/2024\/09\/image-69.png 757w, https:\/\/codeforgeek.com\/wp-content\/uploads\/2024\/09\/image-69-300x52.png 300w\" sizes=\"(max-width: 757px) 100vw, 757px\" \/><\/figure>\n\n\n\n<p>We can also change the configuration for ESLint inside the file eslintrc.json.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">7. next telemetry<\/h3>\n\n\n\n<p>Next.js fetches telemetry data for the improvement of the framework.&nbsp;<\/p>\n\n\n\n<figure class=\"wp-block-image aligncenter size-full\"><img decoding=\"async\" width=\"628\" height=\"188\" src=\"https:\/\/codeforgeek.com\/wp-content\/uploads\/2024\/09\/image-70.png\" alt=\"next telemetry\" class=\"wp-image-32237\" srcset=\"https:\/\/codeforgeek.com\/wp-content\/uploads\/2024\/09\/image-70.png 628w, https:\/\/codeforgeek.com\/wp-content\/uploads\/2024\/09\/image-70-300x90.png 300w\" sizes=\"(max-width: 628px) 100vw, 628px\" \/><\/figure>\n\n\n\n<p>We can enable or disable this using &#8220;next telemetry&#8221; command like this:<\/p>\n\n\n\n<figure class=\"wp-block-image aligncenter size-full\"><img decoding=\"async\" width=\"851\" height=\"205\" src=\"https:\/\/codeforgeek.com\/wp-content\/uploads\/2024\/09\/image-71.png\" alt=\"next telemetry disable \" class=\"wp-image-32238\" srcset=\"https:\/\/codeforgeek.com\/wp-content\/uploads\/2024\/09\/image-71.png 851w, https:\/\/codeforgeek.com\/wp-content\/uploads\/2024\/09\/image-71-300x72.png 300w, https:\/\/codeforgeek.com\/wp-content\/uploads\/2024\/09\/image-71-768x185.png 768w\" sizes=\"(max-width: 851px) 100vw, 851px\" \/><\/figure>\n\n\n\n<figure class=\"wp-block-image aligncenter size-full\"><img decoding=\"async\" width=\"834\" height=\"195\" src=\"https:\/\/codeforgeek.com\/wp-content\/uploads\/2024\/09\/image-72.png\" alt=\"next telemetry enable \" class=\"wp-image-32239\" srcset=\"https:\/\/codeforgeek.com\/wp-content\/uploads\/2024\/09\/image-72.png 834w, https:\/\/codeforgeek.com\/wp-content\/uploads\/2024\/09\/image-72-300x70.png 300w, https:\/\/codeforgeek.com\/wp-content\/uploads\/2024\/09\/image-72-768x180.png 768w\" sizes=\"(max-width: 834px) 100vw, 834px\" \/><\/figure>\n\n\n\n<h2 class=\"wp-block-heading\">Summary<\/h2>\n\n\n\n<p>In this guide, we have seen many useful Next.js CLI commands that can boost our productivity to the next level.<\/p>\n\n\n\n<p>Let&#8217;s summarise them:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>next dev: <\/strong>To start the development server with auto-reloading.<\/li>\n\n\n\n<li><strong>next build:<\/strong> To build the application for production.<\/li>\n\n\n\n<li><strong>next start: <\/strong>To start the application in production mode.<\/li>\n\n\n\n<li><strong>next export: <\/strong>To export the Next.js app as a static site.<\/li>\n\n\n\n<li><strong>next info:<\/strong> To display information about the Next.js environment.<\/li>\n\n\n\n<li><strong>next lint:<\/strong> To run ESLint.<\/li>\n\n\n\n<li><strong>next telemetry:<\/strong> To enable or disable telemetry.<\/li>\n<\/ul>\n\n\n\n<h2 class=\"wp-block-heading\">Reference<\/h2>\n\n\n\n<p><a href=\"https:\/\/nextjs.org\/docs\/app\/api-reference\/cli\" target=\"_blank\" rel=\"noopener\">https:\/\/nextjs.org\/docs\/app\/api-reference\/cli<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Next.js provides a command line interface using which we can save our time spent in building and configuring a Next.js app. These include commands to start a local development server, change the default port, run ESLint, generate static HTML files and much more. Let&#8217;s start exploring these commands to increase our productivity! Ready to deploy [&hellip;]<\/p>\n","protected":false},"author":79,"featured_media":32221,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_surecart_dashboard_logo_width":"180px","_surecart_dashboard_show_logo":true,"_surecart_dashboard_navigation_orders":true,"_surecart_dashboard_navigation_invoices":true,"_surecart_dashboard_navigation_subscriptions":true,"_surecart_dashboard_navigation_downloads":true,"_surecart_dashboard_navigation_billing":true,"_surecart_dashboard_navigation_account":true,"_uag_custom_page_level_css":"","footnotes":""},"categories":[443],"tags":[],"class_list":["post-32034","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-next-js-tutorials"],"blocksy_meta":[],"uagb_featured_image_src":{"full":["https:\/\/codeforgeek.com\/wp-content\/uploads\/2024\/09\/Next.js-CLI.png",1280,720,false],"thumbnail":["https:\/\/codeforgeek.com\/wp-content\/uploads\/2024\/09\/Next.js-CLI-150x150.png",150,150,true],"medium":["https:\/\/codeforgeek.com\/wp-content\/uploads\/2024\/09\/Next.js-CLI-300x169.png",300,169,true],"medium_large":["https:\/\/codeforgeek.com\/wp-content\/uploads\/2024\/09\/Next.js-CLI-768x432.png",768,432,true],"large":["https:\/\/codeforgeek.com\/wp-content\/uploads\/2024\/09\/Next.js-CLI-1024x576.png",1024,576,true],"1536x1536":["https:\/\/codeforgeek.com\/wp-content\/uploads\/2024\/09\/Next.js-CLI.png",1280,720,false],"2048x2048":["https:\/\/codeforgeek.com\/wp-content\/uploads\/2024\/09\/Next.js-CLI.png",1280,720,false]},"uagb_author_info":{"display_name":"Aditya Gupta","author_link":"https:\/\/codeforgeek.com\/author\/aditya\/"},"uagb_comment_info":0,"uagb_excerpt":"Next.js provides a command line interface using which we can save our time spent in building and configuring a Next.js app. These include commands to start a local development server, change the default port, run ESLint, generate static HTML files and much more. Let&#8217;s start exploring these commands to increase our productivity! Ready to deploy&hellip;","_links":{"self":[{"href":"https:\/\/codeforgeek.com\/wp-json\/wp\/v2\/posts\/32034","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/codeforgeek.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/codeforgeek.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/codeforgeek.com\/wp-json\/wp\/v2\/users\/79"}],"replies":[{"embeddable":true,"href":"https:\/\/codeforgeek.com\/wp-json\/wp\/v2\/comments?post=32034"}],"version-history":[{"count":0,"href":"https:\/\/codeforgeek.com\/wp-json\/wp\/v2\/posts\/32034\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/codeforgeek.com\/wp-json\/wp\/v2\/media\/32221"}],"wp:attachment":[{"href":"https:\/\/codeforgeek.com\/wp-json\/wp\/v2\/media?parent=32034"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/codeforgeek.com\/wp-json\/wp\/v2\/categories?post=32034"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/codeforgeek.com\/wp-json\/wp\/v2\/tags?post=32034"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}