问题描述
我有一个 Angular 4 应用程序,我要升级到 Angular 5.
I have an Angular 4 application, which I am upgrading to Angular 5.
我收到以下错误.
src/app/application/services/generated/variables.ts(1,10) 中的错误:错误 TS2305:模块'"..../node_modules/@angular/core/core"'没有导出成员OpaqueToken".
代码片段是:
import { OpaqueToken } from '@angular/core';
export const BASE_PATH = new OpaqueToken('basePath');
export const COLLECTION_FORMATS = {
'csv': ',',
'tsv': ' ',
'ssv': ' ',
'pipes': '|'
}
此代码由 swagger 编辑器生成.
推荐答案
在 package.json 文件中包含 folling
includes folling in the package.json file
"@angular/flex-layout": "^2.0.0-beta.12"
尝试删除 node_modules 文件夹,删除 package.json 文件然后运行以下命令我希望这个问题得到解决
Try deleting the node_modules folder, delete the package.json file then running the following command i hope this problem was resolved
npm 安装
有关此问题,请参阅以下链接https://github.com/angular/flex-layout/issues/494#issuecomment-343355178
please refer following link for this issuehttps://github.com/angular/flex-layout/issues/494#issuecomment-343355178
这篇关于为什么 Angular 5 中的错误是:没有导出成员“OpaqueToken".?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!