我正在尝试使用Ionic2,但在尝试为Ionic2安装默认的npm软件包时遇到了一些错误。我尝试运行以下命令并收到以下错误:
npm install @angular/common
like here
还尝试了this解决方案,但遇到了同样的错误。
package.json文件内容:
{
"dependencies": {
"@angular/compiler": "^2.0.0-rc.1",
"@angular/core": "^2.0.0-rc.1",
"@angular/http": "^2.0.0-rc.1",
"@angular/platform-browser": "^2.0.0-rc.1",
"@angular/platform-browser-dynamic": "^2.0.0-rc.1",
"@angular/router": "^2.0.0-rc.1",
"es6-shim": "^0.35.0",
"ionic-angular": "2.0.0-beta.7",
"ionic-native": "^1.1.0",
"ionicons": "3.0.0",
"reflect-metadata": "^0.1.3",
"rxjs": "5.0.0-beta.6",
"zone.js": "^0.6.12"
},
"devDependencies": {
"del": "2.2.0",
"gulp": "3.9.1",
"gulp-watch": "4.3.5",
"ionic-gulp-browserify-es2015": "^1.1.0",
"ionic-gulp-fonts-copy": "^1.0.0",
"ionic-gulp-html-copy": "^1.0.0",
"ionic-gulp-sass-build": "^1.0.0",
"ionic-gulp-scripts-copy": "^2.0.0",
"run-sequence": "1.1.5"
}
}
答案 0 :(得分:2)
尝试此命令
npm install -g npm
答案 1 :(得分:0)
试试这个可以帮到你: -
npm install @angular/common@2.0.0-rc.1 --save
或者您可以提及您想要的版本
答案 2 :(得分:0)
我也经常遇到同样的错误。所以我改变了angular2 pack @angular pack。
这是我的package.json
{
"name": "Angular2",
"version": "1.0.0",
"scripts": {
"postinstall": "npm run typings install",
"tsc": "tsc",
"tsc:w": "tsc -w",
"lite": "lite-server",
"start": "concurrently \"npm run tsc:w\" \"npm run lite\" ",
"typings": "typings"
},
"license": "ISC",
"dependencies": {
"angular-ui-sortable": "0.13.4",
"angular2": "2.0.0-beta.15",
"angular2-grid": "~0.4.0",
"bootstrap": "3.3.6",
"cli-width": "^2.0.0",
"dragula": "^3.6.8",
"es6-shim": "^0.35.0",
"moment": "2.11.2",
"ng2-bootstrap": "1.0.5",
"ng2-bs3-modal": "0.2.1",
"ng2-ckeditor": "1.0.0",
"ng2-datepicker": "0.6.2",
"ng2-dragula": "^1.1.5",
"ng2-easy-table": "0.0.10",
"ng2-table": "1.0.0-beta.0",
"ng2-translate": "1.11.0",
"reflect-metadata": "0.1.2",
"rxjs": "5.0.0-beta.6",
"systemjs": "0.19.24",
"zone.js": "0.6.12",
"ng2-img-cropper":"0.2.2",
"ng2-dnd":"1.4.1"
},
"devDependencies": {
"concurrently": "^2.0.0",
"lite-server": "^2.1.0",
"typescript": "^1.8.7",
"typings": "^0.7.5",
"cli-width": "^2.0.0"
}
}