How To Fix The Create-Next-App: Command Not Found Error

Create-next-app: command not found error

In the content of this article, we show you why the create-next-app: command not found error occurs. This problem will be solved when you add the prefix ‘npx‘ to the beginning of the statement or execute the command globally. Let’s see how we implement these methods.

Why do we have this problem?

When you execute the command “create-next-app” on the terminal, you will get the error message: “command not found: create-next-app“. 

The reason is that the syntax of the above statement is not correct.

Solutions for the create-next-app: command not found error

Add the character ‘npx’ at the beginning of the statement

We first want to share with you using the ‘npx’ prefix according to create-next-app documentation. By running the following command, you can create a new project:

npx [email protected]
yarn create next-app
pnpm create next-app

If you work with TypeScript, replace the above command as follows:

npx [email protected] --typescript

After successful installation, you can check the version you are using:

npx [email protected] --version



Install the package globally

Another approach is using the install statement with the ‘-g‘ flag, then create-next-app will be installed globally. To do that, execute the command below:

::install globally
npm install -g [email protected]


If you work with TypeScript, replace the above command as follows:

npm install -g [email protected]

create-next-app --typescript

Sometimes you also need to use admin/super user privileges to execute the install command. Restart the terminal before continuing to make sure the latest changes are caught up.

In case you have tried all the above, and the error is still not resolved, run this command:

npm config get prefix



This command returns a string which is the path to where ‘npm‘ locates all the global packages you have installed. Here you can find those packages in the bin folder.

At this point, you need to check the PATH environment variable. If it doesn’t already have the same value as you got from the statement ‘npm config get prefix‘, then add that value for the PATH environment variable.

Note: If this method also does not help, you must remove NodeJS from your machine and reinstall it. Then rerun the command ‘npm install -g [email protected]‘ to install create-next-app globally.


To sum up, we have just shown you two methods to fix the create-next-app: command not found error. You can choose to use either one as you like. However, we recommend adding ‘npx’ following the documentation. This is the end of the article, you can read more other tutorials here. Thank you for being so interested.

Maybe you are interested:

Leave a Reply

Your email address will not be published. Required fields are marked *