Giter VIP home page Giter VIP logo

easy-mock's Introduction

Node.js Version MongoDB Version Redis Version Build Status Coverage Status js-standard-style License Chat

Thanks to Souche Inc. which provides the server to hold an online service.

Souche Inc.

Links

Introduction

If you're unable to deploy an Easy Mock service by yourself, the online service is recommended.

Easy Mock is a persistent service that generates mock data quickly and provids visualization view.

Features

  • Support API proxying
  • Convenient shortcuts
  • Support Collaborative editing
  • Support team project
  • Support RESTful
  • Support Swagger | OpenAPI Specification (1.2 & 2.0 & 3.0)
    • Create project quickly based on Swagger
    • Support displaying parameters and the return value
    • Support displaying class model
  • More flexible and extensible in response data
  • Support for custom response configuration (example: status/headers/cookies)
  • Use Mock.js schema
  • Support restc to preview API

Quick Start

Before starting, we assume that you're already have installed Node.js (v8.x, v10.x is not supported) & MongoDB (>= v3.4) & Redis>= v4.0).

Installation

$ git clone https://github.com/easy-mock/easy-mock.git
$ cd easy-mock && npm install

Configuration

Find config/default.json or create config/local.json to overwrite some configuration.

Easy Mock will load different configuration files according to your environment. Reference to node-config to get more information because Easy Mock uses node-config as its configuration module.

{
  "port": 7300,
  "host": "0.0.0.0",
  "pageSize": 30,
  "proxy": false,
  "db": "mongodb://localhost/easy-mock",
  "unsplashClientId": "",
  "redis": {
    "keyPrefix": "[Easy Mock]",
    "port": 6379,
    "host": "localhost",
    "password": "",
    "db": 0
  },
  "blackList": {
    "projects": [], // projectId, e.g."5a4495e16ef711102113e500"
    "ips": [] // ip, e.g. "127.0.0.1"
  },
  "rateLimit": { // https://github.com/koajs/ratelimit
    "max": 1000,
    "duration": 1000
  },
  "jwt": {
    "expire": "14 days",
    "secret": "shared-secret"
  },
  "upload": {
    "types": [".jpg", ".jpeg", ".png", ".gif", ".json", ".yml", ".yaml"],
    "size": 5242880,
    "dir": "../public/upload",
    "expire": {
      "types": [".json", ".yml", ".yaml"],
      "day": -1
    }
  },
  "ldap": {
    "server": "", // Set server to enable LDAP login. e.g. "ldap://localhost:389" or "ldaps://localhost:389"(use SSL)
    "bindDN": "", // Username,e.g. "cn=admin,dc=example,dc=com"
    "password": "",
    "filter": {
      "base": "", // Base where we can search for users,e.g. "dc=example,dc=com"
      "attributeName": "" // e.g. "mail" or "email" etc.
    }
  },
  "fe": {
    "copyright": "",
    "storageNamespace": "easy-mock_",
    "timeout": 25000,
    "publicPath": "/dist/"
  }
}

Note:

  • The default value of publicPath is '/dist/'. You can replace it to your own CDN if necessary.
  • If you changed some configuration of fe, you should run build command to adapt that changes.

Background:

Easy Mock supports two background service, Unsplash and Bing.

If you leave unsplashClientId blank, the background will be provided by Bing.

Launch

$ npm run dev
# Visit http://127.0.0.1:7300

More Commands

# Build front-end assets
$ npm run build

# Run Easy Mock as production environment (You should run `build` first)
$ npm run start

# Run unit test
$ npm run test

# Test lint
$ npm run lint

Deployment

Please configure your configuration files before this step.

PM2

We're recommending you to use PM2 as your daemon process.

Install PM2 Globally

$ [sudo] npm install pm2 -g

Launch via PM2

You should run build before this step.

$ NODE_ENV=production pm2 start app.js

Releases

Refer to Release and you'll get all the releases and theirs changelog.

Contributing

