我正在使用 generator-angular-fullstack。
在我的本地机器上工作正常,我运行
grunt serve
它启动了服务器,但在 VPS 中它失败了
Warning: Command failed: xdg-open: no method available for opening 'http://localhost:9000'
我已经安装了 xdg-utils
$ sudo apt-get install xdg-utils
Reading package lists... Done
Building dependency tree
Reading state information... Done
xdg-utils is already the newest version.
任何人都可以解释我做错了什么吗?
最佳答案
您是否尝试过配置 xdg-open
处理程序?
另外,您是否确保在您的服务器上安装了浏览器?使用 apt-get install <browser>
安装新浏览器应该自动使 xdg-open
意识到这一点。但是,根据浏览器/xdg-utils 的安装顺序,您的设置可能没有做到这一点。
要使事情恢复正常需要运行 xdg-settings
.
设置 http://
处理程序到您的首选浏览器(在 headless 服务器上可能是 w3m
、 lynx
或 elinks
),执行以下操作:xdg-settings set default-web-browser w3m.desktop
要验证,您可以运行 xdg-open https://stackoverflow.com/questions/24683221
你应该在 w3m 中看到你的答案。
如果您没有 w3m
可用,使用 sudo apt-get install w3m
安装它
您可能希望通过运行 xdg-settings --list
来查看其他可用的处理程序。 ,在我的系统上,输出以下内容:
Known properties:
default-url-scheme-handler Default handler for URL scheme
default-web-browser Default web browser
编辑:
事实证明,一些旧系统(ubuntu 10.04)没有
xdg-settings
,还有 update-alternatives
命令应该自动配置 xdg-open
.像这样: sudo update-alternatives --config www-browser
关于express - xdg-打开 : no method available even after installing xdg-utils,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24683221/