我已经阅读了很多关于终端中command not found
错误消息的帖子,但我找不到任何特定于surge
的帖子。
我在终端中使用surge
命令时遇到错误。我在终端中运行了npm install --global surge
,一切看起来都很好,但是当我运行命令surge
它返回command not found
.
我计算机上的其他npm
软件包工作正常。我测试了create-react-app
,没有错误。我对此有些陌生,任何建议将不胜感激!!
谢谢和干杯!!
只需使用 npx 浪涌而不是浪涌 :)
您确定安装了surge
可执行文件吗?
你在哪个壳里?
如果在bash
中,请尝试重新hash
-ing:
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.
终端的当前PATH
中可能缺少surge
二进制文件。要检查是否是这种情况,请找到默认情况下安装二进制文件的位置(在我的机器中位于/usr/local/bin
目录下(,然后通过运行以下命令检查该目录是否存在于您的PATH
中:
echo $PATH
如果不是,您可以通过运行以下命令来添加它:
PATH=$PATH:/path/to/surge/location
然后检查它现在是否有效:
surge
如果是这种情况,要使此更改在重新启动后保持不变,您可以echo
您定义的当前PATH
:
echo $PATH
然后通过添加以下行将最后一个命令的结果导出到~/.bashrc
文件中:
export PATH=/previous/command/output/here