[英]Can't start Clinic.js, what should I do?
At startup: clinic doctor --on-port 'autocannon -m POST localhost:8000/users/register' -- node dist/main.js
启动时:
clinic doctor --on-port 'autocannon -m POST localhost:8000/users/register' -- node dist/main.js
Gives help log: Clinic.js Doctor - v9.2.0给出帮助日志:Clinic.js Doctor - v9.2.0
clinic doctor is the first step in profiling your application. clinic doctor 是分析您的应用程序的第一步。 It will show you what kind of problem you are having and recommend the path forward.
它会向您展示您遇到的问题类型并推荐前进的道路。
To run clinic doctor跑门诊医生
clinic doctor -- node server.js
Once you exit (Ctrl-C) the process, your report will open in a browser window. You can disable this behavior:退出 (Ctrl-C) 过程后,您的报告将在浏览器 window 中打开。您可以禁用此行为:
clinic doctor --open=false -- node server.js
If profiling on a server, it can be useful to only do data collection:如果在服务器上进行分析,仅进行数据收集可能很有用:
clinic doctor --collect-only -- node server.js
You can then transfer the data and visualize it locally:然后您可以传输数据并在本地可视化它:
clinic doctor --visualize-only PID.clinic-doctor-sample
You can use the --autocannon flag to simulate load on your server.您可以使用 --autocannon 标志来模拟服务器上的负载。 --autocannon accepts configuration for autocannon using "subarg" syntax:
--autocannon 接受使用“subarg”语法的 autocannon 配置:
clinic doctor --autocannon [ -m POST /api/example ] -- node server.js
When configuring --autocannon, the $PORT environment variable contains the port your server is listening on:配置 --autocannon 时,$PORT 环境变量包含您的服务器正在侦听的端口:
clinic doctor --autocannon [ -m POST 'http://localhost:$PORT/?\$page=1' ] -- node server.js
Note that dollar signs ($) appearing in the URL must be escaped, else they will be treated as environment variables as well.请注意,出现在 URL 中的美元符号 ($) 必须进行转义,否则它们也将被视为环境变量。
Flags -h |标志 -h | --help Display Help -v |
--help 显示帮助 -v | --version Display Version --collect-only Do not process data on termination --visualize-only datapath Build or rebuild visualization from data --sample-interval interval Sample interval in milliseconds --on-port Run a script when the server starts listening on a port.
--version 显示版本 --collect-only 终止时不处理数据 --visualize-only datapath 从数据构建或重建可视化 --sample-interval interval 以毫秒为单位的采样间隔 --on-port 在服务器启动时运行脚本监听一个端口。 --autocannon Run the autocannon benchmarking tool when the server starts listening on a port.
--autocannon 当服务器开始侦听端口时运行 autocannon 基准测试工具。 --open Boolean to enable or disable your report opening in your web browser.
--open Boolean 以启用或禁用在 web 浏览器中打开报告。 --dest Destination for the collected data (default.clinic/).
--dest 收集数据的目的地(default.clinic/)。
OS: Windows操作系统:Windows
If you're using Powershell to run it, it will not work.如果您使用 Powershell 来运行它,它将无法运行。 I don't know why exactly but I had the same issue.
我不知道为什么,但我遇到了同样的问题。 it's working fine with CMD.
它在 CMD 上运行良好。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.