我已经阅读了很多关于command not found
终端错误消息的帖子,但我找不到任何特定于surge
.
surge
在终端中使用该命令时遇到错误。我npm install --global surge
在终端中运行,一切看起来都很好,但是当我运行命令surge
时它返回command not found
.
我电脑上的其他npm
软件包工作正常。我测试了create-react-app
,没有错误。我对此有点陌生,任何建议将不胜感激!
谢谢和欢呼!!
我已经阅读了很多关于command not found
终端错误消息的帖子,但我找不到任何特定于surge
.
surge
在终端中使用该命令时遇到错误。我npm install --global surge
在终端中运行,一切看起来都很好,但是当我运行命令surge
时它返回command not found
.
我电脑上的其他npm
软件包工作正常。我测试了create-react-app
,没有错误。我对此有点陌生,任何建议将不胜感激!
谢谢和欢呼!!
只需使用 npx 浪涌而不是浪涌 :)
您确定surge
已安装可执行文件吗?
你在什么外壳里?
如果在 中bash
,请尝试重新hash
:
hash [-lr] [-p filename] [-dt] [name]
Each time hash is invoked, the full pathname of the command name is determined by searching the directories in $PATH and remembered.
Any previously-remembered pathname is discarded. If the -p option is supplied, no path search is performed, and filename is used as
the full filename of the command. The -r option causes the shell to forget all remembered locations. The -d option causes the shell
to forget the remembered location of each name. If the -t option is supplied, the full pathname to which each name corresponds is
printed. If multiple name arguments are supplied with -t, the name is printed before the hashed full pathname. The -l option causes
output to be displayed in a format that may be reused as input. If no arguments are given, or if only -l is supplied, information
about remembered commands is printed. The return status is true unless a name is not found or an invalid option is supplied.
您的surge
终端当前的PATH
. 要检查是否是这种情况,请找到默认安装的二进制文件的位置(在我的机器中的/usr/local/bin
目录下找到)并检查该目录是否存在于您PATH
的 .
echo $PATH
如果不是,您可以通过运行添加它:
PATH=$PATH:/path/to/surge/location
然后检查它现在是否有效:
surge
如果是这种情况,要使此更改在重新启动后持续存在,您可以定义echo
当前PATH
:
echo $PATH
~/.bashrc
然后通过添加以下行将最后一个命令的结果导出到您的文件中:
export PATH=/previous/command/output/here