gpt4 book ai didi

javascript - 升级 angular2-cli 项目中的 angular 2 依赖项

转载 作者:行者123 更新时间:2023-11-30 15:57:36 25 4
gpt4 key购买 nike

在尝试使用 angular2 并遵循他们网站上的 angular2 指南后,我尝试转移到 angular2-cli,但 angular2-cli 项目没有最新的依赖项,因此编译器给我一些关于代码中某些命令的错误。

我想升级所有依赖项,如核心、路由器 等。最新的路由器需要最新的内核,但是当我尝试这样做时:npm install core -g,我遇到了很多错误。

升级所有现有依赖项的最佳且快速的方法是什么?

这里是angular-cli和angular网站的package.json:

angular2-cli - 原始 package.json:

{
"name": "angular2-projects",
"version": "0.0.0",
"license": "MIT",
"angular-cli": {},
"scripts": {
"start": "ng serve",
"postinstall": "typings install",
"lint": "tslint \"src/**/*.ts\"",
"test": "ng test",
"pree2e": "webdriver-manager update",
"e2e": "protractor"
},
"private": true,
"dependencies": {
"@angular/common": "2.0.0-rc.3",
"@angular/compiler": "2.0.0-rc.3",
"@angular/core": "2.0.0-rc.3",
"@angular/forms": "0.2.0",
"@angular/http": "2.0.0-rc.3",
"@angular/platform-browser": "2.0.0-rc.3",
"@angular/platform-browser-dynamic": "2.0.0-rc.3",
"@angular/router": "3.0.0-alpha.8",
"es6-shim": "0.35.1",
"reflect-metadata": "0.1.3",
"rxjs": "5.0.0-beta.6",
"systemjs": "0.19.26",
"zone.js": "0.6.12"
},
"devDependencies": {
"angular-cli": "1.0.0-beta.9",
"codelyzer": "0.0.20",
"ember-cli-inject-live-reload": "1.4.0",
"jasmine-core": "2.4.1",
"jasmine-spec-reporter": "2.5.0",
"karma": "0.13.22",
"karma-chrome-launcher": "0.2.3",
"karma-jasmine": "0.3.8",
"protractor": "3.3.0",
"ts-node": "0.5.5",
"tslint": "3.11.0",
"typescript": "1.8.10",
"typings": "0.8.1"
}
}

来自 angular2 网站的最新 angular2 依赖项:

{
"dependencies": {
"@angular/common": "2.0.0-rc.4",
"@angular/compiler": "2.0.0-rc.4",
"@angular/core": "2.0.0-rc.4",
"@angular/forms": "0.2.0",
"@angular/http": "2.0.0-rc.4",
"@angular/platform-browser": "2.0.0-rc.4",
"@angular/platform-browser-dynamic": "2.0.0-rc.4",
"@angular/router": "3.0.0-beta.1",
"@angular/router-deprecated": "2.0.0-rc.2",
"@angular/upgrade": "2.0.0-rc.4",
"core-js": "^2.4.0",
"reflect-metadata": "0.1.3",
"rxjs": "5.0.0-beta.6",
"zone.js": "0.6.12",
"angular2-in-memory-web-api": "0.0.14",
"bootstrap": "^3.3.6"
},
"devDependencies": {
"concurrently": "^2.0.0",
"lite-server": "^2.2.0"
}
}

最佳答案

在 packages.json 中更新依赖项后,删除 node_modules 目录,然后运行“npm install”。这将从您的配置安装所有包。

关于javascript - 升级 angular2-cli 项目中的 angular 2 依赖项,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38257782/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com