2016-07-27 59 views
1

Angular 2是新的。我完成了5 min Quickstart教程并继续尝试这个ScotchIO example。我只是试图使用与示例中相同的确切代码。当我在通过npm install安装节点模块后运行npm start命令时,出现异常。当我使用'npm start'命令时,找不到名称'Promise'错误

[system]:~/Coding/Angular2/SecondApp$ npm start 

> [email protected] start /home/swetha/Coding/Angular2/SecondApp 
> tsc && concurrently "npm run tsc:w" "npm run lite" 

node_modules/@angular/core/src/application_ref.d.ts(79,88): error TS2304: Cannot find name 'Promise'. 
node_modules/@angular/core/src/application_ref.d.ts(137,42): error TS2304: Cannot find name 'Promise'. 
node_modules/@angular/core/src/application_ref.d.ts(196,33): 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(26,16): error TS2304: Cannot find name 'Map'. 
node_modules/@angular/core/src/di/reflective_provider.d.ts(115,123): error TS2304: Cannot find name 'Map'. 
node_modules/@angular/core/src/di/reflective_provider.d.ts(115,165): error TS2304: Cannot find name 'Map'. 
node_modules/@angular/core/src/facade/async.d.ts(34,33): error TS2304: Cannot find name 'Promise'. 
node_modules/@angular/core/src/facade/async.d.ts(35,45): error TS2304: Cannot find name 'Promise'. 
node_modules/@angular/core/src/facade/collection.d.ts(1,25): error TS2304: Cannot find name 'MapConstructor'. 
node_modules/@angular/core/src/facade/collection.d.ts(2,25): error TS2304: Cannot find name 'SetConstructor'. 
node_modules/@angular/core/src/facade/collection.d.ts(4,27): error TS2304: Cannot find name 'Map'. 
node_modules/@angular/core/src/facade/collection.d.ts(4,39): error TS2304: Cannot find name 'Map'. 
node_modules/@angular/core/src/facade/collection.d.ts(7,9): error TS2304: Cannot find name 'Map'. 
node_modules/@angular/core/src/facade/collection.d.ts(8,30): error TS2304: Cannot find name 'Map'. 
node_modules/@angular/core/src/facade/collection.d.ts(11,43): error TS2304: Cannot find name 'Map'. 
node_modules/@angular/core/src/facade/collection.d.ts(12,27): error TS2304: Cannot find name 'Map'. 
node_modules/@angular/core/src/facade/collection.d.ts(14,23): error TS2304: Cannot find name 'Map'. 
node_modules/@angular/core/src/facade/collection.d.ts(15,25): error TS2304: Cannot find name 'Map'. 
node_modules/@angular/core/src/facade/collection.d.ts(100,41): error TS2304: Cannot find name 'Set'. 
node_modules/@angular/core/src/facade/collection.d.ts(101,22): error TS2304: Cannot find name 'Set'. 
node_modules/@angular/core/src/facade/collection.d.ts(102,25): error TS2304: Cannot find name 'Set'. 
node_modules/@angular/core/src/facade/lang.d.ts(11,17): error TS2304: Cannot find name 'Map'. 
node_modules/@angular/core/src/facade/lang.d.ts(12,17): error TS2304: Cannot find name 'Set'. 
node_modules/@angular/core/src/facade/lang.d.ts(68,59): error TS2304: Cannot find name 'Map'. 
node_modules/@angular/core/src/facade/promise.d.ts(9,14): error TS2304: Cannot find name 'Promise'. 
node_modules/@angular/core/src/facade/promise.d.ts(15,32): error TS2304: Cannot find name 'Promise'. 
node_modules/@angular/core/src/facade/promise.d.ts(16,38): error TS2304: Cannot find name 'Promise'. 
node_modules/@angular/core/src/facade/promise.d.ts(17,35): error TS2304: Cannot find name 'Promise'. 
node_modules/@angular/core/src/facade/promise.d.ts(17,93): error TS2304: Cannot find name 'Promise'. 
node_modules/@angular/core/src/facade/promise.d.ts(18,34): error TS2304: Cannot find name 'Promise'. 
node_modules/@angular/core/src/facade/promise.d.ts(18,50): error TS2304: Cannot find name 'Promise'. 
node_modules/@angular/core/src/facade/promise.d.ts(19,32): error TS2304: Cannot find name 'Promise'. 
node_modules/@angular/core/src/facade/promise.d.ts(19,149): error TS2304: Cannot find name 'Promise'. 
node_modules/@angular/core/src/facade/promise.d.ts(20,43): error TS2304: Cannot find name 'Promise'. 
node_modules/@angular/core/src/linker/compiler.d.ts(13,59): error TS2304: Cannot find name 'Promise'. 
node_modules/@angular/core/src/linker/component_resolver.d.ts(9,58): error TS2304: Cannot find name 'Promise'. 
node_modules/@angular/core/src/linker/component_resolver.d.ts(13,49): error TS2304: Cannot find name 'Promise'. 

这该怎么我的项目文件夹结构看起来像:

[system]-ThinkPad-L420:~/Coding/Angular2/SecondApp$ ls -ltr 
total 48 
-rw-rw-r-- 1 admin admin 204 Jul 26 21:40 typings.json 
-rw-rw-r-- 1 admin admin 343 Jul 26 21:40 tsconfig.json 
-rw-rw-r-- 1 admin admin 22 Jul 26 21:40 style.css 
-rw-rw-r-- 1 admin admin 19 Jul 26 21:40 script.js 
-rw-rw-r-- 1 admin admin  0 Jul 26 21:40 README.md 
-rw-rw-r-- 1 admin admin 1076 Jul 26 21:40 package.json 
-rw-rw-r-- 1 admin admin 843 Jul 26 21:40 index.html 
drwxrwxr-x 2 admin admin 4096 Jul 26 21:54 app 
drwxr-xr-x 354 root root 12288 Jul 26 22:53 node_modules 
-rw-rw-r-- 1 admin admin 1774 Jul 26 23:09 systemjs.config.js 
-rw-rw-r-- 1 admin admin 2932 Jul 26 23:09 npm-debug.log 

试了几个建议,计算器,但它是没有帮助的。

回答

1

如您在项目结构中所示,没有typings文件夹,您从第一个5min QuickStart示例中错过了它。

npm安装后,typings文件夹无法显示。如果是这样,请手动安装。

npm run typings install 

这应该可以解决问题。

+0

谢谢,帮助:) –

相关问题