<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
没有合适的资源?快使用搜索试试~ 我知道了~
这是一个具有标准行业文件格式结构的亚马逊电子商务克隆,具有使用 Firebase 身份验证服务的登录_注册功能和使用.zip
共774个文件
js:300个
md:150个
json:110个
1.该资源内容由用户上传,如若侵权请联系客服进行举报
2.虚拟产品一经售出概不退款(资源遇到问题,请及时私信上传者)
2.虚拟产品一经售出概不退款(资源遇到问题,请及时私信上传者)
版权申诉
0 下载量 167 浏览量
2024-05-20
14:19:48
上传
评论
收藏 3.44MB ZIP 举报
温馨提示
这是一个具有标准行业文件格式结构的亚马逊电子商务克隆,具有使用 Firebase 身份验证服务的登录_注册功能和使用.zip
资源推荐
资源详情
资源评论
收起资源包目录
这是一个具有标准行业文件格式结构的亚马逊电子商务克隆,具有使用 Firebase 身份验证服务的登录_注册功能和使用.zip (774个子文件)
range.bnf 619B
range.bnf 619B
nodetouch.cmd 310B
nodemon.cmd 310B
semver.cmd 308B
semver.cmd 305B
nopt.cmd 304B
mime.cmd 299B
.editorconfig 569B
.editorconfig 286B
.env 129B
.eslintignore 10B
.eslintignore 10B
.eslintrc 1KB
.eslintrc 1KB
.eslintrc 603B
.eslintrc 247B
.eslintrc 231B
.eslintrc 180B
.eslintrc 176B
.eslintrc 172B
.eslintrc 164B
.eslintrc 43B
windows-kill.exe 79KB
.gitignore 310B
index.html 1KB
carousel1.jpg 1.13MB
carousel3.jpg 295KB
carousel4.jpg 120KB
carousel2.jpg 106KB
carousel5.jpg 61KB
qs.js 68KB
semver.js 38KB
parse.js 35KB
stringify.js 34KB
sbcs-data-generated.js 31KB
index.js 28KB
response.js 27KB
parse.js 27KB
minimatch.js 26KB
index.js 23KB
dbcs-codec.js 21KB
nodefs-handler.js 20KB
ipaddr.js 19KB
index.js 18KB
run.js 16KB
fsevents-handler.js 16KB
tests.js 15KB
nopt.js 15KB
index.js 15KB
application.js 14KB
index.js 13KB
request.js 12KB
range.js 12KB
index.js 11KB
index.js 10KB
index.js 10KB
stringify.js 10KB
picomatch.js 10KB
ipaddr.min.js 10KB
parse.js 9KB
utf7.js 9KB
scan.js 9KB
index.js 9KB
index.js 9KB
nodemon.js 9KB
GetIntrinsic.js 9KB
extend-node.js 8KB
dbcs-data.js 8KB
semver.js 8KB
load.js 7KB
values.js 7KB
parse.js 7KB
index.js 7KB
exec.js 7KB
utils.js 7KB
match.js 7KB
index.js 7KB
indent-option.js 6KB
re.js 6KB
index.js 6KB
watch.js 6KB
index.js 6KB
index.js 6KB
index.js 6KB
browser.js 6KB
internal.js 6KB
parse.js 6KB
node.js 6KB
index.js 6KB
utils.js 6KB
common.js 6KB
urlencoded.js 6KB
index.js 5KB
mediaType.js 5KB
index.js 5KB
index.js 5KB
index.js 5KB
utils.js 5KB
index.js 5KB
共 774 条
- 1
- 2
- 3
- 4
- 5
- 6
- 8
资源评论
GZM888888
- 粉丝: 186
- 资源: 2957
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功