gpt4 book ai didi

javascript - 当我使用 'Promise' 命令时找不到名称 'npm start' 错误

转载 作者:太空宇宙 更新时间:2023-11-04 00:36:53 24 4
gpt4 key购买 nike

我是 Angular 2 的新手。我完成了 5 min Quickstart教程并继续尝试这个 ScotchIO example 。我只是尝试使用与示例中相同的代码。当我通过 npm install 安装 Node 模块后运行 npm start 命令时,出现以下异常。

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

> learning-angular@1.0.0 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

尝试了 StackOverFlow 中的一些建议,但没有帮助。

最佳答案

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

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

npm run typings install

这应该可以解决问题。

关于javascript - 当我使用 'Promise' 命令时找不到名称 'npm start' 错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38602992/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com