【问题标题】:Yarn command not setup or working Linux Mint 18.2 Cinnamon纱线命令未设置或无法运行 Linux Mint 18.2 Cinnamon
【发布时间】:2019-03-26 07:25:31
【问题描述】:

所以我一直对我的纱线已过时(1.5.1)这一事实有疑问。

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

我之前使用 npm 和 apt 更新了 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

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

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

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

编辑

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

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

所以不知何故它现在正在工作。不确定,但很高兴。

【问题讨论】:

  • 我现在似乎可以在其他文件中使用它。但是我的纱线全局使用是 1.5.1,现在命令正在工作,我真的不知道为什么。留下这个可能的想法/答案,或者如果我找到了。

标签: npm yarnpkg apt linux-mint


【解决方案1】:

尝试使用 sudo 运行命令

【讨论】:

  • 我在控制台输出的第 5 行有:doom@doom-MacBookPro ~ $ sudo apt remove cmdtest && sudo apt remove yarn && sudo apt install yarn
猜你喜欢
  • 2020-08-17
  • 2022-01-21
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2016-11-15
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多