【发布时间】:2018-02-15 05:13:14
【问题描述】:
我在我的 angular 4 项目中尝试ng serve,我看到了这个
ERROR in /var/www/penderie1/src/app/admin/admin.module.ts (20,32): Cannot find module 'ng2-ckeditor'.
ERROR in /var/www/penderie1/src/app/myaccount/myaccount.module.ts (6,32): Cannot find module 'ng2-ckeditor'.
ERROR in /var/www/penderie1/src/app/app.module.ts (6,32): Cannot find module 'ng2-ckeditor'.
ERROR in Error: Error encountered resolving symbol values statically. Could not resolve ng2-ckeditor relative to /var/www/penderie1/src/app/app.module.ts., resolving symbol AppModule in /var/www/penderie1/src/app/app.module.ts, resolving symbol AppModule in /var/www/penderie1/src/app/app.module.ts
at syntaxError (/var/www/penderie1/node_modules/@angular/compiler/bundles/compiler.umd.js:1729:34)
at simplifyInContext (/var/www/penderie1/node_modules/@angular/compiler/bundles/compiler.umd.js:24979:23)
at StaticReflector.simplify (/var/www/penderie1/node_modules/@angular/compiler/bundles/compiler.umd.js:24991:13)
at StaticReflector.annotations (/var/www/penderie1/node_modules/@angular/compiler/bundles/compiler.umd.js:24418:41)
at _getNgModuleMetadata (/var/www/penderie1/node_modules/@angular/compiler-cli/src/ngtools_impl.js:138:31)
at _extractLazyRoutesFromStaticModule (/var/www/penderie1/node_modules/@angular/compiler-cli/src/ngtools_impl.js:109:26)
at Object.listLazyRoutesOfModule (/var/www/penderie1/node_modules/@angular/compiler-cli/src/ngtools_impl.js:53:22)
at Function.NgTools_InternalApi_NG_2.listLazyRoutes (/var/www/penderie1/node_modules/@angular/compiler-cli/src/ngtools_api.js:91:39)
at AotPlugin._getLazyRoutesFromNgtools (/var/www/penderie1/node_modules/@ngtools/webpack/src/plugin.js:212:44)
at _donePromise.Promise.resolve.then.then.then.then.then (/var/www/penderie1/node_modules/@ngtools/webpack/src/plugin.js:448:24)
at <anonymous>
at process._tickCallback (internal/process/next_tick.js:160:7)
我不明白这个问题,因为ck-editor 已正确包含在我的配置文件中。
当我运行 npm install ng-2-ckeditor --save 并运行 ng serve 时,我看到了这个错误
ERROR in Error: Metadata version mismatch for module /var/www/penderie1/node_modules/ng2-ckeditor/lib/ng2-ckeditor.d.ts, found version 4, expected 3, resolving symbol AppModule in /var/www/penderie1/src/app/app.module.ts, resolving symbol AppModule in /var/www/penderie1/src/app/app.module.ts
at syntaxError (/var/www/penderie1/node_modules/@angular/compiler/bundles/compiler.umd.js:1729:34)
at simplifyInContext (/var/www/penderie1/node_modules/@angular/compiler/bundles/compiler.umd.js:24979:23)
at StaticReflector.simplify (/var/www/penderie1/node_modules/@angular/compiler/bundles/compiler.umd.js:24991:13)
at StaticReflector.annotations (/var/www/penderie1/node_modules/@angular/compiler/bundles/compiler.umd.js:24418:41)
at _getNgModuleMetadata (/var/www/penderie1/node_modules/@angular/compiler-cli/src/ngtools_impl.js:138:31)
at _extractLazyRoutesFromStaticModule (/var/www/penderie1/node_modules/@angular/compiler-cli/src/ngtools_impl.js:109:26)
at Object.listLazyRoutesOfModule (/var/www/penderie1/node_modules/@angular/compiler-cli/src/ngtools_impl.js:53:22)
at Function.NgTools_InternalApi_NG_2.listLazyRoutes (/var/www/penderie1/node_modules/@angular/compiler-cli/src/ngtools_api.js:91:39)
at AotPlugin._getLazyRoutesFromNgtools (/var/www/penderie1/node_modules/@ngtools/webpack/src/plugin.js:212:44)
at _donePromise.Promise.resolve.then.then.then.then.then (/var/www/penderie1/node_modules/@ngtools/webpack/src/plugin.js:448:24)
at <anonymous>
at process._tickCallback (internal/process/next_tick.js:160:7)
【问题讨论】:
-
你安装 npm 了吗?
-
你跑
npm install了吗? -
是的,我做到了。我只在那里看到警告。不是错误
-
再次运行
npm install ng2-ckeditor --save并检查 -
完成了,还是一样
标签: angular npm-install