流星app无法找到路线

时间:2016-08-18 21:52:12

标签: meteor

流星新手。刚刚克隆了一个git repo,在启动应用程序时,我收到router.js:347 There is no route for the path: /错误。

这是我在imports / startup / client / routes.js

中的root路由
FlowRouter.route('/', {
    name: 'Home',
    action() {
        BlazeLayout.render('app_body', {tabs: 'tabs', inbox: 'inbox', upload: 'upload', invite: 'invite'});
        console.log('root loaded');
    },
});

以下是包列表

    accounts-facebook                         1.0.10  Login service for Facebook accounts
accounts-password                         1.2.14* Password support for accounts
alanning:roles                            1.2.15  Authorization package for Meteor
aldeed:collection2                        2.9.1  Automatic validation of insert and update operations on the client and server.
aldeed:simple-schema                      1.5.3  A simple schema validation object with reactivity. Used by collection2 and autoform.
arillo:flow-router-helpers                0.5.2  Template helpers for flow-router
blaze-html-templates                      1.0.4  Compile HTML templates into reactive UI with Meteor Blaze
check                                     1.2.3  Check whether a value matches a pattern
dburles:collection-helpers                1.0.4  Transform your collections with helpers that you define
ecmascript                                0.5.7* Compiler plugin that supports ES2015+ in all .js files
email                                     1.1.16* Send email messages
es5-shim                                  4.6.13* Shims and polyfills to improve ECMAScript 5 support
hpx7:youtube-iframe-player                0.4.15  Control YouTube's embedded player using Meteor
http                                      1.2.8* Make HTTP calls to remote servers
jazeee:spiderable-longer-timeout          1.2.13  Extended spiderable package: SSL, caching, longer timeout, no stdin issues, publish flag
jchristman:tagsinput-autocomplete-edited  1.1.0+ A combination of the mizzao:autocomplete library and a tagsinput-like functionality
jquery                                    1.11.9  Manipulate the DOM using CSS selectors
kadira:blaze-layout                       2.3.0  Layout Manager for Blaze (works well with FlowRouter)
kadira:flow-router                        2.12.1  Carefully Designed Client Side Router for Meteor
keepnox:perfect-scrollbar                 0.6.8  Perfect-scrollbar packaged for meteor
manuel:reactivearray                      1.0.5  Reactive Array for Meteor
matb33:collection-hooks                   0.8.3* Extends Mongo.Collection with before/after hooks for insert/update/remove/find/findOne
meteor-base                               1.0.4  Packages that every Meteor app needs
meteorhacks:aggregate                     1.3.0  Proper MongoDB aggregations support for Meteor
mobile-experience                         1.0.4  Packages for a great mobile user experience
momentjs:moment                           2.14.4  Moment.js (official): parse, validate, manipulate, and display dates - official Meteor packaging
mongo                                     1.1.10* Adaptor for using MongoDB and Minimongo over DDP
reactive-dict                             1.1.8  Reactive dictionary
reactive-var                              1.0.10  Reactive variable
sacha:spin                                2.3.1  Simple spinner package for Meteor
saucecode:timezoned-synced-cron           1.2.11  Fork of original w/ timezone support. Define and run scheduled jobs across multiple servers.
session                                   1.1.6  Session variable
spiderable                                1.0.13  Makes the application crawlable to web spiders
standard-minifier-css                     1.1.8* Standard css minifier used with Meteor apps by default.
standard-minifier-js                      1.1.8* Standard javascript minifiers used with Meteor apps by default.
tomwasd:flow-router-seo                   0.0.3  A simple way to set the title and meta tags for sites using flow router
tracker                                   1.1.0  Dependency tracker to allow reactive callbacks
twbs:bootstrap                            3.3.6  The most popular front-end framework for developing responsive, mobile first projects on the web.

是什么导致应用程序找不到路由文件?我查看了以下帖子以获得一些指导,但没有找到。

Meteor Routing Error : There is no route for the path: /

https://github.com/kadirahq/flow-router/issues/608

https://github.com/kadirahq/flow-router/issues/185

http://coderchronicles.org/2016/04/08/getting-started-with-meteor-1-3-react-and-flowrouter/

任何帮助解决问题的人都将不胜感激。我觉得我错过了一些简单的东西。

-S

**项目文件结构

imports/
  startup/
    client/
      index.js               
      routes.js                 
    server/
      fixtures.js             
      index.js               
  api/               
     server/
        publications.js       

  ui/
    components/               

    layouts/                   
    pages/                     
client/
  main.js 
  head.js
  main.js                   
server/
  main.js
  fixtures.js
 server-global.js

3 个答案:

答案 0 :(得分:0)

您是否将路线文件导入应用程序的主容器?

例如,如果您有一个import '/imports/startup/client';文件在启动时从客户端加载,那么它应该包含对routes文件的导入引用,如下所示:

import '/imports/startup/client/routes.js';

或者,GET https://api.linkedin.com/v1/people/~?format=json Headers: Authorization = Bearer ${token} x-li-src = msdk

答案 1 :(得分:0)

将您的路径文件放在'imports / starup / lib'(例如lib)中。在快速渲染包中建议使用'lib',如果你想使用它。如果没有 - '客户';

然后确保在“root / client / main.js”中导入路径文件;

请阅读这部分文档:https://guide.meteor.com/structure.html#javascript-structure

这是非常有帮助的文章。

<强> UPD: 请删除client / main.js中的重复文件 在client / main.js中的时候

import '/imports/startup/client';

在您的imports / startup / client / index.js

import './routes.js';

现在它会起作用。 别忘了,您必须导入您想要在路线中使用的所有视图。

答案 2 :(得分:0)

问题已解决。不需要使用meteor run启动,而是需要使用meteor --settings settings.json --production

启动