这个“方案没有注册处理程序”错误是什么?

问题描述 投票:0回答:5

我正在开发一个节点应用程序。 我有一个 ejs 文件,单击按钮就会向此 url 发出获取请求

localhost:3000/posts/business-economics
但页面未加载,并且此错误显示在控制台中

无法启动“localhost:3000/posts/business-economics”,因为该方案没有注册处理程序。

node.js handler
5个回答
183
投票

我在使用本地主机时遇到了同样的错误。我试图重定向到 localhost:3000,但控制台上闪烁着此错误。 事实证明,这是因为您尝试加载的网址中缺少 http://。我很惊讶地发现还没人回答这个问题。


17
投票

您必须在 url 之前设置地址协议,例如:

returnUrl = window.location.protocol + "//" + window.location.host + Path

7
投票

如果 url 缺少协议 http 或 https。我也面临的另一个原因。如果 href 标签的 javascript 拼写错误

<a href="javascript:;" onclick="myfunction()">Action</a>

0
投票

最终,格式错误的 URL 可能会以此类错误结束。

第一个参数格式错误的 window.open 命令也可能会引发此错误:

var emptyWindow = window.open('Window title', '_blank');
// Console output: 
// Failed to launch 'Window%20title' 
// because the scheme does not have a registered handler.'

在上面的例子中,开发者(我,不久前)忘记了即使你想打开一个空白页面,第一个参数也必须在那里:

var emptyWindow = window.open('', 'Window title', '_blank');

该值是可选的,但参数本身不是可选的。

格式错误的第一个参数也可能会引发相同的错误。


-7
投票

有时,只需重新启动您的应用程序就可能会更改某些内容,或者再次检查您提供的 url 路径也可能是一个错误

© www.soinside.com 2019 - 2024. All rights reserved.