【问题标题】:Unable to migrate to angular 5 getting invalid error on angular files无法迁移到 Angular 5 在 Angular 文件上出现无效错误
【发布时间】:2017-11-20 02:58:07
【问题描述】:

您好,我在 Angular 4.4.3 中创建了一个 Angular 应用程序,下面是我的依赖项

"dependencies": {
    "@angular/animations": "^4.4.3",
    "@angular/cdk": "^5.0.0-rc0",
    "@angular/common": "^4.4.3",
    "@angular/compiler": "^4.4.3",
    "@angular/core": "^4.4.3",
    "@angular/forms": "^4.4.3",
    "@angular/http": "^4.4.3",
    "@angular/material": "^5.0.0-rc0",
    "@angular/platform-browser": "^4.4.3",
    "@angular/platform-browser-dynamic": "^4.4.3",
    "@angular/platform-server": "^4.4.3",
    "@angular/router": "^4.4.3",
    "@types/bootstrap-datepicker": "0.0.9",
    "@types/bootstrap.v3.datetimepicker": "^4.17.41",
    "@types/daterangepicker": "^2.1.10",
    "@types/icheck": "^0.8.29",
    "@types/jquery-knob": "^1.2.29",
    "@types/jquery.slimscroll": "^1.3.31",
    "@types/jqueryui": "^1.11.35",
    "admin-lte": "2.3.11",
    "bootstrap": "^3.3.7",
    "bootstrap-datepicker": "^1.7.1",
    "bootstrap3-wysihtml5-bower": "^0.3.3",
    "core-js": "^2.4.1",
    "daterangepicker": "^2.1.25",
    "ej-angular2": "^15.3.34",
    "electron": "^1.7.9",
    "font-awesome": "^4.7.0",
    "icheck": "^1.0.2",
    "install": "^0.10.1",
    "ionicons": "^2.0.1",
    "jquery": "^2.2.3",
    "jquery-knob": "^1.2.11",
    "jquery-slimscroll": "^1.3.8",
    "jquery-sparkline": "^2.4.0",
    "jqueryui": "^1.11.1",
    "moment": "^2.18.1",
    "morris.js": "^0.5.0",
    "ng-bootstrap-form-validation": "^1.0.10",
    "ng2-growl": "0.0.7",
    "ng4-loading-spinner": "^1.0.27",
    "npm": "^5.3.0",
    "raphael": "^2.2.7",
    "rxjs": "^5.4.3",
    "syncfusion-javascript": "^15.3.33",
    "typescript": "^2.4.2",
    "zone.js": "^0.8.17"
  },
  "devDependencies": {
    "@angular/cli": "^1.4.3",
    "@angular/compiler-cli": "^4.4.3",
    "@angular/language-service": "^4.4.3",
    "@types/ej.web.all": "^15.3.4",
    "@types/jasmine": "~2.6.0",
    "@types/jasminewd2": "~2.0.2",
    "@types/jquery": "^2.0.48",
    "@types/morris.js": "^0.5.6",
    "@types/node": "~6.0.60",
    "codelyzer": "~3.2.0",
    "jasmine-core": "~2.8.0",
    "jasmine-spec-reporter": "~4.2.1",
    "karma": "~1.7.0",
    "karma-chrome-launcher": "~2.1.1",
    "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.7.0",
    "typescript": "~2.4.2"
  }

