当我输入" nodemon"时,我收到以下错误:" bash:nodemon:command not found"。我已尝试在本地和全球范围内安装它,它昨天已经工作了,我不记得我改变了什么,以至于它不再起作用了。我正在使用Git Bash shell。
当我安装nodemon时,我得到以下输出:
$ npm install nodemon --save
webdev@1.0.0 C:\users\corfi\Google Drive\coding\webdev\site
`-- nodemon@1.11.0
+-- chokidar@1.7.0
| +-- anymatch@1.3.2
| | +-- micromatch@2.3.11
| | | +-- arr-diff@2.0.0
| | | | `-- arr-flatten@1.1.0
| | | +-- array-unique@0.2.1
| | | +-- braces@1.8.5
| | | | +-- expand-range@1.8.2
| | | | | `-- fill-range@2.2.3
| | | | | +-- is-number@2.1.0
| | | | | +-- isobject@2.1.0
| | | | | `-- randomatic@1.1.7
| | | | | +-- is-number@3.0.0
| | | | | | `-- kind-of@3.2.2
| | | | | `-- kind-of@4.0.0
| | | | +-- preserve@0.2.0
| | | | `-- repeat-element@1.1.2
| | | +-- expand-brackets@0.1.5
| | | | `-- is-posix-bracket@0.1.1
| | | +-- extglob@0.3.2
| | | +-- filename-regex@2.0.1
| | | +-- object.omit@2.0.1
| | | | +-- for-own@0.1.5
| | | | | `-- for-in@1.0.2
| | | | `-- is-extendable@0.1.1
| | | +-- parse-glob@3.0.4
| | | | +-- glob-base@0.3.0
| | | | `-- is-dotfile@1.0.3
| | | `-- regex-cache@0.4.3
| | | +-- is-equal-shallow@0.1.3
| | | `-- is-primitive@2.0.0
| | `-- normalize-path@2.1.1
| | `-- remove-trailing-separator@1.0.2
| +-- async-each@1.0.1
| +-- glob-parent@2.0.0
| +-- is-binary-path@1.0.1
| | `-- binary-extensions@1.10.0
| +-- is-glob@2.0.1
| | `-- is-extglob@1.0.0
| `-- readdirp@2.1.0
| `-- set-immediate-shim@1.0.1
+-- ignore-by-default@1.0.1
+-- lodash.defaults@3.1.2
| +-- lodash.assign@3.2.0
| | +-- lodash._baseassign@3.2.0
| | | `-- lodash._basecopy@3.0.1
| | +-- lodash._createassigner@3.1.1
| | | +-- lodash._bindcallback@3.0.1
| | | `-- lodash._isiterateecall@3.0.9
| | `-- lodash.keys@3.1.2
| | +-- lodash._getnative@3.9.1
| | +-- lodash.isarguments@3.1.0
| | `-- lodash.isarray@3.0.4
| `-- lodash.restparam@3.6.1
+-- ps-tree@1.1.0
| `-- event-stream@3.3.4
| +-- duplexer@0.1.1
| +-- from@0.1.7
| +-- map-stream@0.1.0
| +-- pause-stream@0.0.11
| +-- split@0.3.3
| +-- stream-combiner@0.0.4
| `-- through@2.3.8
+-- touch@1.0.0
| `-- nopt@1.0.10
| `-- abbrev@1.1.0
+-- undefsafe@0.0.3
`-- update-notifier@0.5.0
+-- chalk@1.1.3
| +-- ansi-styles@2.2.1
| +-- escape-string-regexp@1.0.5
| +-- has-ansi@2.0.0
| | `-- ansi-regex@2.1.1
| +-- strip-ansi@3.0.1
| `-- supports-color@2.0.0
+-- configstore@1.4.0
| +-- mkdirp@0.5.1
| | `-- minimist@0.0.8
| +-- object-assign@4.1.1
| +-- os-tmpdir@1.0.2
| +-- osenv@0.1.4
| | `-- os-homedir@1.0.2
| +-- uuid@2.0.3
| +-- write-file-atomic@1.3.4
| | +-- imurmurhash@0.1.4
| | `-- slide@1.1.6
| `-- xdg-basedir@2.0.0
+-- is-npm@1.0.0
+-- latest-version@1.0.1
| `-- package-json@1.2.0
| +-- got@3.3.1
| | +-- duplexify@3.5.1
| | | +-- end-of-stream@1.4.0
| | | `-- stream-shift@1.0.0
| | +-- infinity-agent@2.0.3
| | +-- is-redirect@1.0.0
| | +-- is-stream@1.1.0
| | +-- lowercase-keys@1.0.0
| | +-- nested-error-stacks@1.0.2
| | +-- object-assign@3.0.0
| | +-- prepend-http@1.0.4
| | +-- read-all-stream@3.1.0
| | | `-- pinkie-promise@2.0.1
| | | `-- pinkie@2.0.4
| | `-- timed-out@2.0.0
| `-- registry-url@3.1.0
| `-- rc@1.2.1
| +-- deep-extend@0.4.2
| +-- ini@1.3.4
| +-- minimist@1.2.0
| `-- strip-json-comments@2.0.1
+-- repeating@1.1.3
| `-- is-finite@1.0.2
| `-- number-is-nan@1.0.1
+-- semver-diff@2.1.0
`-- string-length@1.0.1
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@^1.0.0 (node_modules\chokidar\node_modules\fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.1.2: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"})
npm WARN webdev@1.0.0 No repository field.
答案 0 :(得分:6)
尝试全局安装nodemon
npm install -g nodemon
Windows有时会丢失环境中的引用。如果您使用的是Windows 10,请尝试在“C:\ Users \ YOUR_USER \ AppData \ Roaming \ npm \ node_modules \ nodemon \ bin”中找到nodemon.js。然后复制此路径并执行
node THE_PATH\nodemon.js YOUR_COOL_APP.js
这是一种解决方法,但它通常有效。 希望它有所帮助...
答案 1 :(得分:0)
转到要使用nodemon的目录,然后使用节点模块中安装nodemon的路径而不是nodemon。即。
c:/user/[your path here]/nodemon [your node app]
而不是
nodemon [your node app]
答案 2 :(得分:0)
实际上,我们必须找出nodemon的安装位置,然后将其路径添加到path变量中。
C:\> npm config获取前缀
C:\ Users \ username \ AppData \ Roaming \ npm
C:\>设置PATH =%PATH%; C:\ Users \ username \ AppData \ Roaming \ npm;
您必须在命令提示符下运行此命令。