Easy Mock is now maintained by Mobi-Architecture team of Souche Inc. If you have any question about this project, you're welcome to post Issues or make some Pull Requests. Before contributing, we think you'd better read the contributing guide.

Real-Time Feedback

You may make some real-time feedback via QQ group.

QQ is the most popular IM software in China and you can get it downloaded via http://en.qq.com/.

The QQ group number is 595325417, and here's the QR code of the group:

Who Deployed Easy Mock

If you deployed Easy Mock in your own server, please tell us

Core Contributors


chuangker

XadillaX

ostoc

xinyu198736

License

GPL-3.0

easy-mock's People

Contributors

chuangker avatar dancerphil avatar digdeeply avatar imgbotapp avatar liril-net avatar liweiv avatar shawchen08 avatar small-tou avatar xadillax avatar xiadd avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

easy-mock's Issues

Feature: 创建 POST/PUT等接口时,能否指定 body 中的字段?

出现什么问题?

在创建可以包含 body 时的接口时,不能指定 body 中的字段。
只有在预览接口的时候才能写body,而且还没有限制。
不知道是就这么设计的呢?感觉有点奇怪。我觉得给 body 设置字段也属于创建/规范接口的一部分吧。

如何能重现这个问题?

2017-09-06 10 43 04

2017-09-06 10 51 30

期望的结果?

能否指定 body 中的字段

操作系统版本 / 浏览器版本?

接口数据更改没有生效

请问一下easy-mock的数据有的时候修改了 在URL和POSTMAN上都是修改后的值 但是在ajax请求获取的值又还是原来的 是怎么回事

登录后返回401,token已存储到mongo

问题一

app.js
secret: config.get('jwt.key')
这个应该是 jwt.secret 吧?

问题二

登录成功

{"code":200,"success":true,"message":"success","data":{"_id":"59b26da1f93a29304db9f36b","name":"heibai","nick_name":"1504865697888","head_img":"//img.souche.com/20161230/png/bc836261fbb654dda6b653e428014279.png","token":"eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJqdGkiOiI1OWIyNmRhMmY5M2EyOTMwNGRiOWYzNzQiLCJleHAiOjE1MDYwNzUyOTgsImlkIjoiNTliMjZkYTFmOTNhMjkzMDRkYjlmMzZiIiwiaWF0IjoxNTA0ODY1Njk4fQ.vBv6B4TjMvDeOm4iNst6Cqe-ApLe2mdFpOSc7ZZb3y8"}}

接着获取项目列表(/api/project)返回401 "token expired"

500 | Internal Server Error

出现什么问题?

17:22:13.163Z ERROR easy-mock: error during render : /login (req_id=bad8052b-7c64-4315-8962-8413d48d2e09)
(node:80341) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 2): Error: timeout of 25000ms exceeded
(node:80341) DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
17:22:13.166Z ERROR easy-mock: (req_id=bad8052b-7c64-4315-8962-8413d48d2e09)
TypeError: Cannot read property 'data' of undefined
at server-bundle.js:1476:23
at process._tickCallback (internal/process/next_tick.js:103:7)

如何能重现这个问题?

npm run dev

期望的结果?

操作系统版本 / 浏览器版本?

node 7.5.0 node 8.4.0 都试过 都是 500错误

用户体验

https://easy-mock.com 网站写接口时一点击网页就会弹出新建接口,这很让我困扰 我只是想复制一些东西,但是总是弹出窗口。

有在公司内网部署的同学请将公司信息在此回复一下哈

我们手动将大家的公司录入到使用者列表,以鼓励开发者以及鼓励更多的人采用 easy-mock。

回复格式:
公司名:大搜车
英文名:Souche inc
公司或团队链接:http://blog.souche.com

If you deployed Easy Mock in your own server ,please tell us to encourage developers and encourage more people to use easy-mock.

Reply format:
Company Name: 大搜车
English name: Souche inc
Company Link: http://blog.souche.com

[Swagger] $ref 引用自身造成死循环

