【发布时间】:2018-10-18 02:33:18
【问题描述】:
我安装了ng-select2 package。而且我收到此错误,并且在“ng serve”之后代码无法编译。
- 节点版本为8.10.0
- npm 版本 6.0.0
- 列表项
操作系统 Windows 7
ERROR in d:/PATH-TO-PROJECT-FOLDER/node_modules/@types/select2/index.d.ts (233,49): 'JQuery' only refers to a type, but is being used as a namespace here.
ERROR in D:/PATH-TO-PROJECT-FOLDER/node_modules/ng-select2/ng-select2/ng-select2.component.ts (188,18): Cannot find name 'Select2Options'.
ERROR in /src/app/pages/dashboard/dashboard.component.ts (91,19): Cannot find name 'Select2Options'.
// Dashboard component ts(91, 19) error + I've also added import to it:
public options: Select2Options;
我尝试过的解决方案是:
- 根据文档,添加 import 并在 @NgModule 中导入 app.module.ts
- 我也安装了 jquery@3.2.1 和 @types/jquery@2.0.41。
- npm cache verify,然后 npm cache clean --force 并更新 npm
- 删除 package-lock.json 然后运行 npm install 但这似乎不起作用。
【问题讨论】:
标签: javascript node.js angular npm