当我尝试使用 [https://angular-update-guide.firebaseapp.com/]

中定义的迁移标签将其迁移到 Angular 5 时
npm install @angular/animations@'^5.0.0' @angular/common@'^5.0.0' @angular/compiler@'^5.0.0' @angular/compiler-cli@'^5.0.0' @angular/core@'^5.0.0' @angular/forms@'^5.0.0' @angular/http@'^5.0.0' @angular/platform-browser@'^5.0.0' @angular/platform-browser-dynamic@'^5.0.0' @angular/platform-server@'^5.0.0' @angular/router@'^5.0.0' typescript@2.4.2 rxjs@'^5.5.2'

npm install typescript@2.4.2 --save-exact

当我尝试运行此代码时,rxjs 上出现不存在的版本问题

所以我尝试在以下代码的帮助下安装最新的脚本

npm install @angular/animations@latest @angular/common@latest @angular/compiler@latest @angular/compiler-cli@latest @angular/core@latest @angular/forms@latest @angular/http@latest @angular/platform-browser@latest @angular/platform-browser-dynamic@latest @angular/platform-server@latest @angular/router@latest typescript@2.4.2 rxjs@latest

获取角度文件本身的无效错误

+-- @angular/animations@5.0.2  invalid
+-- @angular/common@5.0.2  invalid
+-- @angular/compiler@5.0.2  invalid
+-- @angular/compiler-cli@5.0.2  invalid
| +-- chokidar@1.7.0
| | +-- anymatch@1.3.2
| | | +-- micromatch@2.3.11
| | | | +-- arr-diff@2.0.0
| | | | | `-- arr-flatten@1.1.0
| | | | +-- array-unique@0.2.1
| | | | +-- braces@1.8.5
| | | | | +-- expand-range@1.8.2
| | | | | | `-- fill-range@2.2.3
| | | | | |   +-- is-number@2.1.0
| | | | | |   +-- isobject@2.1.0
| | | | | |   +-- randomatic@1.1.7
| | | | | |   | +-- is-number@3.0.0
| | | | | |   | | `-- kind-of@3.2.2
| | | | | |   | `-- kind-of@4.0.0
| | | | | |   `-- repeat-string@1.6.1
| | | | | +-- preserve@0.2.0
| | | | | `-- repeat-element@1.1.2
| | | | +-- expand-brackets@0.1.5
| | | | | `-- is-posix-bracket@0.1.1
| | | | +-- extglob@0.3.2
| | | | +-- filename-regex@2.0.1
| | | | +-- kind-of@3.2.2
| | | | | `-- is-buffer@1.1.6
| | | | +-- object.omit@2.0.1
| | | | | +-- for-own@0.1.5
| | | | | | `-- for-in@1.0.2
| | | | | `-- is-extendable@0.1.1
| | | | +-- parse-glob@3.0.4
| | | | | +-- glob-base@0.3.0
| | | | | `-- is-dotfile@1.0.3
| | | | `-- regex-cache@0.4.4
| | | |   `-- is-equal-shallow@0.1.3
| | | |     `-- is-primitive@2.0.0
| | | `-- normalize-path@2.1.1
| | |   `-- remove-trailing-separator@1.1.0
| | +-- async-each@1.0.1
| | +-- glob-parent@2.0.0
| | +-- inherits@2.0.3
| | +-- is-binary-path@1.0.1
| | | `-- binary-extensions@1.11.0
| | +-- is-glob@2.0.1
| | | `-- is-extglob@1.0.0
| | +-- path-is-absolute@1.0.1
| | `-- readdirp@2.1.0
| |   +-- graceful-fs@4.1.11
| |   +-- minimatch@3.0.4
| |   | `-- brace-expansion@1.1.8
| |   |   +-- balanced-match@1.0.0
| |   |   `-- concat-map@0.0.1
| |   +-- readable-stream@2.3.3
| |   | +-- core-util-is@1.0.2
| |   | +-- isarray@1.0.0
| |   | +-- process-nextick-args@1.0.7
| |   | +-- safe-buffer@5.1.1
| |   | +-- string_decoder@1.0.3
| |   | `-- util-deprecate@1.0.2
| |   `-- set-immediate-shim@1.0.1
| +-- minimist@1.2.0
| +-- reflect-metadata@0.1.10
| `-- tsickle@0.24.1
|   +-- mkdirp@0.5.1
|   | `-- minimist@0.0.8
|   +-- source-map@0.5.7
|   `-- source-map-support@0.4.18
+-- @angular/core@5.0.2  invalid
+-- @angular/forms@5.0.2  invalid
+-- @angular/http@5.0.2  invalid
+-- @angular/platform-browser@5.0.2  invalid
+-- @angular/platform-browser-dynamic@5.0.2  invalid
| `-- tslib@1.8.0
+-- @angular/platform-server@5.0.2  invalid
| +-- domino@1.0.30
| `-- xhr2@0.1.4
+-- @angular/router@5.0.2  invalid
+-- rxjs@5.5.2
| `-- symbol-observable@1.0.4
+-- typescript@2.4.2  invalid
`-- UNMET DEPENDENCY zone.js@^0.8.17 

我的节点版本是3.10.10

让我知道这是正确的方法还是我错过了什么

【问题讨论】:

    标签: node.js angular angular-cli


    【解决方案1】:

    5.0.2 版本可能存在问题 试试这个

    npm install @angular/{animations,common,compiler,compiler-cli,core,forms,http,platform-browser,platform-browser-dynamic,platform-server,router}@5.0.0
    

    您还需要更新 node.js 和 npm。安装最新的 lts

    【讨论】:

    • 感谢@Melchia 付出的时间和精力。我已将 ny node js 升级到 v9.2.0 和 npm 版本 5.5.1。收到以下错误 npm ERR! notarget 找不到与@angular/common@'5.0.0' npm ERR 匹配的版本! notarget 在大多数情况下,您或您的依赖项之一正在请求 npm ERR! notarget 一个不存在的包版本。 npm 错误!可以在以下位置找到此运行的完整日志:npm ERR! C:\Users\user\AppData\Roaming\npm-cache_logs\2017-11-20T03_52_21_231Z-debug.log
    • 你能运行命令 npm view @angular/common 并把输出吗?
    • 版本:[ '4.4.1', '4.4.2', ... 还有 27 个项目 ],
    • 你能在里面看到 5.0.0 版本吗?
    • 升级 node.js 和 npm 为我做了。
    猜你喜欢
    • 2023-03-08
    • 1970-01-01
    • 2019-05-18
    • 2018-10-12
    • 2023-04-08
    • 2021-12-15
    • 1970-01-01
    • 2021-05-26
    • 2019-09-09
    相关资源
    最近更新 更多