在角度中从primeng实现日历时出错

时间:2018-04-25 07:05:42

标签: html node.js angular

我正在尝试在角度v4中使用primeng的日历来显示时间和日期。我已经说明了我定义模块的地方,html我定义了日历,package.json和错误。如果需要提及更多的事情来清除错误,请告诉我。

我在

中定义了它

主-system.module.ts

import { CalendarModule } from 'primeng/components/calendar/calendar'

transaction.component.ts

   <div class="ui-g-12 ui-md-4">
                  <h3>Time</h3>
                  <p-calendar [(ngModel)]="date7" [showTime]="true"> 
   </p-calendar> {{date7}}
              </div>

用于

transaction.component.html

 {
 "name": "cateina-tech",
 "version": "1.0.0-alpha.6",
 "description": "Open Source Bootstrap Admin Template",
 "author": "",
  "url": "http://cateina.com",
  "scripts": {
  "ng": "ng",
  "start": "ng serve",
  "build": "ng build",
  "test": "ng test",
  "lint": "ng lint",
  "e2e": "ng e2e"
 },
"private": true,
"dependencies": {
"@angular/common": "4.3.4",
"@angular/compiler": "4.3.4",
"@angular/core": "4.3.4",
"@angular/forms": "4.3.4",
"@angular/http": "4.3.4",
"@angular/platform-browser": "4.3.4",
"@angular/platform-browser-dynamic": "4.3.4",
"@angular/router": "4.3.4",
"@angular/upgrade": "4.3.4",
"angular-2-local-storage": "^1.0.1",
"angular-localstorage": "^1.1.5",
"body-parser": "^1.18.2",
"chart.js": "2.6.0",
"core-js": "2.5.0",
"cors": "^2.8.4",
"date-time": "^2.1.0",
"express": "^4.16.2",
"express-jwt": "^5.3.1",
"express-session": "^1.15.6",
"font-awesome": "^4.7.0",
"jquery": "^3.3.1",
"jsonwebtoken": "^8.2.0",
"jwt-decode": "^2.2.0",
"localstorage": "^0.1.0",
"moment": "2.18.1",
"mysql": "^2.15.0",
"mysql-server": "^1.0.5",
"ng2-charts": "1.6.0",
"ng2-order-pipe": "^0.1.5",
"ng2-search-filter": "^0.4.7",
"ngx-bootstrap": "1.8.1",
"ngx-ellipsis": "^1.0.7",
"ngx-gauge": "^1.0.0-beta.2",
"ngx-loading": "^1.0.14",
"ngx-pagination": "^3.1.0",
"node-datetime": "^2.0.6",
"nodemailer": "^4.6.3",
"nodemon": "^1.17.3",
"path": "*",
"pepipost-sdk-nodejs": "^0.4.0",
"primeng": "^5.2.4",
"q": "^1.5.1",
"request": "^2.83.0",
"request-promise": "^4.2.2",
"restify": "^6.3.4",
"rootpath": "^0.1.2",
"rxjs": "5.4.3",
"save": "^2.3.2",
"ts-helpers": "1.1.2",
"zone.js": "0.8.16"
},
"devDependencies": {
"@angular/cli": "^1.7.3",
"@angular/compiler-cli": "4.3.4",
"@types/jasmine": "2.5.53",
"@types/node": "8.0.20",
"codelyzer": "3.1.2",
"jasmine-core": "2.7.0",
"jasmine-spec-reporter": "4.2.0",
"karma": "1.7.0",
"karma-chrome-launcher": "2.2.0",
"karma-cli": "1.0.1",
"karma-coverage-istanbul-reporter": "1.3.0",
"karma-jasmine": "1.1.0",
"karma-jasmine-html-reporter": "0.2.2",
"protractor": "5.1.2",
"ts-node": "3.3.0",
"tslint": "5.6.0",
"typescript": "^2.3.4"
 },
 "engines": {
  "node": ">= 6.9.0",
  "npm": ">= 3.0.0"
 }
 }

的package.json

var printData = document.getElementById('printID').innerHTML;

角终端错误

  

错误中的错误:模块的元数据版本不匹配   /home/dell/Downloads/Adaani5.0.0/node_modules/primeng/components/calendar/calendar.d.ts,found   版本4,预期3,解析符号MasterSystemModule in   /home/dell/Downloads/Adaani5.0.0/src/app/master-system/master-system.module.ts,   解析符号MasterSystemModule in   /home/dell/Downloads/Adaani5.0.0/src/app/master-system/master-system.module.ts       at syntaxError(/home/dell/Downloads/Adaani5.0.0/node_modules/@angular/compiler/bundles/compiler.umd.js:1725:34)       在simplifyInContext(/home/dell/Downloads/Adaani5.0.0/node_modules/@angular/compiler/bundles/compiler.umd.js:24949:23)       在StaticReflector.simplify(/home/dell/Downloads/Adaani5.0.0/node_modules/@angular/compiler/bundles/compiler.umd.js:24961:13)       在StaticReflector.annotations(/home/dell/Downloads/Adaani5.0.0/node_modules/@angular/compiler/bundles/compiler.umd.js:24391:41)       在_getNgModuleMetadata(/home/dell/Downloads/Adaani5.0.0/node_modules/@angular/compiler-cli/src/ngtools_impl.js:138:31)       at _extractLazyRoutesFromStaticModule(/home/dell/Downloads/Adaani5.0.0/node_modules/@angular/compiler-cli/src/ngtools_impl.js:109:26)       at includeLazyRouteAndSubRoutes(/home/dell/Downloads/Adaani5.0.0/node_modules/@angular/compiler-cli/src/ngtools_impl.js:66:25)       在Array.reduce()       at Object.listLazyRoutesOfModule(/home/dell/Downloads/Adaani5.0.0/node_modules/@angular/compiler-cli/src/ngtools_impl.js:54:36)       在Function.NgTools_InternalApi_NG_2.listLazyRoutes(/home/dell/Downloads/Adaani5.0.0/node_modules/@angular/compiler-cli/src/ngtools_api.js:91:39)       在AotPlugin._getLazyRoutesFromNgtools(/home/dell/Downloads/Adaani5.0.0/node_modules/@ngtools/webpack/src/plugin.js:240:66)       在_donePromise.Promise.resolve.then.then.then.then.then(/home/dell/Downloads/Adaani5.0.0/node_modules/@ngtools/webpack/src/plugin.js:493:24)       在       at process._tickCallback(internal / process / next_tick.js:188:7)

1 个答案:

答案 0 :(得分:0)

我的观点如下:

  1. 删除node_modules文件夹
  2. 运行npm upgradenpm update
  3. 如果问题仍然存在,请再次尝试步骤1-2,但这次使用-g标志
  4. +1:如果您收到有关“可用更新”的任何警告,请按照消息中描述的内容进行操作