当一个包无法安装或发布时,npm CLI 会生成一个 npm-debug.log 文件。这个日志文件可以帮助你找出问题所在。

🌐 When a package fails to install or publish, the npm CLI will generate an npm-debug.log file. This log file can help you figure out what went wrong.

如果你需要生成一个 npm-debug.log 文件,你可以运行以下命令之一。

🌐 If you need to generate a npm-debug.log file, you can run one of these commands.

对于安装包:

🌐 For installing packages:

npm install --timing

对于发布包:

🌐 For publishing packages:

npm publish --timing

你可以在你的 .npm 目录中找到 npm-debug.log 文件。要找到你的 .npm 目录,请使用 npm config get cache

🌐 You can find the npm-debug.log file in your .npm directory. To find your .npm directory, use npm config get cache.

如果你使用 CI 环境,你的日志很可能位于其他地方。例如,在 Travis CI 中,你可以在 /home/travis/build 目录中找到它们。

🌐 If you use a CI environment, your logs are likely located elsewhere. For example, in Travis CI, you can find them in the /home/travis/build directory.