ndb README

The project's README from github.com/GoogleChromeLabs/ndb. As one markdown file: README.md.

ndb

Build Status NPM ndb package

ndb is an improved debugging experience for Node.js, enabled by Chrome DevTools

Installation

Compatibility: ndb requires Node >=8.0.0. It works best with Node >=10.

Installation: ndb depends on Puppeteer which downloads a recent version of Chromium (~170MB Mac, ~280MB Linux, ~280MB Win).

# global install with npm:
npm install -g ndb


# alternatively, with yarn:
yarn global add ndb

Global installation may fail with different permission errors, you can find help in this thread.

Windows users: Installation may fail on Windows during compilation the native dependencies. The following command may help: npm install -g windows-build-tools

Local install

If you want ndb available from an npm script (eg. npm run debug runs ndb index.js), you can install it as a development dependency:

# local install with npm:
npm install --save-dev ndb


# alternatively, with yarn:
yarn add ndb --dev

You can then set up an npm script. In this case, ndb will not be available in your system path.

Getting Started

You can start debugging your Node.js application using one of the following ways:

ndb server.js

# Alternatively, you can prepend `ndb`
ndb node server.js
# If you use some other binary, just prepend `ndb`
## npm run unit
ndb npm run unit

# Debug any globally installed package
## mocha
ndb mocha

# To use a local binary, use `npx` and prepend before it
ndb npx mocha
# cd to your project folder (with a package.json)
ndb .
# In Sources panel > "NPM Scripts" sidebar, click the selected "Run" button 
ndb --prof npm run unit

What can I do?

ndb has some powerful features exclusively for Node.js:

  1. Child processes are detected and attached to.
  2. You can place breakpoints before the modules are required.
  3. You can edit your files within the UI. On Ctrl-S/Cmd-S, DevTools will save the changes to disk.
  4. By default, ndb blackboxes all scripts outside current working directory to improve focus. This includes node internal libraries (like _stream_wrap.js, async_hooks.js, fs.js) This behaviour may be changed by "Blackbox anything outside working dir" setting.

In addition, you can use all the DevTools functionality that you've used in typical Node debugging:

Screenshot

image

Contributing

Check out contributing guide to get an overview of ndb development.

Thanks to the 'OG' ndb

In early 2011, @smtlaissezfaire released the first serious debugger for Node.js, under the ndb package name. It's still preserved at github.com/smtlaissezfaire/ndb. We thank Scott for generously donating the package name.

ndb (GoogleChromeLabs/ndb)

Searching Database…

10.9K ·GitHub
archived
这是什么东西?ndb 是基于 Chrome DevTools 打造的 Node.js 调试工具,体验更好:你可以在熟悉的 DevTools 界面里调试应用,还额外获得了专门为 Node 设计的实用功能。
它是只能在终端里用的调试器,还是有图形界面?它是图形界面的调试器,不是终端工具:ndb 会把 Chrome DevTools 的界面作为一个独立的桌面应用打开。你可以单独启动它,它还内置了终端,可以运行 node 命令并自动连接。
怎么安装?安装包有多大?用 npm 全局安装(npm install -g @ndbjs/ndb)。它要求 Node >=8.0.0,在 Node >=10 上效果最好。注意下载量不小:Puppeteer 会附带下载 Chromium(Mac 上约 170MB,Linux 和 Windows 上约 280MB)。
安装时有什么已知的坑吗?有几个。全局安装可能因为权限问题而失败;在 Windows 上,编译原生依赖时构建可能失败——通常运行 npm install -g windows-build-tools 就能解决。
ndb 还在维护吗?不维护了。GitHub 仓库已经归档,变成了只读状态,不再接收更新和 bug 修复。你仍然可以安装使用,但在最新的 Node 版本上可能会遇到各种问题。
为什么叫 ndb?这个名字有段来历:2011 年初,@smtlaissezfaire 在 ndb 这个包名下发布了第一个真正可用的 Node.js 调试器。Google 团队感谢他把名字让了出来,原项目保存在 github.com/smtlaissezfaire/ndb。
Size
0.7 MB
Stars
10.9K
Updated
CommitSep 12
Age
8y
Commits · 90 Days