1

我已经阅读了很多关于command not found终端错误消息的帖子,但我找不到任何特定于surge.

surge在终端中使用该命令时遇到错误。我npm install --global surge在终端中运行,一切看起来都很好,但是当我运行命令surge时它返回command not found.

我电脑上的其他npm软件包工作正常。我测试了create-react-app,没有错误。我对此有点陌生,任何建议将不胜感激!

谢谢和欢呼!!

4

3 回答 3

8

只需使用 npx 浪涌而不是浪涌 :)

于 2020-08-01T10:11:36.887 回答
0

您确定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.

于 2020-06-11T16:19:26.320 回答
-1

您的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
于 2020-06-11T17:28:34.977 回答