johnpapa/angular-first-look-examples

Compile errors when starting example

Closed this issue ยท 11 comments

I'm trying to run the storyline-tracker example and get the following compile errors after "npm start":

../node_modules/@angular/common/src/directives/ng_class.d.ts(48,34): error TS2304: Cannot find name 'Set'.
../node_modules/@angular/common/src/pipes/async_pipe.d.ts(44,38): error TS2304: Cannot find name 'Promise'.
../node_modules/@angular/compiler/src/aot/compiler.d.ts(32,38): error TS2304: Cannot find name 'Promise'.
../node_modules/@angular/compiler/src/aot/compiler.d.ts(44,32): error TS2304: Cannot find name 'Map'.
../node_modules/@angular/compiler/src/aot/compiler_host.d.ts(20,33): error TS2304: Cannot find name 'Promise'.
../node_modules/@angular/compiler/src/compile_metadata.d.ts(342,20): error TS2304: Cannot find name 'Set'.
../node_modules/@angular/compiler/src/compile_metadata.d.ts(344,28): error TS2304: Cannot find name 'Set'.
../node_modules/@angular/compiler/src/compile_metadata.d.ts(346,15): error TS2304: Cannot find name 'Set'.
../node_modules/@angular/compiler/src/compile_metadata.d.ts(348,23): error TS2304: Cannot find name 'Set'.
../node_modules/@angular/compiler/src/compile_metadata.d.ts(350,17): error TS2304: Cannot find name 'Set'.
../node_modules/@angular/compiler/src/compile_metadata.d.ts(352,25): error TS2304: Cannot find name 'Set'.
../node_modules/@angular/compiler/src/directive_normalizer.d.ts(38,72): error TS2304: Cannot find name 'Promise'.
../node_modules/@angular/compiler/src/directive_normalizer.d.ts(40,74): error TS2304: Cannot find name 'Promise'.
../node_modules/@angular/compiler/src/i18n/extractor.d.ts(14,33): error TS2304: Cannot find name 'Promise'.
../node_modules/@angular/compiler/src/i18n/extractor.d.ts(22,35): error TS2304: Cannot find name 'Promise'.
../node_modules/@angular/compiler/src/jit/compiler.d.ts(44,49): error TS2304: Cannot find name 'Promise'.
../node_modules/@angular/compiler/src/jit/compiler.d.ts(46,65): error TS2304: Cannot find name 'Promise'.
../node_modules/@angular/compiler/src/metadata_resolver.d.ts(58,104): error TS2304: Cannot find name 'Promise'.
../node_modules/@angular/compiler/src/output/output_ast.d.ts(433,63): error TS2304: Cannot find name 'Set'.
../node_modules/@angular/compiler/src/resource_loader.d.ts(13,23): error TS2304: Cannot find name 'Promise'.
../node_modules/@angular/compiler/src/util.d.ts(33,18): error TS2304: Cannot find name 'Promise'.
../node_modules/@angular/compiler/src/util.d.ts(34,46): error TS2304: Cannot find name 'Promise'.
../node_modules/@angular/core/src/application_init.d.ts(16,18): error TS2304: Cannot find name 'Promise'.
../node_modules/@angular/core/src/application_ref.d.ts(116,67): error TS2304: Cannot find name 'Promise'.
../node_modules/@angular/core/src/application_ref.d.ts(132,101): error TS2304: Cannot find name 'Promise'.
../node_modules/@angular/core/src/application_ref.d.ts(158,67): error TS2304: Cannot find name 'Promise'.
../node_modules/@angular/core/src/application_ref.d.ts(160,101): error TS2304: Cannot find name 'Promise'.
../node_modules/@angular/core/src/change_detection/differs/default_keyvalue_differ.d.ts(24,15): error TS2304: Cannot find name 'Map'.
../node_modules/@angular/core/src/change_detection/differs/default_keyvalue_differ.d.ts(28,16): error TS2304: Cannot find name 'Map'.
../node_modules/@angular/core/src/di/reflective_provider.d.ts(88,123): error TS2304: Cannot find name 'Map'.
../node_modules/@angular/core/src/di/reflective_provider.d.ts(88,165): error TS2304: Cannot find name 'Map'.
../node_modules/@angular/core/src/facade/lang.d.ts(12,17): error TS2304: Cannot find name 'Map'.
../node_modules/@angular/core/src/facade/lang.d.ts(13,17): error TS2304: Cannot find name 'Set'.
../node_modules/@angular/core/src/linker/compiler.d.ts(53,49): error TS2304: Cannot find name 'Promise'.
../node_modules/@angular/core/src/linker/compiler.d.ts(61,65): error TS2304: Cannot find name 'Promise'.
../node_modules/@angular/core/src/linker/ng_module_factory_loader.d.ts(14,34): error TS2304: Cannot find name 'Promise'.
../node_modules/@angular/core/src/linker/system_js_ng_module_factory_loader.d.ts(28,25): error TS2304: Cannot find name 'Promise'.
../node_modules/@angular/core/src/util/lang.d.ts(8,53): error TS2304: Cannot find name 'Promise'.
../node_modules/@angular/http/src/headers.d.ts(52,59): error TS2304: Cannot find name 'Map'.
../node_modules/@angular/http/src/url_search_params.d.ts(46,16): error TS2304: Cannot find name 'Map'.
../node_modules/@angular/platform-browser-dynamic/src/resource_loader/resource_loader_impl.d.ts(10,23): error TS2304: Cannot find name 'Promise'.
../node_modules/@angular/platform-browser/src/browser/browser_adapter.d.ts(79,33): error TS2304: Cannot find name 'Map'.
../node_modules/@angular/platform-browser/src/dom/dom_adapter.d.ts(97,42): error TS2304: Cannot find name 'Map'.
../node_modules/@angular/platform-browser/src/dom/dom_renderer.d.ts(22,37): error TS2304: Cannot find name 'Map'.
../node_modules/@angular/router/src/config.d.ts(307,85): error TS2304: Cannot find name 'Promise'.
../node_modules/@angular/router/src/interfaces.d.ts(78,99): error TS2304: Cannot find name 'Promise'.
../node_modules/@angular/router/src/interfaces.d.ts(157,109): error TS2304: Cannot find name 'Promise'.
../node_modules/@angular/router/src/interfaces.d.ts(227,115): error TS2304: Cannot find name 'Promise'.
../node_modules/@angular/router/src/interfaces.d.ts(297,89): error TS2304: Cannot find name 'Promise'.
../node_modules/@angular/router/src/interfaces.d.ts(367,50): error TS2304: Cannot find name 'Promise'.
../node_modules/@angular/router/src/router.d.ts(392,70): error TS2304: Cannot find name 'Promise'.
../node_modules/@angular/router/src/router.d.ts(414,59): error TS2304: Cannot find name 'Promise'.
../node_modules/@angular/router/src/utils/collection.d.ts(36,79): error TS2304: Cannot find name 'Promise'.
../node_modules/rxjs/Observable.d.ts(68,60): error TS2304: Cannot find name 'Promise'.
../node_modules/rxjs/Observable.d.ts(68,70): error TS2304: Cannot find name 'Promise'.
../node_modules/rxjs/observable/PromiseObservable.d.ts(40,31): error TS2304: Cannot find name 'Promise'.
../node_modules/rxjs/observable/PromiseObservable.d.ts(41,26): error TS2304: Cannot find name 'Promise'.
../node_modules/rxjs/operator/toPromise.d.ts(2,60): error TS2304: Cannot find name 'Promise'.
../node_modules/rxjs/operator/toPromise.d.ts(3,79): error TS2304: Cannot find name 'Promise'.
../node_modules/rxjs/operator/toPromise.d.ts(3,89): error TS2304: Cannot find name 'Promise'.
app/core/can-deactivate-guard.service.ts(25,36): error TS2304: Cannot find name 'Promise'.
app/core/can-deactivate-guard.service.ts(26,13): error TS2304: Cannot find name 'Promise'.
app/core/entity.service.ts(6,19): error TS2339: Property 'assign' does not exist on type 'ObjectConstructor'.
app/core/entity.service.ts(9,54): error TS2339: Property 'assign' does not exist on type 'ObjectConstructor'.
app/core/entity.service.ts(11,73): error TS2339: Property 'find' does not exist on type 'string[]'.
app/core/modal/modal.component.ts(41,23): error TS2304: Cannot find name 'Promise'.
app/core/modal/modal.service.ts(5,51): error TS2304: Cannot find name 'Promise'.

