加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 综合聚焦 > 服务器 > 安全 > 正文

Angular2:ERROR in Error遇到静态解析符号值

发布时间:2020-12-17 07:12:55 所属栏目:安全 来源:网络整理
导读:我使用angular / cli 1.3.2和Angular 4.4.0. 当我使用npm模块angular-split @ 0.2.2时,在编译期间我遇到了 ERROR in Error encountered resolving symbol values statically. Function calls are not supported. Consider replacing the function or lambda
我使用angular / cli 1.3.2和Angular 4.4.0.
当我使用npm模块angular-split @ 0.2.2时,在编译期间我遇到了

ERROR in Error encountered resolving symbol values statically.
Function calls are not supported. Consider replacing the function or
lambda with a reference to an exported function (position 194:50 in
the original .ts file),resolving symbol NgModule in
path-to-project/node_modules/angular-split/node_modules/@angular/core/core.d.ts,
resolving symbol AngularSplitModule in
path-to-project/node_modules/angular-split/dist/angularSplit.module.d.ts,
resolving symbol AngularSplitModule in
path-to-project/node_modules/angular-split/dist/angularSplit.module.d.ts

这里的文件angularSplit.module.d.ts只有一行代码:

导出声明类AngularSplitModule {}

但是,可以通过保存任何文件并触发重新编译(奇怪)来“解决”此错误.

然后,当我在浏览器中打开localhost:4200时,我会看到另一个错误:

compiler.es5.js:1694未捕获错误:模块’AppModule’导入的意外值’AngularSplitModule’.请添加@NgModule注释.

从github和stackoverflow我发现了一些类似的问题,但没有人能说出原因.

这发生在我更新node / angular / angular-cli之后,但是在我回滚后它仍然无法正常工作.

有谁知道为什么会这样?

解决方法

好的,经过几个小时的阅读后,我发现了一个有用的解决方案
https://github.com/angular/angular-cli/issues/3854#issuecomment-274344771

具体来说,添加
路径:{“@ angular / *”:[“../ node_modules/@angular/*”]}
到tsconfig.json文件,“compilerOptions”选项

它解决了我的问题但仍想知道原因.

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读