我正在使用visual studio 2017中的angular 5和.net core2构建我的第一个应用程序;我使用.Net core2来创建API并通过模型处理数据......这些API使用angular 5从客户端调用;为了使我的网络应用程序响应,我决定使用Bootstrap 4;在我安装它之前,依赖性工作正常,一切都很好,你可以在这里看到:
但是当我使用此命令成功安装bootstrap之后:npm install bootstrap --save
突然出现依赖项中的错误,我无法再构建我的解决方案...
为什么会出现此错误,如何解决?请注意,我使用2017年的visual studio创建了一个纯粹的angular5,我做了同样的事情 - >安装成功,我能够使用bootstrap 4;
错误:
更新
为了解决我的错误,我试过这个:
npm install
npm i @angular/core
但是抛出了以下错误:
无法安装“”@angular \ core“^ 5.2.0”,“因为它没有 包含package.json文件
这是我的package.json文件:
{
"name": "angular",
"version": "0.0.0",
"license": "MIT",
"scripts": {
"ng": "ng",
"start": "ng serve",
"build": "ng build --prod",
"test": "ng test",
"lint": "ng lint",
"e2e": "ng e2e"
},
"private": true,
"dependencies": {
"@angular/animations": "^5.2.0",
"@angular/common": "^5.2.0",
"@angular/compiler": "^5.2.0",
"@angular/core": "\"@angular/core\"^5.2.0\",",
"@angular/forms": "^5.2.0",
"@angular/http": "^5.2.0",
"@angular/platform-browser": "^5.2.0",
"@angular/platform-browser-dynamic": "^5.2.0",
"@angular/router": "^5.2.0",
"bootstrap": "^4.1.0",
"core-js": "^2.4.1",
"rxjs": "^5.5.6",
"zone.js": "^0.8.19"
},
"devDependencies": {
"@angular/cli": "~1.7.3",
"@angular/compiler-cli": "^5.2.0",
"@angular/language-service": "^5.2.0",
"@types/jasmine": "~2.8.3",
"@types/jasminewd2": "~2.0.2",
"@types/node": "~6.0.60",
"codelyzer": "^4.0.1",
"jasmine-core": "~2.8.0",
"jasmine-spec-reporter": "~4.2.1",
"karma": "~2.0.0",
"karma-chrome-launcher": "~2.2.0",
"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": "~4.1.0",
"tslint": "~5.9.1",
"typescript": "~2.5.3"
}
}
答案 0 :(得分:0)
"@angular/core": "\"@angular/core\"^5.2.0\",",
错误。
替换
"@angular/core": "^5.2.0"
与
function searchForArray(haystack, needle){
var i, j, current;
for(i = 0; i < haystack.length; ++i){
if(needle.length === haystack[i].length){
current = haystack[i];
for(j = 0; j < needle.length && needle[j] === current[j]; ++j);
if(j === needle.length)
return i;
}
}
return -1;
}
var arr = [[1,3],[1,2]];
var n = [1,3];
console.log(searchForArray(arr,n));