沃梦达 / 编程问答 / php问题 / 正文

作曲家:找不到命令

Composer: Command Not Found(作曲家:找不到命令)

本文介绍了作曲家:找不到命令的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在包含我的 composer.phar 文件的目录中,我无法执行任何 composer 命令.

From within the directory holding my composer.phar file, I can't execute any composer commands.

执行时可以看到 Composer 正在运行

I can see Composer is running when I execute

php composer.phar 

但是任何直接的作曲家语句都会失败.

But any direct composer statements fail.

不确定是否重要,但 Composer 包含在克隆的存储库中.

Not sure if it matters but Composer was included within a cloned repository.

我只想安装一个 Oauth 库,然后可能几个月都不会再接触 Composer,所以我不需要在全局范围内运行它.我只是很困惑为什么我不能从这个目录中运行 Composer.

I just want to install a single Oauth library, then likely not touch Composer again for several months, so I don't need to run it globally. I'm just confused why I can't run Composer from within this directory.

推荐答案

您的 composer.phar 命令缺少可执行标志,或者它不在路径内.

Your composer.phar command lacks the flag for executable, or it is not inside the path.

第一个问题可以通过 chmod +x composer.phar 来解决,第二个问题可以通过调用 ./composer.phar -v 来解决.

The first problem can be fixed with chmod +x composer.phar, the second by calling it as ./composer.phar -v.

您必须为不在路径中的可执行文件加上对 Unix 中当前路径的显式引用的前缀,以避免进入一个目录,该目录的可执行文件名称看起来像一个普通命令,但是不是.想想当前目录中的一个cat,它不会列出文件,而是删除它们.

You have to prefix executables that are not in the path with an explicit reference to the current path in Unix, in order to avoid going into a directory that has an executable file with an innocent name that looks like a regular command, but is not. Just think of a cat in the current directory that does not list files, but deletes them.

解决第二个问题的替代方法和更好的方法是将 composer.phar 文件放入路径中提到的位置

The alternative, and better, fix for the second problem would be to put the composer.phar file into a location that is mentioned in the path

这篇关于作曲家:找不到命令的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!

本文标题为:作曲家:找不到命令

基础教程推荐