[SOLVED] Meteor angular2 : import {Meteor} from 'meteor/meteor'; cannot find module


i’m trying Metoer 1.3 with angular2 throught tutorial from http://www.angular-meteor.com/tutorials/socially/angular2/adding-removing-objects-and-angular-event-handling

In fact it seems that the app works (step 4 of the tuto), but in the console, when i start the server i have a lot of warning :

client/app.ts (12, 14): Cannot find namespace ‘Mongo’.
client/app.ts (15, 9): Cannot find name ‘Tracker’.
collections/parties.ts (1, 22): Cannot find module ‘meteor/meteor’.
collections/parties.ts (1, 22): Cannot find module ‘meteor/meteor’.
server/main.ts (1, 22): Cannot find module ‘meteor/meteor’.

I tryed to move everything in imports folder like it’s said in the Meteor Guide, but it doesn’t change anything.
I don’t like this messages :slight_smile: and i would prefer to remove them.

I think it’s the typescript transpiler that doesn’t know where are those package, so how could i tell him where to find them ?

@Urigo could you have a look at this please ? i would like to organize my next meetup around angular2 frontend part for Meteor.


Yes it looks like it is missing a
import { Mongo } from 'meteor/mongo'; in app.ts and collections/parties.ts.
and import { Meteor } from 'meteor/meteor'; in server/main.ts

Let me know if that solves those problems and I will update the tutorial

Thanks for the answer but it still fail.

Errors :

=> Started proxy.
=> Started MongoDB.
=> Meteor 1.3.1 is available. Update this project with ‘meteor update’.
Compiling main app HTML file: client/index.html
Compiling HTML template: client/app.html
client/app.ts (5, 21): Cannot find module ‘meteor/mongo’.
client/app.ts (16, 9): Cannot find name ‘Tracker’.
collections/parties.ts (1, 21): Cannot find module ‘meteor/mongo’.
collections/parties.ts (1, 21): Cannot find module ‘meteor/mongo’.
server/main.ts (1, 22): Cannot find module ‘meteor/meteor’.
=> Started your app.

Here is the github repo to reproduce the problem : https://github.com/MeteorLyon/meteor-angular2.git

Please look at the end of the first chapter. it links to that gist here - https://gist.github.com/tomitrescak/8366ce98f1857e202ea8 which is an updated version of the Meteor typings for Meteor 1.3
let me know if that works for you

So i copy/paste the gist into a meteor.d.ts at the root of my app, and it worked well, thanks a lot @Urigo

Do you know why i have to deal with that file ? Is it mandatory for all meteor 1.3 application ?

Thanks a lot for your work on meteor/angularX

This is the related issue: https://github.com/meteor/meteor/issues/6177

@rebolon Copy this file into your typings folder.
Then adding
/// <reference path="meteor.d.ts" />
into your typings/main.d.ts will solve the problem.


Thanks all for the helps, i can continue to prepare my meetup.

You are welcome! Glad to hear it works.

I have still @rebolon’s problems and I couldn’t resolve socially project in this way and I am stoped in here, please give me some directions about these questions:
1- I couldn’t see typings folder in my root application shall I create it manually and so d.ts files?
2- your direction about embedding '/// ’ into typings/main.d.ts is not clear for me, does it include “///” comment type character?

If you are using latest Typings 1.0.

The new way is:

typings install registry:env/meteor --global --save

Note this only add meteor typings.

C:\Users\Bahram\WebstormProjects\socially>typings install registry:env/meteor --global --save
typings ERR! message Unable to resolve “registry:env/meteor#1.3.0+20160531044850” from "meteor"
typings ERR! caused by Unable to connect to "https://raw.githubusercontent.com/meteor-typings/meteor/f63c5e15a2b39a60a938851a657a51dcd9429b73/1.3/typings.json"
typings ERR! caused by connect ETIMEDOUT

typings ERR! cwd C:\Users\Bahram\WebstormProjects\socially
typings ERR! system Windows_NT 10.0.10240
typings ERR! command “C:\Program Files\nodejs\node.exe” “C:\Users\Bahram\AppData\Roaming\npm\node_modules\typings\dist\bin.js” “install” “registry:env/meteor” “–global” "–save"
typings ERR! node -v v5.2.0
typings ERR! typings -v 1.0.5

typings ERR! If you need help, you may report this error at:
typings ERR! https://github.com/typings/typings/issues
I found that my machine couldn’t download from https://raw.githubusercontent.com,
for getting related source!!!

looks like a proxy issue.

Am doing the “socially” app … and encountered the same issue … I removed the import statement and the example works fine without the import!.. why does the example work without the import ?? is meteor/meteor no longer needed as of 1.4 version? Also is importing html as a string still the way to go as opposed to templateurl? Oh btw I almost forgot , I am using a Windows OS.

@Hongbo_Miao I want to add requestPhoneVerification and verifyPhone in meteor/accounts-base. How can i do this?