我正在尝试利用golden-layout
停靠库。我为我的角度项目安装了所有东西,但是我遇到了一个我似乎无法绕过的错误。
** 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
时,即使错误已在index.d.ts
文件中修复,我仍然会从cli获取错误。我对如何向前迈进感到茫然。
有没有办法只使用角度的javascript文件,而不是尝试使用该模块?这是post使用角度的plunker。我可以看到他们只是将脚本文件直接添加到index.html文件中。我已将脚本文件添加到angular-cli.json
文件中,但它无法解决问题。 Angular仍然尝试使用模块,因此也就是输入文件。任何想法或潜在解决方案?我觉得有一个缓存需要重置,因为我修复了@typings
错误。