在Ionic2项目中使用Meteor有问题。项目本身应该运行,因为它是Meteor-教程:git clone https://github.com/Urigo/Ionic2CLI-Meteor-WhatsApp的克隆。
当我启动Meteor服务器时,我得到以下信息
=> Started proxy.
server/publications.ts (24, 10): Property 'publishComposite' does not exist on type 'typeof Meteor'.
server/main.ts (14, 28): Property '_options' does not exist on type 'typeof Accounts'.
server/main.ts (51, 14): Property 'createUserWithPhone' does not exist on type 'typeof Accounts'.
=> Started MongoDB.
=> Started your app.
=> App running at: http://localhost:3000/然后我用ionic serve启动离子型应用程序,并在终端中得到这个。
Running live reload server: http://localhost:35729
Watching: www/**/*, !www/lib/**/*, !www/**/*.map
√ Running dev server: http://localhost:8100当我打开应用程序时,我在浏览器的控制台中得到了这个错误:
Failed to load resource: the server responded with a status of 404 (Not Found) http://localhost:8100/sockjs/info?cb=_07sz35uj7据我所知,这意味着它试图从流星上获取数据,但无法到达。当我在浏览器中手动打开URL并将端口更改为3000时,我会从meteor获得一条消息。
我在Google上找到了两个提示:
1)启动不含肝负荷ionic serve --nolivereload的离子应用程序
2)将__meteor_runtime_config__设置为正确的URL:PORT
但是提示1不起作用,对于提示2,我不知道放在哪里。
在编写这篇文章时,我发现,在文件node_modules/meteor-client-side/meteor-runtime-config.js中,正确的端口由
__meteor_runtime_config__ = {};
__meteor_runtime_config__.DDP_DEFAULT_CONNECTION_URL = 'http://localhost:3000';所以看起来提示2也已经完成了。为什么它仍然试图通过错误的端口到达流星服务器,或者可能还有另一个问题?
发布于 2016-11-22 14:14:43
好吧,我自己又解决了。我不得不将这些代码添加到我的index.html项目的ionic2文件中:
<script>
__meteor_runtime_config__ = {
DDP_DEFAULT_CONNECTION_URL: 'http://localhost:3000'
};
</script>不知道,为什么忽略node_modules/meteor-client-side/meteor-runtime-config.js文件中的配置。
编辑:看起来好像有一个错误在1.3.5版本的https://github.com/idanwe/meteor-client-side/issues/28#issuecomment-263252756中被修复了
https://stackoverflow.com/questions/40742303
复制相似问题