因此,我的纱线已经过时(1.5.1),这使我一直感到困惑。
我非常想升级,但是没有答案对我有帮助。于是我去了,我以为我在npm和apt上都卸载了yarn。纱线-v仍为1.5.1。
在使用npm和apt进行纱线更新之前,我曾说过他们已将纱线更新为最新纱线。但是,该命令显然不会转到其版本。
我做到了 哪根纱 响应是一些文件路径。我决定要核查它所在的整个文件夹。
那确实可行,但是现在无论我如何重新安装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
所以它现在可以工作了。不确定但很高兴。
答案 0 :(得分:0)
尝试使用sudo运行命令