'nodemon' is not recognized

Asked

Viewed 15,601 times

4

After nodemon installation I get the following error :

'nodemon' is not recognized as an internal command or external, a operable program or a batch file.

The following commands have been passed:

  • npm install -g nodemon
  • npm install --save-dev nodemon
  • Resumed terminal session after installation?

  • yes, it was reset

  • And are sure that the installation occurred without errors?

  • yes, without any error , this was the reason I asked

  • This link below vcs will get... command line to install sudo npm install nodemon -g then to run sudo nodemon along with file address. js https://www.youtube.com/watch?v=4N0d8HhU5DE

9 answers

10


5

First step will be necessary to get the npm installation prefix path which can be solved by typing the following command:

npm config get prefix

The result will be the path, copy and paste it into the next command:

set PATH=%PATH%;caminho;

Example

comando-1.png

If the setting does not persist then you will have to manually configure environment variable:

Going into Control Panel, System, Advanced System Settings going into Environment Variables button:

First step in variables for my user in Path click the Edit button and then the New button and added the path obtained from the command promot npm config get prefix

C:\Users\lcsan\AppData\Roaming\npm

And then Ok and the system variable in PATH click the Edit button add the Nodejs installation path

C:\Program Files\nodejs

done this restart the computer

2

Win 10 Solution

Step 1: My Computer / Properties / Advanced System Settings

Step 2: Environment Variables

Step 3: Click on the PATH environment variable and then click Edit

Step 4: Click new and paste the following line C: Users "Your User" Appdata Roaming npm

Step 5: Click OK and be happy :D

Ah, don’t forget to restart the prompt/editor !!!

1

Use the following steps:

npm install -g nodemon

npm returns the installation location:


C:\Users\{seu usuario}\AppData\Roaming\npm\nodemon ->  C:\Users\{seu usuario}\AppData\Roaming\npm\node_modules\nodemon\bin\nodemon.js

> [email protected] postinstall C:\Users\leona\AppData\Roaming\npm\node_modules\nodemon
> node bin/postinstall || exit 0

Adding the first address to the PATH environment variable. using poweshell would look like this:

$Env:path = $Env:path+"C:\Users\{seu usuário}\AppData\Roaming\npm\nodemon"

1

I managed using the commands below by Power Shell [administrator]:

npm install -g npm
npm cache clean --force
npm update
npm install

Soon after I started the nodemon ./bin/server.js (in my case)

1

When you are going to execute some command from a Node library, you do not run the library directly, but by Node, by the command:

npm run <comando no package.json>

In this case, with the nodemon you would use the command below:

npm run nodemon

Although, if it is configured in package.json, you can use the name set there. In my case, I have a command set in my package.json like this:

"scripts": {
  "start": "ng serve"
}

I could use it straight as npm ng serve or use npm run start.

  • But installed globally, some packages have their own CLI, see Grunt and Gulp.

  • got it, plus the nodemon command itself, has no way to set the command to use for example 'nodemon serves'

1

The command you must run for the nodemon to recognize your server is:

nodemon SeuArquivoDeServidor.js

You can see in this tutorial here.

If you want you can also specify in your package.json file

It’ll look something like:

"scripts": {
  "start": "nodemon SeuArquivoDeServidor.js"
}

Then all you have to do is execute the command on the terminal

npm start

you can read more about on the nodemon package page here and in the documentation of the nodemon itself here.

I hope it helped you.

-1

Go to Control Panel > Uninstall a program > search for Node.js, in my case Windows 7 SO X86, has a Repair button, when I repaired the node the nodemon started working again

-2

Open the Powershell as administrator and then run:

Set-ExecutionPolicy Unrestricted

Browser other questions tagged

You are not signed in. Login or sign up in order to post.