- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
在最近更新了 OS X Big Sur 上的 fish、fisher、bass 和 nvm 之后,我在使用 fish shell 时遇到了 npm 和 node 问题。
$ node -v
type: Invalid combination of options
Fish nvm: 'node' is currently not installed, try running npm i -g node
$ npm -v
type: Invalid combination of options
Fish nvm: 'npm' is currently not installed, try running npm i -g npm
NVM 似乎工作正常:
-> v10.16.0
v12.4.0
v12.16.1
v13.11.0
v14.16.0
system
default -> 10.16.0 (-> v10.16.0)
iojs -> N/A (default)
unstable -> N/A (default)
node -> stable (-> v14.16.0) (default)
stable -> 14.16 (-> v14.16.0) (default)
lts/* -> lts/fermium (-> v14.16.0)
lts/argon -> v4.9.1 (-> N/A)
lts/boron -> v6.17.1 (-> N/A)
lts/carbon -> v8.17.0 (-> N/A)
lts/dubnium -> v10.24.0 (-> N/A)
lts/erbium -> v12.21.0 (-> N/A)
lts/fermium -> v14.16.0
它成功地切换了 Node 版本。
Now using node v14.16.0 (npm v6.14.11)
$哪个 Node
/Users/brianfogel/.nvm/versions/node/v14.16.0/bin/node
$ which npm
/Users/brianfogel/.nvm/versions/node/v14.16.0/bin/npm
对于其他上下文,这里有一些其他可能有助于展示的内容:
fish, version 3.2.0
$ Fisher --version
fisher, version 4.2.0
$ nvm -v
0.37.2
$ cat ~/.config/fish/functions/node.fish
function node -d "Server-side JavaScript runtime" -w node
__nvm_run "node" $argv
end
$ cat ~/.config/fish/functions/npm.fish
function npm -d "node package manager" -w npm
__nvm_run "npm" $argv
end
$ cat ~/.config/fish/functions/nvm.fish
function nvm
if not type -q bass
echo 'Bass is not installed please install it running fisher edc/bass'
return
end
set -q NVM_DIR; or set -gx NVM_DIR ~/.nvm
set -q nvm_prefix; or set -gx nvm_prefix $NVM_DIR
bass source $nvm_prefix/nvm.sh --no-use ';' nvm $argv
set bstatus $status
if test $bstatus -gt 0
return $bstatus
end
if test (count $argv) -lt 1
return 0
end
if test $argv[1] = "use"; or test $argv[1] = "install"
set -g NVM_HAS_RUN 1
end
end
$ cat/usr/local/bin/node
#! /usr/bin/env fish
__nvm_run "node" $argv
$ cat/usr/local/bin/npm
#!/usr/bin/env fish
__nvm_run "npm" $argv
$ $ set --show fish_user_paths
$fish_user_paths: set in global scope, unexported, with 10 elements
$fish_user_paths[1]: |/Users/brianfogel/.pub-cache/bin|
$fish_user_paths[2]: |/Users/brianfogel/flutter/flutter/.pub-cache/bin|
$fish_user_paths[3]: |/Users/brianfogel/flutter/flutter/bin|
$fish_user_paths[4]: |/usr/local/sbin|
$fish_user_paths[5]: |/Applications/Postgres.app/Contents/Versions/latest/bin|
$fish_user_paths[6]: |/Users/brianfogel/.npm-global/bin|
$fish_user_paths[7]: |/usr/local/Cellar/php/7.3.4_1/bin|
$fish_user_paths[8]: |/usr/local/sbin|
$fish_user_paths[9]: |/Applications/Postgres.app/Contents/Versions/latest/bin|
$fish_user_paths[10]: |/Users/brianfogel/.yarn/bin|
$fish_user_paths: set in universal scope, unexported, with 4 elements
$fish_user_paths[1]: |/Users/brianfogel/.npm-global/bin|
$fish_user_paths[2]: |/usr/local/sbin|
$fish_user_paths[3]: |/Applications/Postgres.app/Contents/Versions/latest/bin|
$fish_user_paths[4]: |/Users/brianfogel/.yarn/bin|
最佳答案
https://github.com/FabioAntunes/fish-nvm已经更新。安装或更新插件可解决此问题。
关于node.js - fish shell nvm 告诉我 node 和 npm 是 "currently not installed"但它们是,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/66464067/
为了对 fish 提示进行一些小的更改,我修改了 ~/.config/fish/目录中的 fish_prompt.fish/fish_right_prompt.fish 文件,但这并没有改变任何东西。
在 Fish 中是否有可能以我将命令定义为 echo 等命令的单个参数的方式执行命令替换?在 Bash 中,它等同于例如: $ echo "$(cat file.txt)" lorem ipsum F
所以,我真的很喜欢 Fish - 但我需要一些脚本方面的帮助。 尤其是找到正在运行的脚本的路径。 这是BASH的解决方案 Getting the source directory of a Bash
我正在从 ZSH 迁移到 Fish,我唯一没弄清楚的是我的 c功能: 函数/c: #!/bin/sh cd "$PROJECTS/$1" 函数/_c: #compdef c _files -W $PR
快速提问。是否可以通过在 fish 中编写脚本来定义新命令?我想按照以下方式编写一个新命令: newFunction --flag1 flag1Input --flag2 flag2Input the
我从 fish 开始,我在大量文档中找不到的其中一件事是自动完成提要。 提到了 Tab Completions在本教程中,但它解决了机制本身的存在,而不是它的配置。 我有一堆通过 连接的虚拟机 mac
在 bash shell 脚本,我通常会运行 :> file清空文件。 现在使用fish,情况略有不同,上面的命令不起作用。 什么是 fish 当量? 最佳答案 虽然没有:那么短, true是一个可以
我已经仔细阅读了fish shell 文档,我正在尝试弄清楚如何在fish 函数中有条件地设置局部变量。 换句话说,如果您有一个函数,并且希望使用 if-then-else 逻辑修改局部变量。 fun
如果我将一个名为 myfunc.fish 的文件放在名为 functions 的目录中,并且它包含一个名为 myfunc 的函数,那么如果我将 myfunc 作为命令键入,fish 将找到它。 如果我
我在不同的地方(家庭网络、云……)有无数台机器,我在每台机器上都使用了fish。问题是每次更改其中的内容时我都必须同步它们的配置。 有没有办法从远程存储库加载配置? (= 存储它的地方,不一定是 gi
我有一个包含多个项目的目录,我想对每个项目运行一些命令。 现在我正在做的是: cd /my/project/root set root (pwd) for p in * cd $p git r
有another question关于测试特定 字符串的命令替换。我想测试一个命令是否在单个语句中输出任何内容,即等同于: if [[ -n "$(foo)" ]] 在庆典中。 Fish 无法识别 [
我想在 fish 中添加一个带有空格的别名,如下所示: alias hello there 'print hello there' 这有可能吗? (我知道这个例子是无效的,我只是举个例子)。 提前致谢
我想将字符串重定向到命令的 STDIN 中。 我会使用类似 cmd <<< "my string" 的东西来做它在 Bash 中,甚至 cmd <
如何使 ~/.config/fish/config.fish 中定义的别名和~/.config/fish/functions 中定义的函数root 用户也可以使用吗? 符号链接(symbolic li
my-fish-script a b c d 假设你想从第二个参数开始获取所有参数,所以 b c d . 在 bash 中,您可以使用 shift转储第一个参数并使用 "$@" 访问其余参数. 你将如
Fish是否可以根据您所在的目录自动加载其他配置? 一个可能的例子,但是显然这是行不通的。您导航到项目文件夹: cd ~/my_proj 该文件夹中有一个名为.fish.config的文件,其中包含一
我查看了 Stack Overflow 上的所有类似问题,并在他们的文档中尝试了很多东西。我目前的尝试如下。 我想要完成的是基于计算机用户的不同行为。我有一台工作电脑和一台家用电脑,当我在命令行中输入
这是2.1.0版本 $ set a foo $ set b bar $ echo $a_$b $ echo {$a}_$b foo_bar 为什么第一个“echo”没有输出任何东西?我本以为会看到“酒
我是 Windows 用户。我正在通过 WSL-2 尝试 Ubuntu。我正在努力在 fish shell 中选择带有箭头键的文本。我尝试了很多地方来回答这个问题,但没有人给我合适的解决方案。在文档中
我是一名优秀的程序员,十分优秀!