简体   繁体   English

无法安装 NodeMon(找不到命令:nodemon)

[英]Cant install NodeMon (command not found: nodemon)

I'm trying to install NodeMon for my Node js project.我正在尝试为我的 Node js 项目安装 NodeMon。 I have tried installing via npm.我试过通过 npm 安装。

npm install nodemon npm 安装 nodemon

Provided following result提供以下结果

  npm WARN saveError ENOENT: no such file or directory, open '/Users/nodejs/package.json'
npm notice created a lockfile as package-lock.json. You should commit this file.
npm WARN enoent ENOENT: no such file or directory, open '/Users//nodejs/package.json'
npm WARN nodejs No description
npm WARN nodejs No repository field.
npm WARN nodejs No README data
npm WARN nodejs No license field.

when i have tried running nodemon , It is throwing command not found: nodemon) Let me know how i can fix this.当我尝试运行 nodemon 时,它正在抛出command not found: nodemon)让我知道如何解决这个问题。

I tried the following once i got into this issue and it did not work for me as well:一旦我遇到这个问题,我尝试了以下方法,但它对我也不起作用:

npm uninstall nodemon

sudo npm uninstall -g nodemon

then i tried this and it worked然后我尝试了这个并且它有效

sudo npm install -g --force nodemon

I have fixed this by following below steps我已经按照以下步骤解决了这个问题

Step 1 npm initialisation in the same folder步骤 1在同一文件夹中初始化 npm

npm init 

npm requests projectName , author , description , entry point npm 请求项目名称、作者、描述、入口点

once provided , a package.json file will be added to your project folder.一旦提供,一个 package.json 文件将被添加到您的项目文件夹中。

Step 2第2步

try npm install nodemon 

It's Successful.成功了。

If still failing after following above steps , try with latest stable version of node and repeat the above process.如果执行上述步骤后仍然失败,请尝试使用最新稳定版本的节点并重复上述过程。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM