我无法在全球范围内安装nodemon,"nodemon"未识别 [英] I can´t install nodemon globally, "nodemon" not recognized

查看:295
本文介绍了我无法在全球范围内安装nodemon,"nodemon"未识别的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想使用nodemon监视我的node.js应用程序,然后执行下一行命令:

i wanna use nodemon for monitoring my node.js app's, then i execute the next line command:

npm install -g nodemon 

npm install nodemon -g

当我移至我的应用文件夹并尝试

When I move to my app folder and try to to

nodemon app.js

系统告诉下一个:

"nodemon"未被识别为内部或外部命令,程序或批处理文件.

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

推荐答案

由于节点前缀不在PATH ENV变量中,因此无法识别任何全局安装的模块.

Since node prefix is not in the PATH ENV variable , any of the globally installed modules are not getting recognized.

请尝试这个.

打开cmd提示

npm配置获取前缀

将结果路径追加到PATH env变量.

append the resulting path to PATH env variable.

现在,您应该可以从任何位置运行nodemon.

Now you should be able to run nodemon from any location.

这是我在本地计算机上完成的操作

This is what i have done on my local machine

C:\>npm config get prefix
C:\Users\username\AppData\Roaming\npm

C:\>set PATH=%PATH%;C:\Users\username\AppData\Roaming\npm;

C:\>nodemon
 31 Jul 22:30:29 - [nodemon] v0.7.8
 31 Jul 22:30:29 - [nodemon] to restart at any time, enter `rs`
 31 Jul 22:30:29 - [nodemon] watching: C:\
 31 Jul 22:30:29 - [nodemon] starting `node `
 ^CTerminate batch job (Y/N)? Y

这篇关于我无法在全球范围内安装nodemon,"nodemon"未识别的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