无法安装 nodemon node.js

Unable to install nodemon node.js

我在 OSX 10.11.5 上安装 nodemon 时遇到问题。一旦我 运行 命令('npm install -g nodemon' 或添加 sudo),我就会收到 '-bash: nodemon: command not found' 错误。

我在安装 nodemon 时得到以下信息:

fsevents@1.0.14 install /Users/oioi/.node/lib/node_modules/nodemon/node_modules/chokidar/node_modules/fsevents node-pre-gyp install --fallback-to-build

[fsevents] Success: "/Users/oioi/.node/lib/node_modules/nodemon/node_modules/chokidar/node_modules/fsevents/lib/binding/Release/node-v46-darwin-x64/fse.node" already installed

Pass --update-binary to reinstall or --build-from-source to recompile /Users/oioi/.node/bin/nodemon -> /Users/oioi/.node/lib/node_modules/nodemon/bin/nodemon.js nodemon@1.11.0 /Users/oioi/.node/lib/node_modules/nodemon

我尝试传递“-update-binary”以重新安装或传递“--build-from-source”,以及清理缓存、重新启动终端、更新我的路径,但没有任何效果。我怀疑当我 运行 'npm delete nodemon' 时,它不会删除重复的版本,但我不知道如何修复它。

有人能帮忙吗?

nodemon 可执行文件安装在非标准位置(可能是因为您使用 Homebrew 安装了 Node):

/Users/oioi/.node/bin/nodemon

这意味着您需要将 /Users/oioi/.node/bin/ 添加到 $PATH,或者使用完整路径调用可执行文件:

/Users/oioi/.node/bin/nodemon my-app.js