experimentalDecorators and Cannot find module 'angular2/angular2'.
From the 5 Min Quickstart guide: When I'd run,
tsc --watch -m commonjs -t es5 --emitDecoratorMetadata app.ts
I'd get this error: error TS6064: Option 'experimentalDecorators' must also be specified when option 'emitDecoratorMetadata' is specified. So, I added --experimentalDecorators to the parameters list of the above command:
tsc --watch -m commonjs -t es5 --emitDecoratorMetadata --experimentalDecorators app.ts
But now, I get this error in the log: app.ts(1,42): error TS2307: Cannot find module 'angular2/angular2'.
Though it's not causing any sort of error to the application from the client end.
I have what I suspect is a related bug after:
- installing Typescript 1.5.3 (not the beta referenced in the guide) (this may be irrelevant in fact given the second point)
- coding in Atom with typescript, where I get these errors:
at line 5, file /Users/simon/code/Dropbox/HTML/ang2/app.tsArgument of type 'typeof MyAppComponent' is not assignable to parameter of type 'Type'. Type 'MyAppComponent' is not assignable to type 'Type'. Property 'apply' is missing in type 'MyAppComponent'.
Component({
selector: 'my-app'
})
at line 8, file /Users/simon/code/Dropbox/HTML/ang2/app.tsArgument of type 'typeof MyAppComponent' is not assignable to parameter of type 'Type'.
View({
template: "<h1>Hello {{name}}</h1>"
})
In practise the code was compiled and ran correctly, but errors are a bit off-putting when following an introductory guide.
at line 5, file /Users/simon/code/Dropbox/HTML/ang2/app.tsArgument of type 'typeof MyAppComponent' is not assignable to parameter of type 'Type'. Type 'MyAppComponent' is not assignable to type 'Type'. Property 'apply' is missing in type 'MyAppComponent'. Component({ selector: 'my-app' }) at line 8, file /Users/simon/code/Dropbox/HTML/ang2/app.tsArgument of type 'typeof MyAppComponent' is not assignable to parameter of type 'Type'. View({ template: "<h1>Hello {{name}}</h1>" })
I have the same error
Closing, since we are reworking the docs, and the startup sequence will change. Your errors stem from not including the d.ts file, which should have gotten from tsd step.
How do I include the d.ts file? I got the error TS2307: 'Cannot find module angular2/angular2' after typing 'tsc -p src -w' following the "Step by step guide".
Also after trying to run the command: 'live-server --open src' in root, I get the error: 'Enoent: no such file or directory, uv_chdir ++'
Suggestions to what I might be doing wrong?
getting the same error as @sledan
Error:(1, 1) TS6053: File '/home/babajide/WebStormProjects/angularTwo/typings/angular2/angular2.d.ts' not found.
@sledan, @jidesakin: Check out my post on SO: http://stackoverflow.com/questions/30858164/cannot-find-external-module-angular2-angular2-angular2-w-typescript/32581715#32581715
@Dunken: Thanks. In my editor (VS Code), in the app.ts file, the line: import {Component, View, bootstrap} from 'angular2/angular2'; - the angular2/angular2 part is still underlined red, and says it cannot find module angular2/angular2, even after the commands you suggested. I also cannot do the command in root folder: 'live-server --open src' - I still get the error: 'Enoent: no such file or directory, uv_chdir ++' The browser dont open.
Do you know what to do?
@sledan @jidesakin @Dunken to solve the module errors did you run this command by chance? tsd install angular2 es6-promise rx rx-lite --save I am getting the same server when running the live-server command and have not yet figured that one out.
@Dunken @jgw96 try including the equals sign: live-server --open=src, it worked for me
The solution by @d10genes works for me :+1: thank you live-server --open=src
also works for me, this issue can probably be closed.
Closing, since we are reworking the docs, and the startup sequence will change. Your errors stem from not including the d.ts file, which should have gotten from tsd step.
Well I don't see any (explicit) tsd step in the quickstart page... this is surprising following this page step by step still don't seem to be working...
@cjolif The typings are now held in Angular2 itself, no more need for tsd.
@jgw96 The issue has been closed though.
I am getting the same error! live-server --open=src i did not understand this. is it a command?
Which file i have to change ?
my tsd file:
{ "version": "v4", "repo": "borisyankov/DefinitelyTyped", "ref": "master", "path": "typings", "bundle": "typings/tsd.d.ts", "installed": { "rx/rx-lite.d.ts": { "commit": "e05e1f6f83c6ac84e9d7ff8284e8089d53a788a6" }, "es6-promise/es6-promise.d.ts": { "commit": "e05e1f6f83c6ac84e9d7ff8284e8089d53a788a6" }, "rx/rx.d.ts": { "commit": "e05e1f6f83c6ac84e9d7ff8284e8089d53a788a6" } } }
This is the error im gettting [ts] cannot find module!
pls someone help me.im running this in localhost .its refusing to connect. Which file i have to change exactly.
@RajeswarReddy GitHub issues are for bug reports and feature requests. For support questions please use other channels like the ones listed in CONTRIBUTING - Got a Question or Problem?