我有一个使用默认4.2.5版本创建的Angular .NET核心网站。我想将此更新为5.2.7(或更高版本),并且我已更新package.json文件以反映这一点:
{
"name": "JobWeb",
"private": true,
"version": "0.0.0",
"scripts": {
"test": "karma start ClientApp/test/karma.conf.js"
},
"devDependencies": {
"@angular/animations": "5.2.7",
"@angular/common": "5.2.7",
"@angular/compiler": "5.2.7",
"@angular/compiler-cli": "5.2.7",
"@angular/core": "5.2.7",
"@angular/forms": "5.2.7",
"@angular/platform-browser": "5.2.7",
"@angular/platform-browser-dynamic": "5.2.7",
"@angular/platform-server": "5.2.7",
"@angular/router": "5.2.7",
"@ngtools/webpack": "1.10.1",
"@types/chai": "4.1.2",
"@types/jasmine": "2.8.6",
"@types/webpack-env": "1.13.5",
"angular2-router-loader": "0.3.5",
"angular2-template-loader": "0.6.2",
"aspnet-prerendering": "^3.0.1",
"aspnet-webpack": "^2.0.3",
"awesome-typescript-loader": "3.5.0",
"bootstrap": "4.0.0",
"chai": "4.1.2",
"css": "2.2.1",
"css-loader": "0.28.10",
"es6-shim": "0.35.3",
"event-source-polyfill": "0.0.12",
"expose-loader": "0.7.4",
"extract-text-webpack-plugin": "3.0.2",
"file-loader": "1.1.11",
"html-loader": "0.5.5",
"isomorphic-fetch": "2.2.1",
"jasmine-core": "3.1.0",
"jquery": "3.3.1",
"json-loader": "0.5.7",
"karma": "2.0.0",
"karma-chai": "0.1.0",
"karma-chrome-launcher": "2.2.0",
"karma-cli": "1.0.1",
"karma-jasmine": "1.1.1",
"karma-webpack": "2.0.13",
"node-sass": "^4.7.2",
"preboot": "6.0.0-beta.3",
"raw-loader": "0.5.1",
"reflect-metadata": "0.1.12",
"rxjs": "5.5.6",
"sass-loader": "^6.0.7",
"style-loader": "0.20.2",
"to-string-loader": "1.1.5",
"typescript": "2.7.2",
"url-loader": "1.0.1",
"webpack": "4.1.0",
"webpack-hot-middleware": "2.21.2",
"webpack-merge": "4.1.2",
"zone.js": "0.8.20"
},
"dependencies": {
"popper.js": "^1.13.0"
}
}
我试图突出显示解决方案资源管理器中的所有软件包并以这种方式“更新”。我还尝试删除node_packages文件夹,然后执行还原。无论如何,我要么最终丢失包裹(感叹他们),要么再次安装角度4.2.5(也可能是旧版本的其他东西)。我使用NCU来获取我的package.json文件,所以它有最新的(或接近最新版本)所有版本(这给了我5.2.7的角度,这很好),但我似乎无法得到所有的东西安装得当。我不知道我做错了什么。
答案 0 :(得分:0)
删除node_modules
文件夹并从包含npm cache clean
的文件夹中运行这些命令npm install
,然后再运行package.json
。同时尝试将Typescript版本降级为2.6.2。