如何打开 chrome 浏览器到 chrome 开发工具 url

How to open the chrome browser to a chrome dev tool url

使用最新版本的节点,

正在键入 node --inspect ajavascriptfile.js

输出一个url供您在chrome浏览器中访问,太棒了!

(V8 检查器文档 here

但是我怎样才能用我的终端打开那个url?

我可以打开浏览器查找文件或 urls:

open -a Google\ Chrome ./path/to/file.html

open -a Google\ Chrome http://google.com

但对 url 进行同样的尝试:

open -a Google\ Chrome chrome-devtools://devtools/remote/se...

给我错误:

The file /Users/samhouston/proj/chrome-devtools:/devtools/remote/se... does not exist.

如何让 chrome 通过我的终端打开它的浏览器到这个 url?

在此先感谢您的帮助

open 不支持 chrome-devtools 协议,因此它只是尝试打开本地文件路径。由于它不存在,它会给你你得到的错误。

我四处寻找另一种解决方案,发现您可以使用 osascript 告诉应用程序本身打开 URL。

/Applications/Google\ Chrome.app/Contents/MacOS/Google\ Chrome & osascript -e 'tell application "Google Chrome" to open location "chrome-devtools://devtools/remote/serve_file/@60cd6e859b9f557d2312f5bf532f6aec5f284980/inspector.html?experiments=true&v8only=true&ws=localhost:9229/node"'