我正在安装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'
当前回答
删除错误包:
sudo apt-get purge cmdtest
sudo apt-get purge yarn
使用npm安装(推荐方式):
建议通过npm包管理器安装Yarn,当你在你的系统上安装它时,npm包管理器与Node.js捆绑在一起。
一旦你安装了npm,你可以运行以下命令来安装和升级Yarn:
npm install --global yarn
替代方法:
Debian / Ubuntu
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
sudo apt update && sudo apt install yarn
其他回答
sudo npm install -g yarnpkg
npm WARN deprecated yarnpkg@0.15.1: Please use the `yarn` package instead of `yarnpkg`
这对我来说是可行的
sudo npm install -g yarn
也有此问题(windows),修复是完全关闭所有终端实例,然后重试。
博士TL; //运行这些命令(在Ubuntu 17.04及以上版本上测试) curl - ss https://dl.yarnpkg.com/debian/pubkey.gpg | sudo apt-key add - 回显"deb https://dl.yarnpkg.com/debian/ stable main" | sudo tee /etc/apt/sources.list.d/yarn.list Sudo apt-get update && Sudo apt-get install yarn
额外提示:查看官方文档/指南,在其他Ubuntu版本上安装yarn &注意额外的cmdtest错误。https://yarnpkg.com/lang/en/docs/install/#debian-stable
如果你没有安装curl,你可以使用sudo apt install curl安装它
所有正确建议删除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 17.04上也遇到了同样的问题。
这个解决方案对我很有效:
sudo apt remove cmdtest
sudo apt remove yarn
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
sudo apt-get update
sudo apt-get install yarn -y
then
yarn install
结果:
yarn install v1.3.2
warning You are using Node "6.0.0" which is not supported and may encounter bugs or unexpected behaviour. Yarn supports the following server range: "^4.8.0 || ^5.7.0 || ^6.2.2 || >=8.0.0"
info No lockfile found.
[1/4] Resolving packages...
[2/4] Fetching packages...
[3/4] Linking dependencies...
[4/4] Building fresh packages...
info Lockfile not saved, no dependencies.
Done in 0.20s.