gpt4 book ai didi

npm - Yarn 命令未设置或无法运行 Linux Mint 18.2 Cinnamon

转载 作者:行者123 更新时间:2023-12-03 15:47:30 25 4
gpt4 key购买 nike

所以我的 yarn 已经过时 (1.5.1),这让我一直有问题。

我非常想升级,但没有答案对我有帮助。然后我去了,我想我在 npm 和 apt 上都卸载了 yarn。 yarn -v 仍然是 1.5.1。

我之前使用 npm 和 apt 更新了 yarn,他们说他们已经更新到最新的 yarn。但是,该命令显然不会转到他们的版本。

我做到了 哪根 yarn 响应是一些文件路径。我决定对它所在的整个文件夹进行核对。

那确实有效,但现在无论我如何重新安装 yarn ,我都无法让命令正常工作,它指向旧路径: 哪根 yarn 然后继续提示在那里找不到任何东西。

这是删除 cmdtest/yarn/然后重新安装 yarn 的一点输出:

doom@doom-MacBookPro ~ $ which yarn
/usr/local/bin/yarn
doom@doom-MacBookPro ~ $ yarn
-bash: /home/doom/.yarn/bin/yarn: No such file or directory
doom@doom-MacBookPro ~ $ sudo apt remove cmdtest && sudo apt remove yarn && sudo apt install yarn
Reading package lists... Done
Building dependency tree
Reading state information... Done
Package 'cmdtest' is not installed, so not removed
The following packages were automatically installed and are no longer required:
containerd libdb5.3++ libfltk1.1 libllvm4.0 libllvm4.0:i386 libllvm5.0
libllvm5.0:i386 libmikmod3 libosmesa6 libportmidi0 libsdl-mixer1.2
libsdl-ttf2.0-0 libsmpeg0 libtinyxml2.6.2v5 mokutil python-numpy
python-pygame runc ttf-dejavu-core
Use 'sudo apt autoremove' to remove them.
0 upgraded, 0 newly installed, 0 to remove and 106 not upgraded.
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following packages were automatically installed and are no longer required:
containerd libdb5.3++ libfltk1.1 libllvm4.0 libllvm4.0:i386 libllvm5.0
libllvm5.0:i386 libmikmod3 libosmesa6 libportmidi0 libsdl-mixer1.2
libsdl-ttf2.0-0 libsmpeg0 libtinyxml2.6.2v5 mokutil python-numpy
python-pygame runc ttf-dejavu-core
Use 'sudo apt autoremove' to remove them.
The following packages will be REMOVED:
yarn
0 upgraded, 0 newly installed, 1 to remove and 106 not upgraded.
After this operation, 4 596 kB disk space will be freed.
Do you want to continue? [Y/n] y
(Reading database ... 387271 files and directories currently installed.)
Removing yarn (1.10.1-1) ...
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following packages were automatically installed and are no longer required:
containerd libdb5.3++ libfltk1.1 libllvm4.0 libllvm4.0:i386 libllvm5.0
libllvm5.0:i386 libmikmod3 libosmesa6 libportmidi0 libsdl-mixer1.2
libsdl-ttf2.0-0 libsmpeg0 libtinyxml2.6.2v5 mokutil python-numpy
python-pygame runc ttf-dejavu-core
Use 'sudo apt autoremove' to remove them.
The following NEW packages will be installed:
yarn
0 upgraded, 1 newly installed, 0 to remove and 106 not upgraded.
Need to get 0 B/796 kB of archives.
After this operation, 4 596 kB of additional disk space will be used.
Selecting previously unselected package yarn.
(Reading database ... 387254 files and directories currently installed.)
Preparing to unpack .../archives/yarn_1.10.1-1_all.deb ...
Unpacking yarn (1.10.1-1) ...
Setting up yarn (1.10.1-1) ...
doom@doom-MacBookPro ~ $ yarn -v
-bash: /home/doom/.yarn/bin/yarn: No such file or directory
doom@doom-MacBookPro ~ $

在我的 .bashrc 中

export PATH="$HOME/.yarn/bin:$HOME/.config/yarn/global/node_modules/.bin:$PATH"

一些额外的信息:

doom@doom-MacBookPro ~ $ whereis yarn
yarn: /usr/bin/yarn /usr/local/bin/yarn /usr/share/yarn
doom@doom-MacBookPro ~ $ yarn -v
-bash: /home/doom/.yarn/bin/yarn: No such file or directory

非常感谢您抽出宝贵时间,我真的希望有人比我更清楚该做什么。

我怀疑在某处设置了命令部分,以便它强制指向特定路径...

与其手动执行此操作,我真的更喜欢安装设置命令,因为这似乎是其他人的行为方式,就像他们的 yarn 一样。

编辑

所以就在我开始工作之前,我确实输入了这个:

doom@doom-MacBookPro ~ $ yarn -v
-bash: /home/doom/.yarn/bin/yarn: No such file or directory
doom@doom-MacBookPro ~ $ man yarn
No manual entry for yarn
See 'man 7 undocumented' for help when manual pages are not available.
doom@doom-MacBookPro ~ $ export PATH="$PATH:$(yarn global bin)"
-bash: /home/doom/.yarn/bin/yarn: No such file or directory
doom@doom-MacBookPro ~ $ yarn global
yarn global v1.10.1
error Invalid subcommand. Try "add, bin, dir, ls, list, remove, upgrade, upgrade-interactive"
info Visit https://yarnpkg.com/en/docs/cli/global for documentation about this command.

然后我真的做了:

doom@doom-MacBookPro ~ $ yarn global -v
1.10.1
doom@doom-MacBookPro ~ $ cd Desktop/
doom@doom-MacBookPro ~/Desktop $ cd Rails
doom@doom-MacBookPro ~/Desktop/Rails $ yarn -v
1.10.1

所以它现在可以正常工作了。不确定但很高兴。

最佳答案

尝试使用 sudo 运行命令

关于npm - Yarn 命令未设置或无法运行 Linux Mint 18.2 Cinnamon,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/52925632/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com