git提交版本 8cb639e - (HEAD) chore: 更新 LICENSE (7 days ago)
报错日志

{"name":"easy-mock","hostname":"liyf-pc","pid":16147,"req_id":"0467dc1a-0b5b-4d0e-b1ec-c6ff659d7b19","level":50,"req":{"method":"POST","url":"/api/project/update_swagger","headers":{"host":"127.0.0.1:7300","connection":"keep-alive","content-length":"33","pragma":"no-cache","cache-control":"no-cache","accept":"application/json, text/plain, */*","origin":"http://127.0.0.1:7300","authorization":"Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJqdGkiOiI1OWI2NGJhYzNkMTY3ZDI3ZjRhNjJlM2MiLCJleHAiOjE1MDYzMjg3NDksImlkIjoiNTliMWY1ODBkYWEyM2UzNDI2ZWI2NmI3IiwiaWF0IjoxNTA1MTE5MTQ4fQ.g4B54-lJSTf-vlT2AG3qRrZ3cQCoxrAg3zFtv6ubDxs","user-agent":"Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/61.0.3163.79 Safari/537.36","content-type":"application/json;charset=UTF-8","referer":"http://127.0.0.1:7300/project/59b64be33d167d27f4a62e3d","accept-encoding":"gzip, deflate, br","accept-language":"zh-CN,zh;q=0.8","cookie":"token=eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJqdGkiOiI1OWI2NGJhYzNkMTY3ZDI3ZjRhNjJlM2MiLCJleHAiOjE1MDYzMjg3NDksImlkIjoiNTliMWY1ODBkYWEyM2UzNDI2ZWI2NmI3IiwiaWF0IjoxNTA1MTE5MTQ4fQ.g4B54-lJSTf-vlT2AG3qRrZ3cQCoxrAg3zFtv6ubDxs"},"remoteAddress":"::ffff:127.0.0.1","remotePort":57174},"err":{"message":"Request failed with status code 404","name":"Error","stack":"Error: Request failed with status code 404\n    at createError (/mdisk/git_repo/easy-mock/node_modules/axios/lib/core/createError.js:15:15)\n    at settle (/mdisk/git_repo/easy-mock/node_modules/axios/lib/core/settle.js:18:12)\n    at IncomingMessage.handleStreamEnd (/mdisk/git_repo/easy-mock/node_modules/axios/lib/adapters/http.js:186:11)\n    at emitNone (events.js:110:20)\n    at IncomingMessage.emit (events.js:207:7)\n    at endReadableNT (_stream_readable.js:1059:12)\n    at _combinedTickCallback (internal/process/next_tick.js:138:11)\n    at process._tickCallback (internal/process/next_tick.js:180:9)"},"msg":"  --> POST /api/project/update_swagger, 基于 Swagger 更新 Mock 发生异常","time":"2017-09-12T06:51:25.679Z","v":0}

定位代码

function _getRefModels (model, swaggerInfo) {
    const type = getType(model)

    // 尝试获取依赖对象, 后面需要增加属性
    let depend = _.get(swaggerInfo, type)

    if (refModels.length === 0) {
      refModels.push(model)
    }

    if (depend) {
      depend = _.cloneDeep(depend)
      depend.properties = depend.properties || {}
      refModels.push(depend.properties)
      Object.keys(depend.properties).forEach((propertie) => {
        propertie = depend.properties[propertie]
        const propertieType = getType(propertie)
        // 防止对象自引用造成栈溢出
        if (propertieType !== type) {
          _getRefModels(propertie, swaggerInfo)
        }
      })
      // 放最后防止循环 _id_,对象别名
      depend.properties._id_ = type.split('.')[1]
    }
  }

原因, definition里面模型$ref存在循环嵌套, 这个swagger2.0是允许的

建议使用文件存储和mongoDB两种选择

其实可以使用fs模块创建对应的文件目录,放文本json文件就行,也可以crud,
因为本来前端在开发模拟数据时不需复杂数据结构和太大数据,mongo有点重了。
建议把这个手动过程用node批处理化和界面化。

