从登录页面(使用 keystonejs 4.0 beta4)得到控制台错误“意外令牌 <”
Got console error `unexpected token <` from sign in page (using keystonejs 4.0 beta4)
我已经使用 webpack 将 keystone 添加到我现有的 MERN 服务器。服务器启动没有错误。
但是,当我尝试访问 /keystone/signin
(由 /keystone
重定向)时,它给出了一个空白页面和来自 signin?from=/keystone/js/packages.js:1
和 [=15 的控制台错误 Uncaught SyntaxError: Unexpected token <
=]
signin.js中的内容为
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="initial-scale=1.0,user-scalable=no,maximum-scale=1,width=device-width">
<meta http-equiv="x-ua-compatible" content="ie=edge">
<title>Sign in to OneCharge</title>
<link rel="stylesheet" href="/keystone/styles/keystone.min.css">
<link rel="shortcut icon" href="/favicon.ico" type="image/x-icon">
</head>
<body>
<div id="signin-view"></div>
<script>
var Keystone = {"adminPath":"/keystone","brand":"My Site","csrf":{"header":{"x-csrf-token":"vIRAZlZwZae640a645fd60ed9e8ca9911111a05ce088c8095c"}},"from":"/keystone/js/signin.js","userCanAccessKeystone":false};
</script>
<script src="/keystone/js/packages.js"></script>
<script src="/keystone/js/signin.js"></script>
</body>
</html>
任何解决问题的提示都可能有所帮助。
我找到了问题的解决方案,在这里回答了我自己的问题。
原来按照这里的指南对我不起作用How to add keystone to an existing express app。
从 keystone 存储库中查找代码后。我找到了一个 test project,里面有我需要的一切,也许还有其他想要使用 keystone 的人。
我遵循了测试项目 repo 中的配置并且工作得非常棒!
我已经使用 webpack 将 keystone 添加到我现有的 MERN 服务器。服务器启动没有错误。
但是,当我尝试访问 /keystone/signin
(由 /keystone
重定向)时,它给出了一个空白页面和来自 signin?from=/keystone/js/packages.js:1
和 [=15 的控制台错误 Uncaught SyntaxError: Unexpected token <
=]
signin.js中的内容为
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="initial-scale=1.0,user-scalable=no,maximum-scale=1,width=device-width">
<meta http-equiv="x-ua-compatible" content="ie=edge">
<title>Sign in to OneCharge</title>
<link rel="stylesheet" href="/keystone/styles/keystone.min.css">
<link rel="shortcut icon" href="/favicon.ico" type="image/x-icon">
</head>
<body>
<div id="signin-view"></div>
<script>
var Keystone = {"adminPath":"/keystone","brand":"My Site","csrf":{"header":{"x-csrf-token":"vIRAZlZwZae640a645fd60ed9e8ca9911111a05ce088c8095c"}},"from":"/keystone/js/signin.js","userCanAccessKeystone":false};
</script>
<script src="/keystone/js/packages.js"></script>
<script src="/keystone/js/signin.js"></script>
</body>
</html>
任何解决问题的提示都可能有所帮助。
我找到了问题的解决方案,在这里回答了我自己的问题。
原来按照这里的指南对我不起作用How to add keystone to an existing express app。
从 keystone 存储库中查找代码后。我找到了一个 test project,里面有我需要的一切,也许还有其他想要使用 keystone 的人。
我遵循了测试项目 repo 中的配置并且工作得非常棒!