【问题标题】:Nodemon: command not foundNodemon:找不到命令
【发布时间】:2018-10-27 04:19:04
【问题描述】:

我正在努力在我的 node.js 服务器上安装 nodemon。我正在运行命令npm install nodemon -g,输出如下:

C:\Users\Stoffe\AppData\Roaming\npm\nodemon -> C:\Users\Stoffe\AppData\Roaming\npm\node_modules\nodemon\bin\nodemon.js

> nodemon@1.18.5 postinstall 
C:\Users\Stoffe\AppData\Roaming\npm\node_modules\nodemon
> node bin/postinstall || exit 0

npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.2.4 
(node_modules\nodemon\node_modules\fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.2.4: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"}                                                                                                                                                                                               )

+ nodemon@1.18.5
updated 1 package in 9.223s

但问题是,当我执行nodemon index.js 时,我收到错误bash: sudo: command not found。我四处寻找没有任何运气,但我还没有找到一个可行的解决方案。任何帮助表示赞赏!

【问题讨论】:

  • 你在运行windows吗?你能在命令提升中做一个where nodemon吗?
  • 我正在运行windows(这里是git bash),where nodemon 的输出是INFO: Could not find files for the given pattern(s).
  • 不要在 git bash 中运行 nodemon =_=
  • 在命令提示符下也不起作用
  • 你在 git bash 中 npm install nodemon -g 了吗?使用 cmd 提示符安装它

标签: npm nodemon


【解决方案1】:
  1. 不要使用git bash 终端安装全局 npm 模块
  2. 如果 cmd 提示符中的 where nodemon 返回 INFO: Could not find files for the given pattern(s).,则重新安装 node.js/npm 和 npm install nodemon -g
  3. 如果所有其他方法都失败,请确保文件正在下载并且位于您的 C:\Users\{{YOURUSER}}\AppData\Roaming\npm\nodemon.cmd 文件夹中。
  4. 最后,确保您的 windows path 环境变量有一个文件夹设置为 \AppData\Roaming\npm 文件夹。
  5. 如果所有其他方法都失败了,您可能有错字或达到操作系统的最大 path 环境变量限制(即 Windows 7 为 4096 个字符)

【讨论】:

    猜你喜欢
    • 2019-03-03
    • 2018-01-23
    • 2018-03-12
    • 2016-02-13
    • 2016-06-02
    • 1970-01-01
    • 2020-02-02
    • 2019-11-03
    • 2016-06-24
    相关资源
    最近更新 更多