数据编辑界面建议加上【JSON格式验证】

都是泪,已经遇到坑了。。

  • 修改数据的时候容易改错 json格式不合法,导致使用该数据的应用会报错。。

  • 也可以加个 验证格式的开关,有的人喜欢这个功能的。。

【Feat】操作历史与通知

其实easy-mock不仅是一个优秀的mock工具,更应该是前后端沟通工具,但是文档的沟通的莫过于及时更新与通知。

期望增加(团队项目)两个功能

  • 接口操作历史,任何开发人员对于Api的修改都应该有相应的历史记录,修改了什么
  • 变更通知,当Api发生改变是及时通知相应的开发人员

头像上传

OS / Browser Version

Node.js / MongoDB Version

Steps to reproduce

What is Expected?

不知道头像上传API该填啥

What is actually happening?

能给个默认的吗?求推荐

project界面太容易进接口创建功能了

  1. 在project页面,不小心双击,或者按住鼠标做滑动(做复制文字动作)释放鼠标瞬间 都会弹出接口编辑功能,很多时候只是为了复制项目的baseurl,接口地址等文字
    2.接口页面好像没有分页没有效果,看请求的url的pageSize还是2000,我在300个接口的时候暂时界面会比较卡,感觉要4s后才会渲染出界面(不包括请求)
    3.下载的是json数据,要是能有接口文档导出功能就好了
  2. 很棒的开源,功能编辑json的非常赞,小小的改进建议

npm run dev报错

出现什么问题?

npm install 正确安装但是npm run dev 出现以下错误

[nodemon] 1.12.0
[nodemon] to restart at any time, enter rs
[nodemon] watching: .
[nodemon] starting node app app.js
events.js:182
throw er; // Unhandled 'error' event
^

Error: spawn cmd ENOENT
at exports._errnoException (util.js:1022:11)
at Process.ChildProcess._handle.onexit (internal/child_process.js:189:19)
at onErrorNT (internal/child_process.js:366:16)
at _combinedTickCallback (internal/process/next_tick.js:102:11)
at process._tickCallback (internal/process/next_tick.js:161:9)

npm ERR! [email protected] dev: nodemon --ignore views/ app
npm ERR! Exit status 1

如何能重现这个问题?

npm run dev

期望的结果?

能正常启动

操作系统版本 / 浏览器版本?

Win8/chrome60/node 8.1.3

板凳

抢个板凳坐下,等开源!!嘿嘿

proxy 无法使用了

出现什么问题?

如何能重现这个问题?

期望的结果?

操作系统版本 / 浏览器版本?

如何进行数据持久化?

我理解的数据持久化是在内存中可以缓存当前所有接口的增删查改操作。

比如GET可以获取到一个列表,POST、PUT可以修改列表中的数据 。并且重新GET可以获取到变化。在业务条件比较复杂且有一定业务逻辑的时候需要数据在内存中交换。

我目前发现的只有接口返回模拟数据 ,有没有能返回模拟得更真一点的数据 ?
请问如何做到这一点?望不吝赐教。

swagger定义属性有循环依赖时, 不能正确解析.

OS / Browser Version

windows 7 旗舰版 sp1
google chrome
版本 60.0.3112.113(正式版本) (64 位)

Node.js / MongoDB Version

node 8.4.0

Steps to reproduce

新建项目, 设置 Swagger Docs API
接口定义的响应数据结构中存在循环依赖:

