<p align="center">
<a href="https://nodemon.io/"><img src="https://user-images.githubusercontent.com/13700/35731649-652807e8-080e-11e8-88fd-1b2f6d553b2d.png" alt="Nodemon Logo"></a>
</p>
# nodemon
nodemon is a tool that helps develop Node.js based applications by automatically restarting the node application when file changes in the directory are detected.
nodemon does **not** require *any* additional changes to your code or method of development. nodemon is a replacement wrapper for `node`. To use `nodemon`, replace the word `node` on the command line when executing your script.
[![NPM version](https://badge.fury.io/js/nodemon.svg)](https://npmjs.org/package/nodemon)
[![Travis Status](https://travis-ci.org/remy/nodemon.svg?branch=master)](https://travis-ci.org/remy/nodemon) [![Backers on Open Collective](https://opencollective.com/nodemon/backers/badge.svg)](#backers) [![Sponsors on Open Collective](https://opencollective.com/nodemon/sponsors/badge.svg)](#sponsors)
# Installation
Either through cloning with git or by using [npm](http://npmjs.org) (the recommended way):
```bash
npm install -g nodemon # or using yarn: yarn global add nodemon
```
And nodemon will be installed globally to your system path.
You can also install nodemon as a development dependency:
```bash
npm install --save-dev nodemon # or using yarn: yarn add nodemon -D
```
With a local installation, nodemon will not be available in your system path or you can't use it directly from the command line. Instead, the local installation of nodemon can be run by calling it from within an npm script (such as `npm start`) or using `npx nodemon`.
# Usage
nodemon wraps your application, so you can pass all the arguments you would normally pass to your app:
```bash
nodemon [your node app]
```
For CLI options, use the `-h` (or `--help`) argument:
```bash
nodemon -h
```
Using nodemon is simple, if my application accepted a host and port as the arguments, I would start it as so:
```bash
nodemon ./server.js localhost 8080
```
Any output from this script is prefixed with `[nodemon]`, otherwise all output from your application, errors included, will be echoed out as expected.
You can also pass the `inspect` flag to node through the command line as you would normally:
```bash
nodemon --inspect ./server.js 80
```
If you have a `package.json` file for your app, you can omit the main script entirely and nodemon will read the `package.json` for the `main` property and use that value as the app ([ref](https://github.com/remy/nodemon/issues/14)).
nodemon will also search for the `scripts.start` property in `package.json` (as of nodemon 1.1.x).
Also check out the [FAQ](https://github.com/remy/nodemon/blob/master/faq.md) or [issues](https://github.com/remy/nodemon/issues) for nodemon.
## Automatic re-running
nodemon was originally written to restart hanging processes such as web servers, but now supports apps that cleanly exit. If your script exits cleanly, nodemon will continue to monitor the directory (or directories) and restart the script if there are any changes.
## Manual restarting
Whilst nodemon is running, if you need to manually restart your application, instead of stopping and restart nodemon, you can type `rs` with a carriage return, and nodemon will restart your process.
## Config files
nodemon supports local and global configuration files. These are usually named `nodemon.json` and can be located in the current working directory or in your home directory. An alternative local configuration file can be specified with the `--config <file>` option.
The specificity is as follows, so that a command line argument will always override the config file settings:
- command line arguments
- local config
- global config
A config file can take any of the command line arguments as JSON key values, for example:
```json
{
"verbose": true,
"ignore": ["*.test.js", "**/fixtures/**"],
"execMap": {
"rb": "ruby",
"pde": "processing --sketch={{pwd}} --run"
}
}
```
The above `nodemon.json` file might be my global config so that I have support for ruby files and processing files, and I can run `nodemon demo.pde` and nodemon will automatically know how to run the script even though out of the box support for processing scripts.
A further example of options can be seen in [sample-nodemon.md](https://github.com/remy/nodemon/blob/master/doc/sample-nodemon.md)
### package.json
If you want to keep all your package configurations in one place, nodemon supports using `package.json` for configuration.
Specify the config in the same format as you would for a config file but under `nodemonConfig` in the `package.json` file, for example, take the following `package.json`:
```json
{
"name": "nodemon",
"homepage": "http://nodemon.io",
"...": "... other standard package.json values",
"nodemonConfig": {
"ignore": ["**/test/**", "**/docs/**"],
"delay": 2500
}
}
```
Note that if you specify a `--config` file or provide a local `nodemon.json` any `package.json` config is ignored.
*This section needs better documentation, but for now you can also see `nodemon --help config` ([also here](https://github.com/remy/nodemon/blob/master/doc/cli/config.txt))*.
## Using nodemon as a module
Please see [doc/requireable.md](doc/requireable.md)
## Using nodemon as child process
Please see [doc/events.md](doc/events.md#Using_nodemon_as_child_process)
## Running non-node scripts
nodemon can also be used to execute and monitor other programs. nodemon will read the file extension of the script being run and monitor that extension instead of `.js` if there's no `nodemon.json`:
```bash
nodemon --exec "python -v" ./app.py
```
Now nodemon will run `app.py` with python in verbose mode (note that if you're not passing args to the exec program, you don't need the quotes), and look for new or modified files with the `.py` extension.
### Default executables
Using the `nodemon.json` config file, you can define your own default executables using the `execMap` property. This is particularly useful if you're working with a language that isn't supported by default by nodemon.
To add support for nodemon to know about the `.pl` extension (for Perl), the `nodemon.json` file would add:
```json
{
"execMap": {
"pl": "perl"
}
}
```
Now running the following, nodemon will know to use `perl` as the executable:
```bash
nodemon script.pl
```
It's generally recommended to use the global `nodemon.json` to add your own `execMap` options. However, if there's a common default that's missing, this can be merged in to the project so that nodemon supports it by default, by changing [default.js](https://github.com/remy/nodemon/blob/master/lib/config/defaults.js) and sending a pull request.
## Monitoring multiple directories
By default nodemon monitors the current working directory. If you want to take control of that option, use the `--watch` option to add specific paths:
```bash
nodemon --watch app --watch libs app/server.js
```
Now nodemon will only restart if there are changes in the `./app` or `./libs` directory. By default nodemon will traverse sub-directories, so there's no need in explicitly including sub-directories.
Nodemon also supports unix globbing, e.g `--watch './lib/*'`. The globbing pattern must be quoted.
## Specifying extension watch list
By default, nodemon looks for files with the `.js`, `.mjs`, `.coffee`, `.litcoffee`, and `.json` extensions. If you use the `--exec` option and monitor `app.py` nodemon will monitor files with the extension of `.py`. However, you can specify your own list with the `-e` (or `--ext`) switch like so:
```bash
nodemon -e js,pug
```
Now nodemon will restart on any changes to files in the directory (or subdirectories) with the extensions `.js`, `.pug`.
## Ignoring files
By default, nodemon will only restart when a `.js` JavaScript file changes. In some cases you will want to ignore some specific files, directories or file patterns, to p
没有合适的资源?快使用搜索试试~ 我知道了~
温馨提示
软件开发设计:应用软件开发、系统软件开发、移动应用开发、网站开发C++、Java、python、web、C#等语言的项目开发与学习资料 硬件与设备:单片机、EDA、proteus、RTOS、包括计算机硬件、服务器、网络设备、存储设备、移动设备等 操作系统:LInux、树莓派、安卓开发、微机操作系统、网络操作系统、分布式操作系统等。此外,还有嵌入式操作系统、智能操作系统等。 网络与通信:数据传输、信号处理、网络协议、网络与通信硬件、网络安全网络与通信是一个非常广泛的领域,它涉及到计算机科学、电子工程、数学等多个学科的知识。 云计算与大数据:包括云计算平台、大数据分析、人工智能、机器学习等,云计算是一种基于互联网的计算方式,通过这种方式,共享的软硬件资源和信息可以按需提供给计算机和其他设备。
资源推荐
资源详情
资源评论
收起资源包目录
node 后端项目.zip (573个子文件)
range.bnf 619B
range.bnf 619B
nodemon.cmd 265B
nodetouch.cmd 265B
semver.cmd 263B
semver.cmd 260B
nopt.cmd 259B
.eslintignore 10B
.eslintrc 164B
.eslintrc 164B
.eslintrc 79B
windows-kill.exe 79KB
semver.js 38KB
websocket.js 33KB
index.js 28KB
parse.js 27KB
minimatch.js 26KB
nodefs-handler.js 20KB
run.js 16KB
fsevents-handler.js 16KB
websocket-server.js 15KB
nopt.js 15KB
receiver.js 14KB
request.js 14KB
permessage-deflate.js 14KB
sender.js 12KB
response.js 12KB
range.js 12KB
index.js 11KB
index.js 10KB
index.js 10KB
picomatch.js 10KB
index.js 9KB
scan.js 9KB
index.js 9KB
nodemon.js 9KB
semver.js 8KB
load.js 7KB
application.js 7KB
parse.js 7KB
exec.js 7KB
match.js 7KB
event-target.js 6KB
re.js 6KB
index.js 6KB
index.js 6KB
watch.js 6KB
index.js 6KB
index.js 6KB
common.js 6KB
browser.js 6KB
extension.js 6KB
index.js 6KB
parse.js 6KB
browser.js 6KB
common.js 6KB
context.js 5KB
index.js 5KB
mediaType.js 5KB
index.js 5KB
index.js 5KB
index.js 5KB
index.js 5KB
index.js 5KB
node.js 5KB
constants.js 4KB
index.js 4KB
node.js 4KB
index.js 4KB
semver.js 4KB
index.js 4KB
stream.js 4KB
index.js 4KB
comparator.js 4KB
index.js 4KB
encoding.js 3KB
language.js 3KB
validation.js 3KB
index.js 3KB
charset.js 3KB
index.js 3KB
index.js 3KB
buffer-util.js 3KB
index.js 3KB
index.js 3KB
expand.js 3KB
index.js 3KB
index.js 3KB
add.js 3KB
index.js 3KB
nodetouch.js 3KB
undefsafe.js 3KB
index.js 3KB
index.js 2KB
version.js 2KB
utils.js 2KB
index.js 2KB
index.js 2KB
index.js 2KB
callsite-tostring.js 2KB
共 573 条
- 1
- 2
- 3
- 4
- 5
- 6
资源评论
妄北y
- 粉丝: 1w+
- 资源: 1万+
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
最新资源
- winlibs-x86-64-posix-seh-gcc-13.2.0-llvm-16.0.6-mingw-w64msvcrt
- HTML5小游戏【愤怒的小红帽-优秀H5小游戏合集射击游戏-过关游戏】游戏源码分享下载 - fndxhm.zip
- 医学影像处理-图像分割-肿瘤识别-诊断辅助-matlab图像分割肿瘤代码-DeepBTSeg.zip
- 数字电子-JK触发器-可逆计数器-教学模拟-同步六进制加减法可逆计数器(JK).ms7.zip
- 小程序项目源码之熊猫签证.zip
- 小程序项目源码之面包旅行.zip
- 云开发魔都团长头像制作微信小程序源码/带流量主
- 小程序项目源码之户外旅游小程序.zip
- 中景园GC9A01显示屏技术手册
- HTML5小游戏【让屋子飞-练手速游戏】游戏源码分享下载 - flyhouse.zip
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功