derrida
asked on
angular2 error
hi i'm just learning angular2. and i get a lot of errors in the console.
this is my pakacge.json:
this is my typings.json:
this is my tsconfig.json:
and when i run in the console i get these errors:
how can i fix all these errors?
best regards
this is my pakacge.json:
{
"name": "angular2-quickstart",
"version": "1.0.0",
"scripts": {
"start": "concurrent \"npm run tsc:w\" \"npm run lite\" ",
"tsc": "tsc",
"tsc:w": "tsc -w",
"lite": "lite-server",
"typings": "typings",
"postinstall": "typings install"
},
"license": "ISC",
"dependencies": {
"angular2": "2.0.0-beta.7",
"bootstrap": "^3.3.6",
"es6-promise": "^3.0.2",
"es6-shim": "^0.35.1",
"reflect-metadata": "0.1.2",
"rxjs": "5.0.0-beta.2",
"systemjs": "0.19.22",
"zone.js": "0.5.15"
},
"devDependencies": {
"concurrently": "^2.0.0",
"lite-server": "^2.1.0",
"typescript": "^1.7.5"
}
}
this is my typings.json:
{
"ambientDependencies": {
"es6-shim": "github:DefinitelyTyped/DefinitelyTyped/es6-shim/es6-shim.d.ts#6697d6f7dadbf5773cb40ecda35a76027e0783b2"
}
}
this is my tsconfig.json:
{
"compilerOptions": {
"target": "es5",
"module": "system",
"moduleResolution": "node",
"sourceMap": true,
"emitDecoratorMetadata": true,
"experimentalDecorators": true,
"removeComments": false,
"noImplicitAny": false
},
"exclude": [
"node_modules",
"typings/main",
"typings/main.d.ts"
]
}
and when i run in the console i get these errors:
C:\xampp\htdocs\Routing - Seed Project>npm start
> angular2-quickstart@1.0.0 start C:\xampp\htdocs\Routing - Seed Project
> concurrent "npm run tsc:w" "npm run lite"
[1]
[1] > angular2-quickstart@1.0.0 lite C:\xampp\htdocs\Routing - Seed Project
[1] > lite-server
[1]
[0]
[0] > angular2-quickstart@1.0.0 tsc:w C:\xampp\htdocs\Routing - Seed Project
[0] > tsc -w
[0]
[0] node_modules/angular2/platform/browser.d.ts(77,90): error TS2304: Cannot find name 'Promise'.
[0] node_modules/angular2/src/core/application_ref.d.ts(83,60): error TS2304: Cannot find name 'Promise'.
[0] node_modules/angular2/src/core/application_ref.d.ts(83,146): error TS2304: Cannot find name 'Promise'.
[0] node_modules/angular2/src/core/application_ref.d.ts(96,51): error TS2304: Cannot find name 'Promise'.
[0] node_modules/angular2/src/core/application_ref.d.ts(96,147): error TS2304: Cannot find name 'Promise'.
[0] node_modules/angular2/src/core/application_ref.d.ts(133,90): error TS2304: Cannot find name 'Promise'.
[0] node_modules/angular2/src/core/application_ref.d.ts(171,81): error TS2304: Cannot find name 'Promise'.
[0] node_modules/angular2/src/core/change_detection/parser/locals.d.ts(3,14): error TS2304: Cannot find name 'Map'.
[0] node_modules/angular2/src/core/change_detection/parser/locals.d.ts(4,42): error TS2304: Cannot find name 'Map'.
[0] node_modules/angular2/src/core/debug/debug_node.d.ts(14,13): error TS2304: Cannot find name 'Map'.
[0] node_modules/angular2/src/core/debug/debug_node.d.ts(24,17): error TS2304: Cannot find name 'Map'.
[0] node_modules/angular2/src/core/debug/debug_node.d.ts(25,17): error TS2304: Cannot find name 'Map'.
[0] node_modules/angular2/src/core/di/provider.d.ts(436,103): error TS2304: Cannot find name 'Map'.
[0] node_modules/angular2/src/core/di/provider.d.ts(436,135): error TS2304: Cannot find name 'Map'.
[0] node_modules/angular2/src/core/linker/compiler.d.ts(12,50): error TS2304: Cannot find name 'Promise'.
[0] node_modules/angular2/src/core/linker/compiler.d.ts(16,41): error TS2304: Cannot find name 'Promise'.
[0] node_modules/angular2/src/core/linker/dynamic_component_loader.d.ts(108,136): error TS2304: Cannot find name 'Promise'.
[0] node_modules/angular2/src/core/linker/dynamic_component_loader.d.ts(156,150): error TS2304: Cannot find name 'Promise'.
[0] node_modules/angular2/src/core/linker/dynamic_component_loader.d.ts(197,128): error TS2304: Cannot find name 'Promise'.
[0] node_modules/angular2/src/core/linker/dynamic_component_loader.d.ts(203,127): error TS2304: Cannot find name 'Promise'.
[0] node_modules/angular2/src/core/linker/dynamic_component_loader.d.ts(204,141): error TS2304: Cannot find name 'Promise'.
[0] node_modules/angular2/src/core/linker/dynamic_component_loader.d.ts(205,119): error TS2304: Cannot find name 'Promise'.
[0] node_modules/angular2/src/core/render/api.d.ts(13,13): error TS2304: Cannot find name 'Map'.
[0] node_modules/angular2/src/core/render/api.d.ts(14,84): error TS2304: Cannot find name 'Map'.
[0] node_modules/angular2/src/facade/async.d.ts(27,33): error TS2304: Cannot find name 'Promise'.
[0] node_modules/angular2/src/facade/async.d.ts(28,45): error TS2304: Cannot find name 'Promise'.
[0] node_modules/angular2/src/facade/collection.d.ts(1,25): error TS2304: Cannot find name 'MapConstructor'.
[0] node_modules/angular2/src/facade/collection.d.ts(2,25): error TS2304: Cannot find name 'SetConstructor'.
[0] node_modules/angular2/src/facade/collection.d.ts(4,27): error TS2304: Cannot find name 'Map'.
[0] node_modules/angular2/src/facade/collection.d.ts(4,39): error TS2304: Cannot find name 'Map'.
[0] node_modules/angular2/src/facade/collection.d.ts(7,9): error TS2304: Cannot find name 'Map'.
[0] node_modules/angular2/src/facade/collection.d.ts(8,30): error TS2304: Cannot find name 'Map'.
[0] node_modules/angular2/src/facade/collection.d.ts(11,43): error TS2304: Cannot find name 'Map'.
[0] node_modules/angular2/src/facade/collection.d.ts(12,27): error TS2304: Cannot find name 'Map'.
[0] node_modules/angular2/src/facade/collection.d.ts(14,23): error TS2304: Cannot find name 'Map'.
[0] node_modules/angular2/src/facade/collection.d.ts(15,25): error TS2304: Cannot find name 'Map'.
[0] node_modules/angular2/src/facade/collection.d.ts(95,41): error TS2304: Cannot find name 'Set'.
[0] node_modules/angular2/src/facade/collection.d.ts(96,22): error TS2304: Cannot find name 'Set'.
[0] node_modules/angular2/src/facade/collection.d.ts(97,25): error TS2304: Cannot find name 'Set'.
[0] node_modules/angular2/src/facade/lang.d.ts(13,17): error TS2304: Cannot find name 'Map'.
[0] node_modules/angular2/src/facade/lang.d.ts(14,17): error TS2304: Cannot find name 'Set'.
[0] node_modules/angular2/src/facade/lang.d.ts(78,59): error TS2304: Cannot find name 'Map'.
[0] node_modules/angular2/src/facade/promise.d.ts(2,14): error TS2304: Cannot find name 'Promise'.
[0] node_modules/angular2/src/facade/promise.d.ts(7,32): error TS2304: Cannot find name 'Promise'.
[0] node_modules/angular2/src/facade/promise.d.ts(8,38): error TS2304: Cannot find name 'Promise'.
[0] node_modules/angular2/src/facade/promise.d.ts(9,35): error TS2304: Cannot find name 'Promise'.
[0] node_modules/angular2/src/facade/promise.d.ts(9,93): error TS2304: Cannot find name 'Promise'.
[0] node_modules/angular2/src/facade/promise.d.ts(10,34): error TS2304: Cannot find name 'Promise'.
[0] node_modules/angular2/src/facade/promise.d.ts(11,32): error TS2304: Cannot find name 'Promise'.
[0] node_modules/angular2/src/facade/promise.d.ts(11,149): error TS2304: Cannot find name 'Promise'.
[0] node_modules/angular2/src/facade/promise.d.ts(12,43): error TS2304: Cannot find name 'Promise'.
[0] node_modules/angular2/src/http/headers.d.ts(43,59): error TS2304: Cannot find name 'Map'.
[0] node_modules/angular2/src/http/url_search_params.d.ts(11,16): error TS2304: Cannot find name 'Map'.
[0] node_modules/angular2/src/platform/browser/browser_adapter.d.ts(75,33): error TS2304: Cannot find name 'Map'.
[0] node_modules/angular2/src/platform/dom/dom_adapter.d.ts(85,42): error TS2304: Cannot find name 'Map'.
[0] node_modules/angular2/src/router/instruction.d.ts(122,34): error TS2304: Cannot find name 'Promise'.
[0] node_modules/angular2/src/router/instruction.d.ts(146,25): error TS2304: Cannot find name 'Promise'.
[0] node_modules/angular2/src/router/instruction.d.ts(153,25): error TS2304: Cannot find name 'Promise'.
[0] node_modules/angular2/src/router/instruction.d.ts(163,34): error TS2304: Cannot find name 'Promise'.
[0] node_modules/angular2/src/router/instruction.d.ts(166,25): error TS2304: Cannot find name 'Promise'.
[0] node_modules/angular2/src/router/lifecycle_annotations.d.ts(29,100): error TS2304: Cannot find name 'Promise'.
[0] node_modules/angular2/src/router/route_registry.d.ts(52,66): error TS2304: Cannot find name 'Promise'.
[0] node_modules/angular2/src/router/router.d.ts(52,50): error TS2304: Cannot find name 'Promise'.
[0] node_modules/angular2/src/router/router.d.ts(58,46): error TS2304: Cannot find name 'Promise'.
[0] node_modules/angular2/src/router/router.d.ts(76,45): error TS2304: Cannot find name 'Promise'.
[0] node_modules/angular2/src/router/router.d.ts(89,34): error TS2304: Cannot find name 'Promise'.
[0] node_modules/angular2/src/router/router.d.ts(97,64): error TS2304: Cannot find name 'Promise'.
[0] node_modules/angular2/src/router/router.d.ts(102,85): error TS2304: Cannot find name 'Promise'.
[0] node_modules/angular2/src/router/router.d.ts(110,70): error TS2304: Cannot find name 'Promise'.
[0] node_modules/angular2/src/router/router.d.ts(118,43): error TS2304: Cannot find name 'Promise'.
[0] node_modules/angular2/src/router/router.d.ts(122,29): error TS2304: Cannot find name 'Promise'.
[0] node_modules/angular2/src/router/router.d.ts(128,19): error TS2304: Cannot find name 'Promise'.
[0] node_modules/angular2/src/router/router.d.ts(136,70): error TS2304: Cannot find name 'Promise'.
[0] node_modules/angular2/src/router/router_outlet.d.ts(25,54): error TS2304: Cannot find name 'Promise'.
[0] node_modules/angular2/src/router/router_outlet.d.ts(31,51): error TS2304: Cannot find name 'Promise'.
[0] node_modules/angular2/src/router/router_outlet.d.ts(36,56): error TS2304: Cannot find name 'Promise'.
[0] node_modules/angular2/src/router/router_outlet.d.ts(45,65): error TS2304: Cannot find name 'Promise'.
[0] node_modules/angular2/src/router/router_outlet.d.ts(56,60): error TS2304: Cannot find name 'Promise'.
[0] node_modules/rxjs/CoreOperators.d.ts(35,67): error TS2304: Cannot find name 'Promise'.
[0] node_modules/rxjs/CoreOperators.d.ts(50,66): error TS2304: Cannot find name 'Promise'.
[0] node_modules/rxjs/CoreOperators.d.ts(89,67): error TS2304: Cannot find name 'Promise'.
[0] node_modules/rxjs/CoreOperators.d.ts(94,38): error TS2304: Cannot find name 'Promise'.
[0] node_modules/rxjs/CoreOperators.d.ts(94,50): error TS2304: Cannot find name 'Promise'.
[0] node_modules/rxjs/Observable.d.ts(46,62): error TS2304: Cannot find name 'Promise'.
[0] node_modules/rxjs/Observable.d.ts(47,42): error TS2304: Cannot find name 'Iterator'.
[0] node_modules/rxjs/Observable.d.ts(103,74): error TS2304: Cannot find name 'Promise'.
[0] node_modules/rxjs/Observable.d.ts(103,84): error TS2304: Cannot find name 'Promise'.
[0] node_modules/rxjs/Observable.d.ts(143,66): error TS2304: Cannot find name 'Promise'.
[0] node_modules/rxjs/Observable.d.ts(158,65): error TS2304: Cannot find name 'Promise'.
[0] node_modules/rxjs/Observable.d.ts(201,66): error TS2304: Cannot find name 'Promise'.
[0] node_modules/rxjs/Observable.d.ts(206,38): error TS2304: Cannot find name 'Promise'.
[0] node_modules/rxjs/Observable.d.ts(206,50): error TS2304: Cannot find name 'Promise'.
[0] node_modules/rxjs/observable/ForkJoinObservable.d.ts(6,50): error TS2304: Cannot find name 'Promise'.
[0] node_modules/rxjs/observable/ForkJoinObservable.d.ts(7,58): error TS2304: Cannot find name 'Promise'.
[0] node_modules/rxjs/observable/FromObservable.d.ts(7,38): error TS2304: Cannot find name 'Promise'.
[0] node_modules/rxjs/observable/FromObservable.d.ts(7,51): error TS2304: Cannot find name 'Iterator'.
[0] node_modules/rxjs/observable/PromiseObservable.d.ts(9,31): error TS2304: Cannot find name 'Promise'.
[0] node_modules/rxjs/observable/PromiseObservable.d.ts(10,26): error TS2304: Cannot find name 'Promise'.
[1] Did not detect a `bs-config.json` or `bs-config.js` override file. Using lite-server defaults...
[1] ** browser-sync config **
[1] { injectChanges: false,
[1] files: [ './**/*.{html,htm,css,js}' ],
[1] watchOptions: { ignored: 'node_modules' },
[1] server: { baseDir: './', middleware: [ [Function], [Function] ] } }
[0] 9:53:39 AM - Compilation complete. Watching for file changes.
[1] [BS] Access URLs:
[1] -------------------------------------
[1] Local: http://localhost:3000
[1] External: http://192.168.56.1:3000
[1] -------------------------------------
[1] UI: http://localhost:3001
[1] UI External: http://192.168.56.1:3001
[1] -------------------------------------
[1] [BS] Serving files from: ./
[1] [BS] Watching files...
[1] 16.06.22 09:53:46 304 GET /index.html
[1] 16.06.22 09:53:46 304 GET /node_modules/bootstrap/dist/css/bootstrap.css
[1] 16.06.22 09:53:47 304 GET /node_modules/angular2/bundles/angular2-polyfills.js
[1] 16.06.22 09:53:47 304 GET /node_modules/systemjs/dist/system.src.js
[1] 16.06.22 09:53:47 304 GET /node_modules/rxjs/bundles/Rx.js
[1] 16.06.22 09:53:47 304 GET /node_modules/angular2/bundles/angular2.dev.js
[1] 16.06.22 09:53:47 304 GET /node_modules/angular2/bundles/router.dev.js
[1] 16.06.22 09:53:47 304 GET /node_modules/angular2/bundles/http.dev.js
[1] 16.06.22 09:53:47 200 GET /app/boot.js
[1] 16.06.22 09:53:47 200 GET /app/app.component.js
[1] 16.06.22 09:53:47 200 GET /app/album.component.js
[1] 16.06.22 09:53:47 200 GET /app/albums.component.js
[1] 16.06.22 09:53:47 200 GET /app/contact.component.js
[1] 16.06.22 09:53:47 200 GET /app/photo.service.js
[1] 16.06.22 09:53:47 304 GET /app/app.component.html
how can i fix all these errors?
best regards
Map and Promise are probably supplied by node.js. What version of Node.js are you running and is it in harmony mode?
You might have this problem as well
https://github.com/angular/angular/issues/7052
(Comment by nhhockeyplayer about having to install manually)
You might have this problem as well
https://github.com/angular/angular/issues/7052
(Comment by nhhockeyplayer about having to install manually)
ASKER
hey
my node version is 4.2.4, i have no idea what is harmony mode, so i don't think so.
my node version is 4.2.4, i have no idea what is harmony mode, so i don't think so.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
ok since i'm new to this i need to be clear:
so in my tsconfig: change to es6
then in the command line : install es6-shim --ambient --save
do i need to delete the node-modules folder before?
so in my tsconfig: change to es6
then in the command line : install es6-shim --ambient --save
do i need to delete the node-modules folder before?
ASKER
in any case, i have tried that and i get: install: unknown option -- ambient
ASKER
but just to change to 6, i tried: npm install, then start, and not i don't get any errors. so it seem that was the issue. thanks
Hmm. I don't quite understand the --ambient error. But it should re-install properly if you delete all the modules. Anyway I'm glad it's working. But these issues - new installation system, new Angular and also having to learn Typescript has put me off converting to Angular 2.
Hi
I have problem in angular2 like I need a reusable validation for form group controls in angular2.
Can you please provide any help for the same
I have problem in angular2 like I need a reusable validation for form group controls in angular2.
Can you please provide any help for the same
Yes if you ask a question.
ASKER