Node.js-inspect-process使用chrome-devtools用于Node.js简单调试的工具

  • N3_711113
    了解作者
  • 11.8KB
    文件大小
  • zip
    文件格式
  • 0
    收藏次数
  • VIP专享
    资源类型
  • 0
    下载次数
  • 2022-04-25 04:47
    上传日期
inspect-process:使用chrome-devtools用于Node.js简单调试的工具
Node.js-inspect-process使用chrome-devtools用于Node.js简单调试的工具.zip
  • inspect-process-master
  • bin
  • inspect.js
    2.2KB
  • test
  • fixtures
  • success
    551B
  • exception
    235B
  • harmony
    324B
  • error
    252B
  • required.js
    220B
  • index.js
    6.4KB
  • lib
  • index.js
    4.1KB
  • devtools.js
    3.2KB
  • .editorconfig
    147B
  • README.md
    5.9KB
  • .gitignore
    184B
  • package.json
    1.2KB
  • .travis.yml
    390B
内容介绍
<h1 align="center">inspect-process</h1> <div align="center"> <p>Dead simple debugging for node.js using chrome-devtools.</p> <div> <a href="https://travis-ci.org/jaridmargolin/inspect-process" rel='nofollow' onclick='return false;'><img src="https://travis-ci.org/jaridmargolin/inspect-process.svg?branch=master" alt="Build Status"></a> <a href="https://coveralls.io/github/jaridmargolin/inspect-process?branch=master" rel='nofollow' onclick='return false;'><img src="https://coveralls.io/repos/github/jaridmargolin/inspect-process/badge.svg?branch=master" alt="Coverage Status"></a> <a href="http://standardjs.com/" rel='nofollow' onclick='return false;'><img src="https://img.shields.io/badge/code%20style-standard-brightgreen.svg" alt="Standard - JavaScript Style Guide"></a> </div> <div> <a href="https://npmjs.org/package/inspect-process" rel='nofollow' onclick='return false;'><img src="https://img.shields.io/npm/v/inspect-process.svg" alt="NPM inspect-process package"></a> <a href="https://david-dm.org/jaridmargolin/inspect-process" rel='nofollow' onclick='return false;'><img src="https://david-dm.org/jaridmargolin/inspect-process.svg" alt="Dependency Status"></a> <a href="https://david-dm.org/jaridmargolin/inspect-process#info=devDependencies" rel='nofollow' onclick='return false;'><img src="https://david-dm.org/jaridmargolin/inspect-process/dev-status.svg" alt="devDependency Status"></a> </div> <br> <img src="https://cldup.com/EKt_O0lK-F.gif" width="100%"> </div> <br> ### Why? Node added support for v8-inspector in [v6.3.0](https://github.com/nodejs/node/blob/master/doc/changelogs/CHANGELOG_V6.md#6.3.0) but launching the debugger for a given process is still a little clumsy. **inspect-process** solves the following problems: * Opening and refreshing devtools - A new instance is launched each time a process is launched. * Unable to debug executables - Looks up path to executables such as mocha, grunt, by looking in PATH prior to resolving as a file. * 'Unable to open devtools socket: address already in use' - Finds an open port prior to starting the inspector. Begins searching for available ports starting at the node default inspector port, `9229`. * Requiring `debug-brk` - Bypasses the user requirement of setting this flag by ensuring devtools is connected prior to advancing. Just set your debug break points, and `inspect-process` will be able to pick it up. Behind the scenes **inspect-process** attempts to normalize your experience by: * Hiding the noisy output broadcast by the default `--inspect` flag. You don't need to worry about attaching,detaching, and cleaning up. Just inspect. * Automatically forcing color output; plays nicely with any module utilzing `supports-color`. ### How is this different from node-inspector? **inspect-process** is only a small wrapper around the native `--inspect` functionaltiy provided by node. The key differences between utilizing `--inspect` and `node-inspector` can be found in [this comment by pavelfeldman](https://github.com/nodejs/node/pull/6792#issuecomment-219756916) ## Usage Install this globally and you'll have access to the `inspect` command anywhere on your system. ``` npm install -g inspect-process ``` **Inspecting a file** ``` $ inspect index.js ``` **Inspecting an executable** ``` $ inspect grunt ``` **Passing arguments to process** Just pass your arguments after the process. ``` inspect index.js --argument=val ``` **Passing arguments to node** Arguments are passed to the process just as if you were utilizing the node CLI. ``` inspect --harmony index.js ``` ### Options **--debug-exception** Pause debugger on exceptions. [boolean] **--log-level**: The level to display logs at. [string] (choices: "silly", "verbose", "info") ## Tests **Install Dependencies** ``` npm install ``` **Run** ``` npm test ``` ## Known Issues ### Child Processes Inspecting a child process is not currently possible (and most likely never will be). Unfortunately **inspect-process** can not force child processes to spawn with the necessary `--inspect` flag. This is clear when looking at all of the provided mocha examples. The actual `mocha` executable is a wrapper that spawns `_mocha` (done in order to allow passing flags to the node process). In order to use mocha with **inspect-process**, we have to bypass that first indirection and use the `_mocha` exectuable directly: `inspect _mocha`. If you have control of the source code responsible for spawning the child process, it is technically possible to still utilize **inspect-process** by working with [programatic api](https://github.com/jaridmargolin/inspect-process/blob/master/lib/index.js), however this is not recommended for most use cases. ### Internet Connectivity (> Node 7.1.0) Versions of Node prior to 7.1.0 require a specific devtools version which is downloaded from the cloud (hence "remote" in the URL string). Node 7.1.0 and on will be exposing a stable protocol which will work with the devtools version bundled with the Chrome ([source](https://github.com/jaridmargolin/inspect-process/issues/18#issuecomment-259748007)). ## License The MIT License (MIT) Copyright (c) 2016 Jarid Margolin Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
评论
    相关推荐
    • Puppeteer:无头的Chrome Node.js API-开源
      Puppeteer是一个无头节点库,提供了用于通过DevTools协议控制Chromium或Chrome的高级API。 它需要零设置,并与最适合它的Chromium版本捆绑在一起。 默认情况下,Puppeteer是无头的,因此运行起来很快。 但是,也可以...
    • Puppeteer:无头的Chrome Node.js API-开源
      Puppeteer是一个无头节点库,提供了用于通过DevTools协议控制Chromium或Chrome的高级API。 它需要零设置,并与最适合它的Chromium版本捆绑在一起。 默认情况下,Puppeteer是无头的,因此运行起来很快。 但是,也可以...
    • Node.js-Tutorial:Node.js
      Node.js:教程 ... - Runs on top of the V8 JavaScript Runtime (same that is running on the Chrome browser) What can you build? - Web socket Server - File Upload client - Ad Server - Real
    • Puppeteer Headless Chrome Node.js API-Node.js开发
      Puppeteer是一个Node库,它提供了高级API来通过DevTools协议控制Chrome或Chromium。 Puppeteer默认情况下无头运行,但可以配置为运行完整(无头)的Chrome或Chromium。 Puppeteer是一个Node库,它提供了高级API来...
    • chrome-remote-interface, node.jsChrome 调试协议接口.zip
      chrome-remote-interface, node.jsChrome 调试协议接口 chrome-remote-interface 调试协议接口通过使用简单的JavaScript API提供命令和通知的简单抽象,帮助对 Chrome ( 或者其他任何适合实现的工具。) 提供了一个...
    • node.js:node.js连接
      node.js 来自Monggodb mongojs的node.js连接
    • Node.js-devtool-通过ChromeDevTools运行Node.js程序
      devtool - 通过Chrome Dev Tools运行Node.js程序
    • sinon-chrome:使用Node.js测试chrome扩展
      锡诺Chrome Sinon-chrome是用于对Chrome以及Firefox扩展程序和应用程序进行单元测试的帮助工具。 它使用sinon存根模拟所有扩展api,使您无需实际... script src =" /path/to/sinon-chrome.min.js " > 要么 < scr
    • Node.js-用于Node.jsChrome调试协议接口
      用于Node.jsChrome调试协议接口
    • SIM800C_MQTT.rar
      使用SIM800C模块,使用MQTT协议,连接中国移动onenet平台,能实现数据的订阅、发布、存储等