我有一个Angular项目,正在使用ngx-markdown-editor
软件包。只要在我已经启动开发服务器之后添加LMarkdownModule
之后,它就可以很好地工作。如果已经导入了模块,则会出现以下错误:
ERROR in Error: Metadata version mismatch for module /path/to/the/project/my-angular-app/node_modules/ngx-markdown-editor/ngx-markdown-editor.d.ts, found version 4, expected 3, resolving symbol SharedModule in /path/to/the/project/my-angular-app/src/app/shared/shared.module.ts, resolving symbol SharedModule in /path/to/the/project/my-angular-app/src/app/shared/shared.module.ts
at syntaxError (/path/to/the/project/my-angular-app/node_modules/@angular/compiler/bundles/compiler.umd.js:1729:34)
at simplifyInContext (/path/to/the/project/my-angular-app/node_modules/@angular/compiler/bundles/compiler.umd.js:24979:23)
at StaticReflector.simplify (/path/to/the/project/my-angular-app/node_modules/@angular/compiler/bundles/compiler.umd.js:24991:13)
at StaticReflector.annotations (/path/to/the/project/my-angular-app/node_modules/@angular/compiler/bundles/compiler.umd.js:24418:41)
at _getNgModuleMetadata (/path/to/the/project/my-angular-app/node_modules/@angular/compiler-cli/src/ngtools_impl.js:138:31)
at _extractLazyRoutesFromStaticModule (/path/to/the/project/my-angular-app/node_modules/@angular/compiler-cli/src/ngtools_impl.js:109:26)
at /path/to/the/project/my-angular-app/node_modules/@angular/compiler-cli/src/ngtools_impl.js:129:27
at Array.reduce (<anonymous>)
at _extractLazyRoutesFromStaticModule (/path/to/the/project/my-angular-app/node_modules/@angular/compiler-cli/src/ngtools_impl.js:128:10)
at /path/to/the/project/my-angular-app/node_modules/@angular/compiler-cli/src/ngtools_impl.js:129:27
at Array.reduce (<anonymous>)
at _extractLazyRoutesFromStaticModule (/path/to/the/project/my-angular-app/node_modules/@angular/compiler-cli/src/ngtools_impl.js:128:10)
at Object.listLazyRoutesOfModule (/path/to/the/project/my-angular-app/node_modules/@angular/compiler-cli/src/ngtools_impl.js:53:22)
at Function.NgTools_InternalApi_NG_2.listLazyRoutes (/path/to/the/project/my-angular-app/node_modules/@angular/compiler-cli/src/ngtools_api.js:91:39)
at AotPlugin._getLazyRoutesFromNgtools (/path/to/the/project/my-angular-app/node_modules/@ngtools/webpack/src/plugin.js:241:66)
at _donePromise.Promise.resolve.then.then.then.then.then (/path/to/the/project/my-angular-app/node_modules/@ngtools/webpack/src/plugin.js:495:24)
就像我说的那样,很奇怪的部分是,如果我已经启动开发服务器之后添加了LMarkdownModule
的导入,则应用将重新编译,并且markdown编辑器将按预期方式显示并正常工作。我尝试清除package-lock.json文件并重新安装node_modules
,但这些都不起作用。
许多其他类似的问题都表明特定版本的冒犯软件包中存在问题/错误,但这似乎不是问题所在。
我在该项目上使用的是Angular 4,当我用Angular 6测试该软件包时,我没有遇到相同的问题,所以可能是问题所在。但是,为什么在我运行本地服务器后它可以工作?如果有什么我想念的,我会非常感激。