How to install the nodemon globally?

0

I'm trying to install nodemon globally, using:

npm install nodemon --global

It seems to install normally, with two warnings for an optional module:

npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@^1.0.0

But when I try to execute it:

nodemon servidor.js

It gives error:

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

What's wrong?

P.S. on another computer worked without problems. I'm on a Windows 10.

    
asked by anonymous 12.05.2017 / 17:50

2 answers

2

On some node installations, prefix is not assigned on the path environment variables, so what you install globally does not work as expected. To address this, we have to add the prefix on the path of environment variables. This can be done by the command prompt .

  

To do this, you first need to find out what the prefix path is, this can be solved by doing this:

npm config get prefix

  

The command will result in a path, copy it and paste in the next command:

set PATH=%PATH%;caminho;

  

Demo

    
13.05.2017 / 01:01
1

In order to complement @Luc's response, in Windows 10, the above configuration did not persist - and I resolved by manually placing in Path of variáveis de usuário (not system):

InPath,I'veincludedtheaddress%USERPROFILE%\AppData\Roaming\npm:

And after a reboot , the configuration has finally persisted.

    
26.05.2017 / 03:39