"NetClass": {
    "type": "object",
    "properties": {
        "resource": {
            "$ref": "#/definitions/Resource"
         }
     },

"Resource": {
    "type": "object",
    "properties": {
        "netClass": {
            "$ref": "#/definitions/NetClass"
         }
     }

What is Expected?

成功生成mock的接口定义

What is actually happening?

提示生成成功, 但是没有

无法启动 easy-mock

OS / Browser Version

centos 6.5

Node.js / MongoDB Version

Nodejs: 7.10.1
MongoDB: 3.4.8

Steps to reproduce

$ npm i
$ npm run build
$ npm run start

What is Expected?

正常访问

What is actually happening?

访问提示以下信息:
12:58:04.226Z INFO easy-mock: <-- GET / (req_id=30d13997-172e-4fe9-b50c-837597e3d0d9, req.remoteAddress=::ffff:192.168.52.180, req.remotePort=55671)
GET / HTTP/1.1
host: 192.168.51.112
connection: keep-alive
cache-control: max-age=0
upgrade-insecure-requests: 1
user-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/60.0.3112.113 Safari/537.36
accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,/;q=0.8
accept-encoding: gzip, deflate
accept-language: zh-CN,zh;q=0.8,en;q=0.6
12:58:04.853Z INFO easy-mock: <-- GET /api/project?page_size=30&page_index=1&keywords=&type=&group=&filter_by_author=0 (req_id=4cddf2e7-1ae7-4d6f-9a0c-f47fe1838cea, req.remoteAddress=::ffff:127.0.0.1, req.remotePort=58413)
GET /api/project?page_size=30&page_index=1&keywords=&type=&group=&filter_by_author=0 HTTP/1.1
accept: application/json, text/plain, /
authorization: Bearer undefined
user-agent: axios/0.15.3
host: 127.0.0.1
connection: close
12:58:04.873Z WARN easy-mock: --> GET /api/project?page_size=30&page_index=1&keywords=&type=&group=&filter_by_author=0 401 18ms (req_id=4cddf2e7-1ae7-4d6f-9a0c-f47fe1838cea, duration=18, req.remoteAddress=::ffff:127.0.0.1, req.remotePort=58413)
GET /api/project?page_size=30&page_index=1&keywords=&type=&group=&filter_by_author=0 HTTP/1.1
accept: application/json, text/plain, /
authorization: Bearer undefined
user-agent: axios/0.15.3
host: 127.0.0.1
connection: close
--
HTTP/1.1 401 Unauthorized
Access-Control-Allow-Origin: *
Access-Control-Allow-Methods: GET,HEAD,PUT,POST,DELETE
X-Request-Id: 4cddf2e7-1ae7-4d6f-9a0c-f47fe1838cea
Content-Type: application/json; charset=utf-8
Content-Length: 66
Date: Wed, 13 Sep 2017 12:58:04 GMT
Connection: close
(node:20221) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 3): [object Object]
(node:20221) DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

English docs?

出现什么问题?

This package looks quite interesting, and I think many people would like to have an english version of the docs.

如何能重现这个问题?

Going to the main page, I can see some things are in english, but not everything.

期望的结果?

We all can read the docs, so more people can use this package.

操作系统版本 / 浏览器版本?

Everywhere

bug: mock 转发失效

出现什么问题?

在 mock 中配置 mock.mode 为 url 形式,请求 mock 地址,转发失败,请求超时

如何能重现这个问题?

稳定重现

controller/mock.js 中的 getMock 方法,会判断 mock.mode,然后通过 axios 来发起转发,但是转发总是会失败

期望的结果?

我希望知道 axios 请求超时的可能原因,如果不行,我可能使用其他的库来修复这个功能。

操作系统版本 / 浏览器版本?

mac, node 8+

部署后无法登陆

不管是linux裸机还是docker部署后,能访问,但是永远不能登录,没任何错误信息!

内网部署,报错ETIMEDOUT

环境

  • Docker容器
  • node 8.4

报错

{
"name":"easy-mock",
"hostname":"5e9ea0693d22",
"pid":30,
"req_id":"932ee0e3-554e-4115-8a35-81361fe8769c",
"level":50,
"req":{
"method":"GET",
"url":"/api/wallpaper",
"headers":{
"accept":"application/json, text/plain, /",
"authorization":"Bearer undefined",
"user-agent":"axios/0.15.3",
"host":"10.21.139.64:7300",
"connection":"close"
},
"remoteAddress":"10.21.139.64",
"remotePort":50282
},
"err":{
"message":"connect ETIMEDOUT 202.89.233.101:443",
"name":"Error",
"stack":"Error: connect ETIMEDOUT 202.89.233.101:443
at Object._errnoException (util.js:1041:11)
at _exceptionWithHostPort (util.js:1064:20)
at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1153:14)",
"code":"ETIMEDOUT"
},
"msg":" --> GET /api/wallpaper 500",
"time":"2017-09-07T07:34:12.279Z",
"v":0
}

