2

我正在尝试利用golden-layout对接库。我已经为我的 Angular 项目安装了所有东西,但我遇到了一个似乎无法解决的错误。

** NG Live Development Server is listening on localhost:4200, open your browser on http://localhost:4200/ **
Date: 2017-11-28T04:04:54.440Z                                                t Hash: bff1ad470576d56127a4
Time: 28376ms
chunk {inline} inline.bundle.js (inline) 5.79 kB [entry] [rendered]
chunk {main} main.bundle.js (main) 2.93 kB [initial] [rendered]
chunk {polyfills} polyfills.bundle.js (polyfills) 636 bytes [initial] [rendered]
chunk {styles} styles.bundle.js (styles) 503 kB [initial] [rendered]
chunk {vendor} vendor.bundle.js (vendor) 854 kB [initial] [rendered]

ERROR in node_modules/golden-layout/index.d.ts(15,20): error TS2304: Cannot find name 'JQuery'.
node_modules/golden-layout/index.d.ts(64,93): error TS2304: Cannot find name 'JQuery'.
node_modules/golden-layout/index.d.ts(138,49): error TS2304: Cannot find name 'JQuery'.
node_modules/golden-layout/index.d.ts(668,27): error TS2304: Cannot find name 'JQuery'.
node_modules/golden-layout/index.d.ts(766,22): error TS2304: Cannot find name 'JQuery'.
node_modules/golden-layout/index.d.ts(771,28): error TS2304: Cannot find name 'JQuery'.
node_modules/golden-layout/index.d.ts(776,32): error TS2304: Cannot find name 'JQuery'.
node_modules/golden-layout/index.d.ts(818,22): error TS2304: Cannot find name 'JQuery'.
node_modules/golden-layout/index.d.ts(823,27): error TS2304: Cannot find name 'JQuery'.
node_modules/golden-layout/index.d.ts(828,27): error TS2304: Cannot find name 'JQuery'.


webpack: Failed to compile.

我看到另一个帖子,它是空白的,没有答案。当我最初遇到这个错误时,我做了一些研究。我意识到有一个打字问题。我直接去了模块文件,我可以看到index.d.ts文件中的错误。JQuery找不到参考。所以我用谷歌搜索了如何解决这个问题。解决方案是运行npm install @typings/jquery. 这解决了我在文件中的错误。ng serve但是,即使文件中已修复错误,当我尝试运行时,我仍然会收到来自 cli的错误index.d.ts。我对如何在这里前进感到不知所措。

有没有办法只使用 javascript 文件而不是尝试使用模块?这是一个使用 angular 的plunker。我可以看到他们只是将脚本文件直接添加到 index.html 文件中。我已将脚本文件添加到angular-cli.json文件中,但无法解决问题。Angular 仍然尝试使用该模块并因此使用输入文件。有什么想法或潜在的解决方案吗?我觉得某处有一个缓存需要重置,因为我修复了@typings错误。

4

0 回答 0