I was able to correct it after following the instructions here http://stackoverflow.com/questions/35660498/angular-2-cant-find-promise-map-set-and-iterator

Is this expected? Or did something change...or maybe I need to have something else installed?

Those are all related (seemingly) to ES6 missing typings features. Those come with the app when you install from npm ... npm i

Also, it depends where you ran this command and what sequence you ran them. These steps take the common files for al examples and copy or symlink them to the examples folders. Then you can go to a folder and run npm start, as you did. I'm just verifying that you did this.

My guess is the @types did not get installed. One other thing to try is to wipe the node_modules from the root and try over. Do this ...

# from the root of the repo
rm -rf node_modules
npm cache clean
npm i

Then check that the @types are installed in the node_modules folder.

I've tried this on both Windows and macOS and ran into the same issue. Running the commands above did not seem to make a difference.

Note: the node_modules folder at the root does not have a @types folder in it. Only the _examples/node_modules and _examples/*/node_modules folders have @types.

the root node modules wont have that, but the ones in examples should. we need to run npm i in the examples folder. we can see that in the quickstart where we go into the _examples folder and run npm i

that command will run through package.json and install typescript 2 and the @types.

see this ... https://github.com/johnpapa/a2-first-look/blob/master/_examples/need-router/package.json#L37

I've tried running npm i on everything. Still no luck.

What should be in the @types folder? All I have are jasmine and node.

I got exactly the same result as dandax.

OK. Let's step back. Help me understand your OS, node version, and npm version.

node -v
npm -v

Then verify that we ran all of the steps in the same order shown in the readme, please. I'll do the same here on a fresh build too.

We'll figure it out :)

macOS Sierra
node -v
  v6.9.1
npm -v
  3.10.8

Perfect, thanks.

I just tried it on a fresh build and see the same issues. The problem is due to a change in how the typescript compiler works with tsconfig.json. I am testing a simple fix now, will report back shortly.

Thanks for your patience. I made the change and tested it fresh. Works now for me.

For the fix, see this commit f74ce70

Try a fresh pull and follow the steps. Even with this fix you need to run npm run all again. Or just do it all fresh :)

That did it! Thanks @johnpapa

For me too! Thanks @johnpapa !!!