请稍等 ...
×

采纳答案成功!

向帮助你的同学说点啥吧!感谢那些助人为乐的人

cnpm install 安装的包版本和package.json中描述的不符

{
“name”: “taskmgr”,
“version”: “0.0.0”,
“license”: “MIT”,
“scripts”: {
“ng”: “ng”,
“start”: “ng serve”,
“build”: “ng build”,
“test”: “ng test”,
“lint”: “ng lint”,
“e2e”: “ng e2e”
},
“private”: true,
“dependencies”: {
"@angular/animations": “^4.0.2”,
"@angular/cdk": “^2.0.0-beta.8”,
"@angular/common": “^4.0.0”,
"@angular/compiler": “^4.0.0”,
"@angular/core": “^4.0.0”,
"@angular/forms": “^4.0.0”,
"@angular/http": “^4.0.0”,
"@angular/material": “^2.0.0-beta.8”,
"@angular/platform-browser": “^4.0.0”,
"@angular/platform-browser-dynamic": “^4.0.0”,
"@angular/router": “^4.0.0”,
“core-js”: “^2.4.1”,
“date-fns”: “^2.9.0”,
“hammerjs”: “^2.0.8”,
“rxjs”: “^5.1.0”,
“zone.js”: “^0.8.4”
},
“devDependencies”: {
"@angular/cli": “^1.1.3”,
"@angular/compiler-cli": “^4.0.0”,
"@angular/language-service": “^4.0.0”,
"@types/date-fns": “^2.6.0”,
"@types/jasmine": “2.5.45”,
"@types/node": “~6.0.60”,
“codelyzer”: “~3.0.1”,
“jasmine-core”: “~2.6.2”,
“jasmine-spec-reporter”: “~4.1.0”,
“karma”: “~1.7.0”,
“karma-chrome-launcher”: “~2.1.1”,
“karma-cli”: “~1.0.1”,
“karma-coverage-istanbul-reporter”: “^1.2.1”,
“karma-jasmine”: “~1.1.0”,
“karma-jasmine-html-reporter”: “^0.2.2”,
“protractor”: “~5.1.2”,
“ts-node”: “~3.0.4”,
“tslint”: “~5.3.2”,
“typescript”: “~2.3.3”
}
}

老师您好,我的package.json内容如上所示,可是我用cnpm install命令后,安装的包如@angular/cdk、@angular/material,都是2.0.0-beta.12,而不是package.json中的2.0.0-beta.8,导致运行报错,这是为什么,怎么解决呢?

正在回答

1回答

把^从package.json 中删掉,删掉node_modules 目录,重新安装

登录后可查看完整回答登录/注册
问题已解决,确定采纳
还有疑问,暂不采纳
意见反馈 帮助中心 APP下载
官方微信