如何能重现这个问题?

npm run dev

npm info it worked if it ends with ok
npm info using [email protected]
npm info using [email protected]
npm info lifecycle [email protected]predev: [email protected]
npm info lifecycle [email protected]
dev: [email protected]

[email protected] dev /easy-mock
nodemon --ignore views/ app

[nodemon] 1.12.0
[nodemon] to restart at any time, enter rs
[nodemon] watching: .
[nodemon] starting node app app.js
(node:30) DeprecationWarning: loaderUtils.parseQuery() received a non-string value which can be problematic, see webpack/loader-utils#56
parseQuery() will be replaced with getOptions() in the next major version of loader-utils.
DONE Compiled successfully in 17246ms 07:46:00

webpack built d3c0745e9592f83efb63 in 17246ms
WAIT Compiling... 07:46:01
DONE Compiled successfully in 17850ms 07:46:01
WAIT Compiling... 07:46:01

webpack building...
DONE Compiled successfully in 105ms 07:46:01

webpack built d3c0745e9592f83efb63 in 105ms
DONE Compiled successfully in 119ms 07:46:01

启动成功后访问7300端口就报错了

Cannot find module './build/Release/DTraceProviderBindings'

出现什么问题?

mac os下 node8.4 安装成功后启动报错。
cnpm install 后无报错,全成功。

{ Error: Cannot find module './build/Release/DTraceProviderBindings'
    at Function.Module._resolveFilename (module.js:489:15)
    at Function.Module._load (module.js:439:25)
    at Module.require (module.js:517:17)
    at require (internal/module.js:11:18)
    at Object.<anonymous> (/Users/xiaojue/Dev/projects/easy-mock/node_modules/[email protected]@dtrace-provider/dtrace-provider.js:17:23)
    at Module._compile (module.js:573:30)
    at Object.Module._extensions..js (module.js:584:10)
    at Module.load (module.js:507:32)
    at tryModuleLoad (module.js:470:12)
    at Function.Module._load (module.js:462:3)
    at Module.require (module.js:517:17)
    at require (internal/module.js:11:18)
    at Object.<anonymous> (/Users/xiaojue/Dev/projects/easy-mock/node_modules/[email protected]@bunyan/lib/bunyan.js:34:22)
    at Module._compile (module.js:573:30)
    at Object.Module._extensions..js (module.js:584:10)
    at Module.load (module.js:507:32) code: 'MODULE_NOT_FOUND' }

如何能重现这个问题?

[email protected]
[email protected]
macos 10.12.5

期望的结果?

不报错,能启动啊…

操作系统版本 / 浏览器版本?

node --debug 参数导致崩溃

出现什么问题?

[DEP0062] DeprecationWarning: node --debug and node --debug-brk are invalid. Please use node --inspect or node --inspect-brk instead.

如何能重现这个问题?

安装node 版本高于6

期望的结果?

添加对高版本的支持(--inspect)

操作系统版本 / 浏览器版本?

无关

可不可以设置动态proxy?

公司的接口调用形式是
$.ajax({ method: 'GET', url: '/api', data: { handler: '接口路径', message: {}} })
可以根据handler动态代理接口吗?

英文版本

是否有开始考虑英文版本的翻译? 我们在柏林的团队准备开始使用,但是公司交流语言是英文。如果已经集成了 Vue i18n,我们可以开始提交 PR 做翻译了。

[nodemon] app crashed - waiting for file changes before starting

[nodemon] app crashed - waiting for file changes before starting...

