在执行 vitest 的时候报错:
ERR_PNPM_RECURSIVE_RUN_FIRST_FAIL XXXX test: vitest
Exit status 1
ELIFECYCLE Command failed with exit code 1.
ERR_PNPM_RECURSIVE_RUN_FIRST_FAIL XXXX test: `vitest`
Exit status 1
ELIFECYCLE Command failed with exit code 1.
遇到这种报错的原因是 执行测试 code 是 1 的时候测试失败,可以通过 如下命令避免错误消息,便能看到精确地错误信息提示:
pnpm -s run test
我本地没有配置 localhost 所以会出现了如下错误提示:
[error] getaddrinfo ENOTFOUND localhost
at GetAddrInfoReqWrap.onlookup [as oncomplete] (node:internal/dns/promises:82:17)
[error]
此时需要去配置本地 hosts 文件,添加如下配置即可
127.0.0.1 localhost
如何更新 mac 的 hosts 文件见 mac 修改 hosts 文件