我正在安装sylius bundle,同时安装sylius,我需要运行纱线安装 当我运行命令时:
yarn install
我得到了错误:
ERROR: [Errno 2] No such file or directory: 'install'
我正在安装sylius bundle,同时安装sylius,我需要运行纱线安装 当我运行命令时:
yarn install
我得到了错误:
ERROR: [Errno 2] No such file or directory: 'install'
当前回答
yarn包(目前是cmdtest包的别名)的名称冲突。你要找的包装是yarnpkg。所以,试试这个命令:
sudo apt-get remove cmdtest
sudo apt-get install yarnpkg
不幸的是,在yarnpkg中,命令纱被命名为yarnpkg。你可能想要创建一个别名:
sudo ln -s /usr/bin/yarnpkg /usr/local/bin/yarn
其他回答
这对我很有效
sudo yarn install
所有正确建议删除Ubuntu yarn包并通过NPM安装yarn的答案都值得称赞,下面是一个详细的答案和解释(注意,还有意见):
从yarn安装中出现No such file or directory错误的原因是您没有使用“正确的”yarn:当您使用Ubuntu软件源安装yarn时,您得到的软件是来自cmdtest黑盒测试套件的“yarn”场景测试工具。这可能不是你的意思,因为Yarn也是Javascript应用程序的流行开发生命周期工具(类似于Make、Maven等)。
Javascript Yarn工具在Ubuntu软件源中是不可用的,但是可以通过NPM安装(NPM是Yarn想要取代的另一个开发生命周期工具——所以这很尴尬…)
要让Yarn在Ubuntu中可用,首先要删除cmdtest及其工具:
$ sudo apt purge cmdtest
然后确保NPM已经安装:
$ sudo apt install npm
然后使用NPM安装Yarn:
$ npm install -g yarn
Note: using npm install -g will install a Javascript package for your current user account, which should be fine for most purposes. If you want to install Yarn for all users, you can use sudo for the NPM command, but that is not recommended: NPM packages are rarely audited for security in the context of a multi-user operating system and installing some packages might even break when installing them as "root". NPM used to warn against running it with sudo and the main reason it is not doing so today is that it annoys people that use sandboxed "root-like" environments (such as Docker) for building and deploying Javascript applications for single-user servers.
我在ubuntu操作系统上也有同样的问题,我用sudo yarn install而不是yarn install解决了这个问题
为Ubuntu 16.04安装Yarn(不确定这是否会与14.04相同,因为它与zappee对17.04的回答略有不同)
curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | sudo apt-key add -
echo "deb https://dl.yarnpkg.com/debian/ stable main" | sudo tee /etc/apt/sources.list.d/yarn.list
curl -sL https://deb.nodesource.com/setup_9.x | sudo -E bash -
apt-get update
apt-get install nodejs
apt-get install yarn
然后从你安装sylius项目的地方(/var/www/mysite)
yarn install
yarn run gulp
注意:这个解决方案在Ubuntu 16.04, Ubuntu 17.04和Ubuntu 18.04上都能很好地工作。
尝试删除现有的cmdtest和yarn(这是*nix系统的遗留黑盒命令行工具的模块):
sudo apt remove cmdtest sudo apt remove yarn
通过npm简单安装
npm install -g yarn
OR
sudo npm install -g yarn
现在纱线已经安装好了。执行命令。
yarn install sylius
我希望这能奏效。干杯!
编辑:
请记住重新打开终端以使更改生效。