无法确定要运行的可执行文件
如果你收到以下错误:
🌐 If you receive the following error:
npm ERR! could not determine executable to run这可能有多种原因。
🌐 It could be for multiple reasons.
未安装二进制文件
🌐 Binary not installed
NPM 二进制文件的名称可能与 NPM 包不同。
🌐 NPM binaries can have different names than the NPM package.
如果你运行 npx remotion,但没有安装 @remotion/cli,它将会失败,因为 remotion 二进制文件是由 @remotion/cli 包提供的。
检查你是否安装了正确的包。
🌐 If you run npx remotion, and don't have @remotion/cli installed, it will fail because the remotion binary is supplied by the @remotion/cli package.
Check if you have the correct package installed.
Corepack 问题
🌐 Corepack issue
可能是因为你使用了 npx 命令,但项目配置为使用不同的包管理器。
🌐 It may be because you are using the npx command but the project is configured to use a different package manager.
如果启用了 Corepack,package.json 中的 packageManager 属性很重要:
🌐 If Corepack is enabled, the packageManager property in package.json matters:
package.json{ "packageManager": "pnpm@7.1.0" }
如果包管理器设置为除 npm 之外的其他选项,则 npx 命令可能会出现此错误信息。
🌐 If the package manager is set to something else than npm, then the npx command may give this error message.
决议
🌐 Resolution
为你的项目使用正确的命令运行器:
🌐 Use the correct command runner for your project:
- 如果包管理器设置为
pnpm,请使用pnpm exec而不是npx。 - 如果包管理器设置为
yarn,请使用yarn而不是npx。 - 如果包管理器设置为
bun,请使用bunx而不是npx。