Ionic2与流星
问题描述:
我在Ionic2项目中使用流星有问题。 本身应该运行该项目,因为它是流星教程的克隆: git clone https://github.com/Urigo/Ionic2CLI-Meteor-WhatsApp
Ionic2与流星
当我开始流星服务器我得到这个
=> 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
当我打开App我得到这个错误在浏览器的控制台:
Failed to load resource: the server responded with a status of 404 (Not Found) http://localhost:8100/sockjs/info?cb=_07sz35uj7
据我所知,这意味着它试图从流星中获取数据,但无法达到它。当我手动打开浏览器中的URL并将端口更改为3000
时,我从流星返回一条消息。
我发现谷歌2个提示:
1)启动离子应用,但不livereload 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也已经完成。 为什么它仍然试图通过错误的端口到达流星服务器,或者可能存在另一个问题?
答
好的,我自己解决它。 我不得不这些代码行添加到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