Fish shell、nvm 告诉我 node 和 npm 是 "currently not installed" 但它们是
Fish shell, nvm, is telling me that node and npm are "currently not installed" but they are
在 OS X Big Sur 最近更新了 fish、fisher、bass 和 nvm 之后,我在使用 fish shell 时遇到了 npm 和节点的问题。
$节点-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 似乎工作正常:
$ 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
节点版本切换成功
$ nvm 使用 v14
Now using node v14.16.0 (npm v6.14.11)
$哪个节点
/Users/brianfogel/.nvm/versions/node/v14.16.0/bin/node
$ 哪个 npm
/Users/brianfogel/.nvm/versions/node/v14.16.0/bin/npm
对于其他上下文,这里有一些可能有助于展示的其他内容:
$ 鱼 --version
fish, version 3.2.0
$ fisher --version
fisher, version 4.2.0
$ nvm -v
0.37.2
$猫~/.config/fish/functions/node.fish
function node -d "Server-side JavaScript runtime" -w node
__nvm_run "node" $argv
end
$猫~/.config/fish/functions/npm.fish
function npm -d "node package manager" -w npm
__nvm_run "npm" $argv
end
$猫~/.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
$猫/usr/local/bin/node
#! /usr/bin/env fish
__nvm_run "node" $argv
$猫/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 已更新。安装或更新插件可解决问题。
在 OS X Big Sur 最近更新了 fish、fisher、bass 和 nvm 之后,我在使用 fish shell 时遇到了 npm 和节点的问题。
$节点-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 似乎工作正常:
$ 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
节点版本切换成功
$ nvm 使用 v14
Now using node v14.16.0 (npm v6.14.11)
$哪个节点
/Users/brianfogel/.nvm/versions/node/v14.16.0/bin/node
$ 哪个 npm
/Users/brianfogel/.nvm/versions/node/v14.16.0/bin/npm
对于其他上下文,这里有一些可能有助于展示的其他内容:
$ 鱼 --version
fish, version 3.2.0
$ fisher --version
fisher, version 4.2.0
$ nvm -v
0.37.2
$猫~/.config/fish/functions/node.fish
function node -d "Server-side JavaScript runtime" -w node
__nvm_run "node" $argv
end
$猫~/.config/fish/functions/npm.fish
function npm -d "node package manager" -w npm
__nvm_run "npm" $argv
end
$猫~/.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
$猫/usr/local/bin/node
#! /usr/bin/env fish
__nvm_run "node" $argv
$猫/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 已更新。安装或更新插件可解决问题。