2017-10-14 10 views
0

私の目標は、Urigoのmeteor-angular2.0の例の中でElasticSearchを使用することです(下記のリンクを参照)。Typescript 'meteor/easy:search'モジュールが見つかりません

https://github.com/Urigo/meteor-angular2.0-sociallyに基づいて私の既存のプロジェクトにeasysearch:elasticsearchパッケージを使用して実装しようとしています。

私がmeteor add easysearch:elasticsearchを使用した後、私はそれを実装しようとすると、いつもCannot find module errorを受け取ります(serverside/clientside/both - doesnt matter)。ここで both/collections/cases.collections.tsファイルでの実装の私のコード:

import { MongoObservable } from "meteor-rxjs"; 
import { Meteor } from 'meteor/meteor'; 
import { Index } from 'meteor/easy:search' // gives error 
import { ElasticSearchEngine } from 'meteor/easysearch:elasticsearch' //gives error 

import { Case } from "../models/case.model"; 

export const Cases = new MongoObservable.Collection<Case>("cases"); 

// const CasesIndex = new Index({ 
// collection: Cases, 
// fields: ['name', 'description'], 
// engine: new ElasticSearchEngine({ 
//  body:() => { } // modify the body that's sent when searching 
// }) 

function loggedIn() { 
    return !!Meteor.user(); 
} 

Cases.allow({ 
    insert: loggedIn, 
    update: loggedIn, 
    remove: loggedIn 
}); 

マイ.meteor/packagesファイル内容以下があります。また

# Meteor packages used by this project, one per line. 
# Check this file (and the other files in this directory) into your repository. 
# 
# 'meteor add' and 'meteor remove' will edit this file for you, 
# but you can also edit it by hand. 

[email protected]    # Packages every Meteor app needs to have 
[email protected]  # Packages for a great mobile UX 
[email protected]     # The database Meteor supports right now 
[email protected]   # Reactive variable for tracker 
[email protected]     # Meteor's client-side reactive programming library 

[email protected] # CSS minifier run for production mode 
[email protected] # JS minifier run for production mode 
[email protected]    # ECMAScript 5 compatibility for older browsers. 

angular2-compilers 
practicalmeteor:mocha 
xolvio:cleaner 
hwillson:stub-collections 
dispatch:mocha-phantomjs 
[email protected] 
accounts-password 
anti:fake 
tmeasday:publish-counts 
check 
email 
jalik:ufs 
jalik:ufs-gridfs 
mickaelfm:vermongo 
easysearch:elasticsearch 
easysearch:core 
easy:search 

(それは場合に役立ちます)ここに私のpackage.json

{ 
    "name": "a angular2 elasticsearch site", 
    "private": true, 
    "scripts": { 
    "start": "meteor run", 
    "start:prod": "meteor run --production", 
    "build": "meteor build ./build/", 
    "clear": "meteor reset", 
    "meteor:update": "meteor update --all-packages", 
    "test": "meteor test --driver-package practicalmeteor:mocha", 
    "test:ci": "meteor test --once --driver-package dispatch:mocha-phantomjs" 
    }, 
    "devDependencies": { 
    "@types/chai": "3.5.2", 
    "@types/meteor": "^1.4.1", 
    "@types/mocha": "2.2.41", 
    "chai": "3.5.0", 
    "chai-spies": "0.7.1", 
    "meteor-node-stubs": "0.2.4" 
    }, 
    "dependencies": { 
    "@angular/animations": "^4.4.3", 
    "@angular/common": "^4.4.3", 
    "@angular/compiler": "^4.4.3", 
    "@angular/core": "^4.4.3", 
    "@angular/forms": "^4.4.3", 
    "@angular/http": "^4.4.3", 
    "@angular/material": "2.0.0-beta.8", 
    "@angular/platform-browser": "^4.4.3", 
    "@angular/platform-browser-dynamic": "^4.4.3", 
    "@angular/router": "^4.4.3", 
    "@types/node": "^7.0.22", 
    "@types/underscore": "^1.8.1", 
    "angular2-file-drop": "^0.2.0", 
    "angular2-google-maps": "0.17.0", 
    "angular2-meteor": "0.7.1", 
    "angular2-meteor-accounts-ui": "1.0.0", 
    "angular2-meteor-polyfills": "0.2.0", 
    "angular2-meteor-tests-polyfills": "0.0.2", 
    "babel-runtime": "6.23.0", 
    "bcrypt": "=1.0.2", 
    "gm": "^1.23.0", 
    "hammerjs": "^2.0.8", 
    "meteor-node-stubs": "0.2.11", 
    "meteor-rxjs": "0.4.7", 
    "meteor-typings": "1.3.1", 
    "ng2-drag-drop": "^2.0.1", 
    "ng2-pagination": "^2.0.1", 
    "reflect-metadata": "0.1.10", 
    "ng2-cytoscape": "0.4.0", 
    "rxjs": "5.4.0", 
    "zone.js": "0.8.11" 
    } 
} 

まだ同じエラー - 私はmeteor add easy:searchとパッケージを追加し、経由でアプリ全体を再構築しました3210。

さらに、インポートをサーバー側にシフトしました。問題はないことを確認するだけですが、AtomエディタとChromeコンソールでエラーが発生します。

Blazeコンポーネントを使用していないため、いくつかの問題がありますか?

答えて

0

easy:searchパッケージ自体をインストールするのを忘れました。

cd /path/to/project 
meteor add easy:search 
+0

これまでと同じエラー - 私はmeteor addでパッケージを追加しました。簡単にnpmを実行してアプリケーション全体を検索し、再構築します。 @SaschaN。 –

+0

あなたはエラーを明確にしていただけますか? – Styx

+0

「npm-debug-log」を追加してもらえますか? –

0

私はそれを考え出した - 何が非常によく設置されましたが、コンパイラ、エディタ(活字体パッケージ付きのAtom)とコンソールが見つからないためタイピングの私にエラーを与えました。

typings.d.tsには、実行中のelasticsearchサーバーに正常に接続するために、次の悪い最小型定義を追加しました。

declare module 'meteor/easysearch:core' { 
    import { Mongo } from "meteor/mongo"; 

    interface config { 
    collection: any, 
    fields: string[], 
    engine: any 
    } 

    class Index { 
    constructor(config: config); 
    search(searchDefinition: string, options?: object): Mongo.Cursor<any>; 
    } 
} 


declare module 'meteor/easysearch:elasticsearch' { 
    interface params { 
    body: any 
    } 

    class ElasticSearchEngine { 
    constructor(obj: params); 
    } 
} 
関連する問題