我不知道为什么会发生这种错误。我的项目运行得很好,我在项目目录之外全局安装了一些软件包(比如gulp和yo生成器)。当我停止我的项目并重新启动它时,它显示下面的错误。节点服务器仍在运行,但是当我使用 npm run tsc:-w 时,终端会给出以下错误。
我使用 npm start ,这是package.json中的一个脚本:
“开始”:“tsc&&并行”npm运行tsc:w \“\”节点服务器/ index.js \“”,
../app/app.ts(11,5): error TS2345: Argument of type '{ selector: string; viewBindings: typeof NamesList[]; }' is not assignable to parameter of type '{ selector?: string; properties?: List<string>; events?: List<string>; host?: StringMap<string, s...'.
Object literal may only specify known properties, and 'viewBindings' does not exist in type '{ selector?: string; properties?: List<string>; events?: List<string>; host?: StringMap<string, s...'.
../app/app.ts(17,2): error TS2345: Argument of type 'typeof App' is not assignable to parameter of type 'Type'.
Type 'App' is not assignable to type 'Type'.
Property 'apply' is missing in type 'App'.
../app/components/about/about.ts(5,2): error TS2345: Argument of type 'typeof About' is not assignable to parameter of type 'Type'.
Type 'About' is not assignable to type 'Type'.
Property 'apply' is missing in type 'About'.
../app/components/about/about.ts(8,2): error TS2345: Argument of type 'typeof About' is not assignable to parameter of type 'Type'.
../app/components/home/home.ts(4,2): error TS2345: Argument of type 'typeof Home' is not assignable to parameter of type 'Type'.
Type 'Home' is not assignable to type 'Type'.
Property 'apply' is missing in type 'Home'.
../app/components/home/home.ts(7,2): error TS2345: Argument of type 'typeof Home' is not assignable to parameter of type 'Type'.
../node_modules/angular2/src/change_detection/parser/parser.d.ts(21,12): error TS2304: Cannot find name 'int'.
../node_modules/angular2/src/change_detection/parser/parser.d.ts(23,18): error TS2304: Cannot find name 'int'.
../node_modules/angular2/src/change_detection/parser/parser.d.ts(25,17): error TS2304: Cannot find name 'int'.
../node_modules/angular2/src/change_detection/parser/parser.d.ts(27,29): error TS2304: Cannot find name 'int'.
../node_modules/angular2/src/change_detection/parser/parser.d.ts(30,27): error TS2304: Cannot find name 'int'.
../node_modules/angular2/src/change_detection/parser/parser.d.ts(49,37): error TS2304: Cannot find name 'int'.
../node_modules/angular2/src/change_detection/parser/parser.d.ts(60,36): error TS2304: Cannot find name 'int'.
../node_modules/angular2/src/core/compiler/element_binder.d.ts(6,12): error TS2304: Cannot find name 'int'.
../node_modules/angular2/src/core/compiler/element_binder.d.ts(8,23): error TS2304: Cannot find name 'int'.
../node_modules/angular2/src/core/compiler/element_binder.d.ts(13,24): error TS2304: Cannot find name 'int'.
../node_modules/angular2/src/core/compiler/element_binder.d.ts(13,70): error TS2304: Cannot find name 'int'.
../node_modules/angular2/src/core/compiler/element_injector.d.ts(98,12): error TS2304: Cannot find name 'int'.
../node_modules/angular2/src/core/compiler/element_injector.d.ts(112,54): error TS2304: Cannot find name 'int'.
../node_modules/angular2/src/core/compiler/query_list.d.ts(22,6): error TS2304: Cannot find name 'Symbol'.
../node_modules/angular2/src/core/compiler/view.d.ts(69,81): error TS2304: Cannot find name 'int'.
../node_modules/angular2/src/core/compiler/view.d.ts(97,58): error TS2304: Cannot find name 'int'.
../node_modules/angular2/src/core/compiler/view.d.ts(111,104): error TS2304: Cannot find name 'int'.
../node_modules/angular2/src/core/zone/ng_zone.d.ts(2,37): error TS2304: Cannot find name 'Zone'.
../node_modules/angular2/src/di/injector.d.ts(1,1): error TS2654: Exported external package typings file cannot contain tripleslash references. Please contact the package author to update the package definition.
../node_modules/angular2/src/di/injector.d.ts(1,1): error TS6053: File '/home/angular2/typings/es6-promise/es6-promise.d.ts' not found.
../node_modules/angular2/src/facade/async.d.ts(1,1): error TS2654: Exported external package typings file cannot contain tripleslash references. Please contact the package author to update the package definition.
../node_modules/angular2/src/facade/async.d.ts(1,1): error TS6053: File '/home/angular2/typings/es6-promise/es6-promise.d.ts' not found.
../node_modules/angular2/src/facade/async.d.ts(2,1): error TS6053: File '/home/angular2/typings/rx/rx.d.ts' not found.
../node_modules/angular2/src/facade/async.d.ts(4,10): error TS2661: Cannot re-export name that is not defined in the module.
../node_modules/angular2/src/facade/async.d.ts(20,45): error TS2304: Cannot find name 'int'.
../node_modules/angular2/src/facade/async.d.ts(20,51): error TS2304: Cannot find name 'int'.
../node_modules/angular2/src/facade/async.d.ts(21,29): error TS2304: Cannot find name 'int'.
../node_modules/angular2/src/facade/async.d.ts(22,46): error TS2304: Cannot find name 'int'.
../node_modules/angular2/src/facade/async.d.ts(22,52): error TS2304: Cannot find name 'int'.
../node_modules/angular2/src/facade/async.d.ts(23,30): error TS2304: Cannot find name 'int'.
../node_modules/angular2/src/facade/lang.d.ts(1,1): error TS2654: Exported external package typings file cannot contain tripleslash references. Please contact the package author to update the package definition.
../node_modules/angular2/src/facade/lang.d.ts(1,1): error TS6053: File '/home/angular2/globals.d.ts' not found.
../node_modules/angular2/src/facade/lang.d.ts(2,22): error TS2304: Cannot find name 'BrowserNodeGlobal'.
../node_modules/angular2/src/facade/lang.d.ts(31,43): error TS2304: Cannot find name 'int'.
../node_modules/angular2/src/facade/lang.d.ts(31,49): error TS2304: Cannot find name 'int'.
../node_modules/angular2/src/facade/lang.d.ts(47,50): error TS2304: Cannot find name 'int'.
../node_modules/angular2/src/facade/lang.d.ts(48,63): error TS2304: Cannot find name 'int'.
../node_modules/angular2/src/facade/lang.d.ts(50,31): error TS2304: Cannot find name 'int'.
../node_modules/angular2/src/facade/lang.d.ts(51,41): error TS2304: Cannot find name 'int'.
../node_modules/angular2/src/facade/lang.d.ts(59,40): error TS2304: Cannot find name 'int'.
../node_modules/angular2/src/facade/lang.d.ts(59,51): error TS2304: Cannot find name 'int'.
../node_modules/angular2/src/facade/lang.d.ts(62,43): error TS2304: Cannot find name 'int'.
../node_modules/angular2/src/facade/lang.d.ts(77,47): error TS2304: Cannot find name 'int'.
../node_modules/angular2/src/facade/lang.d.ts(79,45): error TS2304: Cannot find name 'int'.
../node_modules/angular2/src/facade/lang.d.ts(80,42): error TS2304: Cannot find name 'int'.
../node_modules/angular2/src/facade/lang.d.ts(80,48): error TS2304: Cannot find name 'int'.
../node_modules/angular2/src/facade/lang.d.ts(116,25): error TS2304: Cannot find name 'int'.
../node_modules/angular2/src/facade/lang.d.ts(116,38): error TS2304: Cannot find name 'int'.
../node_modules/angular2/src/facade/lang.d.ts(116,49): error TS2304: Cannot find name 'int'.
../node_modules/angular2/src/facade/lang.d.ts(116,61): error TS2304: Cannot find name 'int'.
../node_modules/angular2/src/facade/lang.d.ts(116,76): error TS2304: Cannot find name 'int'.
../node_modules/angular2/src/facade/lang.d.ts(116,91): error TS2304: Cannot find name 'int'.
../node_modules/angular2/src/facade/lang.d.ts(116,111): error TS2304: Cannot find name 'int'.
../node_modules/angular2/src/facade/lang.d.ts(117,27): error TS2304: Cannot find name 'int'.
../node_modules/angular2/src/facade/lang.d.ts(118,34): error TS2304: Cannot find name 'int'.
../node_modules/angular2/src/http/enums.d.ts(46,23): error TS2304: Cannot find name 'int'.
../node_modules/angular2/src/http/interfaces.d.ts(1,1): error TS2654: Exported external package typings file cannot contain tripleslash references. Please contact the package author to update the package definition.
../node_modules/angular2/src/http/interfaces.d.ts(1,1): error TS6053: File '/home/angular2/typings/rx/rx.d.ts' not found.
../node_modules/angular2/src/profile/profile.d.ts(1,28): error TS2307: Cannot find module './wtf_impl'.
../node_modules/angular2/src/profile/profile.d.ts(2,23): error TS2307: Cannot find module './wtf_impl'.
../node_modules/angular2/src/render/dom/view/shared_styles_host.d.ts(3,27): error TS2304: Cannot find name 'Set'.
../node_modules/angular2/src/router/instruction.d.ts(1,32): error TS2307: Cannot find module './path_recognizer'.
../node_modules/angular2/src/router/route_recognizer.d.ts(1,32): error TS2307: Cannot find module './path_recognizer'.
6:45:32 PM - Compilation complete. Watching for file changes.
答案 0 :(得分:0)
然后在项目上 - $ typings install
此外,如果您在防火墙后面,则需要将.typingssrc文件添加到项目根目录 - 项目安装的打字也需要离开防火墙一侧,并且不能使用npm代理设置。
.typingssrc(文件名) { “proxy”:“http://&lt;&gt;添加您的代理服务器&gt; /”, “rejectUnauthorized”:false }
答案 1 :(得分:0)
使用npm i
安装所有节点模块。为此,您需要在计算机中安装nodejs。要使用node -v
命令检查计算机中是否有节点