> [email protected] dev /data/www/github/easy-mock
> nodemon --debug --ignore views/ app | bunyan -o short

[nodemon] 1.11.0
[nodemon] to restart at any time, enter `rs`
[nodemon] watching: *.*
[nodemon] starting `node --debug app app.js`
(node:29281) [DEP0062] DeprecationWarning: `node --debug` and `node --debug-brk` are invalid. Please use `node --inspect` or `node --inspect-brk` instead.

[nodemon] app crashed - waiting for file changes before starting...

node debug log

0 info it worked if it ends with ok
1 verbose cli [ '/usr/local/Cellar/node/8.4.0/bin/node',
1 verbose cli   '/usr/local/bin/npm',
1 verbose cli   'run',
1 verbose cli   'dev' ]
2 info using [email protected]
3 info using [email protected]
4 verbose run-script [ 'predev', 'dev', 'postdev' ]
5 info lifecycle [email protected]~predev: [email protected]
6 info lifecycle [email protected]~dev: [email protected]
7 verbose lifecycle [email protected]~dev: unsafe-perm in lifecycle true
8 verbose lifecycle [email protected]~dev: PATH: /usr/local/lib/node_modules/npm/bin/node-gyp-bin:/data/www/github/easy-mock/node_modules/.bin:/usr/local/opt/icu4c/sbin:/usr/local/opt/icu4c/bin:/usr/local/opt/libiconv/bin:/usr/local/sbin:/Users/Cdoco/.cargo/bin:/data/server/php/bin:usr/local/opt/go/libexec/bin:/data/gosrc/src/zygopm:/data/gosrc/bin:/Users/Cdoco/.cargo/bin:/Users/Cdoco/.cargo/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/Library/TeX/texbin:/usr/local/opt/icu4c/sbin:/usr/local/opt/icu4c/bin:/usr/local/opt/libiconv/bin:/usr/local/sbin:/Users/Cdoco/.cargo/bin:/data/server/php/bin:usr/local/opt/go/libexec/bin:/data/gosrc/src/zygopm:/data/gosrc/bin
9 verbose lifecycle [email protected]~dev: CWD: /data/www/github/easy-mock
10 silly lifecycle [email protected]~dev: Args: [ '-c',
10 silly lifecycle   'nodemon --debug --ignore views/ app | bunyan -o short' ]
11 silly lifecycle [email protected]~dev: Returned: code: 1  signal: null
12 info lifecycle [email protected]~dev: Failed to exec dev script
13 verbose stack Error: [email protected] dev: `nodemon --debug --ignore views/ app | bunyan -o short`
13 verbose stack Exit status 1
13 verbose stack     at EventEmitter.<anonymous> (/usr/local/lib/node_modules/npm/lib/utils/lifecycle.js:289:16)
13 verbose stack     at emitTwo (events.js:125:13)
13 verbose stack     at EventEmitter.emit (events.js:213:7)
13 verbose stack     at ChildProcess.<anonymous> (/usr/local/lib/node_modules/npm/lib/utils/spawn.js:40:14)
13 verbose stack     at emitTwo (events.js:125:13)
13 verbose stack     at ChildProcess.emit (events.js:213:7)
13 verbose stack     at maybeClose (internal/child_process.js:927:16)
13 verbose stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:211:5)
14 verbose pkgid [email protected]
15 verbose cwd /data/www/github/easy-mock
16 verbose Darwin 16.7.0
17 verbose argv "/usr/local/Cellar/node/8.4.0/bin/node" "/usr/local/bin/npm" "run" "dev"
18 verbose node v8.4.0
19 verbose npm  v5.3.0
20 error code ELIFECYCLE
21 error errno 1
22 error [email protected] dev: `nodemon --debug --ignore views/ app | bunyan -o short`
22 error Exit status 1
23 error Failed at the [email protected] dev script.
23 error This is probably not a problem with npm. There is likely additional logging output above.
24 verbose exit [ 1, true ]

The command: npm run dev

System version: macOS 10.12.6

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.