Lawrence
Lawrence

Reputation: 79

Getting issue while build my application for Angular

I am using the Angular 2 version. I used to install the bootstrap through node.js command prompt.

npm install ngx-bootstrap --save

and I added the .csproj like this. This is to deploy my application on the server through octopus, but I am getting this issue while building my solution on a local machine.

Error: The command "npm install ngx-bootstrap --save" exited with code 1.

Packages.json:

{
  "version": "1.0.0",
  "name": "mywizard-ad",
  "private": true,
  "scripts": {
    "build-Debug": "webpack --config webpack.debug.js --env.WebApiEnv dev",
    "build-Release": "webpack --config webpack.prod.js --env.WebApiEnv dev",
    "build-Prod": "webpack  --config webpack.prod.js --env.WebApiEnv prod",
    "build-Stage": "webpack --config webpack.prod.js --env.WebApiEnv stage",
    "build-UAT": "webpack --config webpack.prod.js --env.WebApiEnv uat",
    "build-Preprod": "webpack --config webpack.prod.js --env.WebApiEnv preprod",
    "build-Prod_EU": "webpack --config webpack.prod.js --env.WebApiEnv prod_eu",
    "build-Stage_EU": "webpack --config webpack.prod.js --env.WebApiEnv stage_eu",
    "build-Hotfix": "webpack --config webpack.prod.js --env.WebApiEnv hotfix"
  },
  "dependencies": {
    "@angular/common": "~4.3.1",
    "@angular/core": "~4.3.1",
    "@angular/http": "~4.3.1",
    "@angular/platform-browser": "~4.3.1",
    "@angular/platform-browser-dynamic": "~4.3.1",
    "@angular/router": "~4.3.1",
    "@ng-bootstrap/ng-bootstrap": "^1.0.0-beta.4",
    "@types/jquery": "^3.2.12",
    "angular2-moment": "^1.7.0",
    "core-js": "^2.4.1",
    "file-saver": "^1.3.3",
    "html-webpack-plugin": "^2.30.1",
    "jquery": "^3.2.1",
    "ng2-simple-global": "^1.2.5",
    "ngx-bootstrap": "^2.0.0-beta.7",
    "rxjs": "^5.1.0",
    "systemjs": "0.19.39",
    "zone.js": "^0.8.4"
  },
  "devDependencies": {
    "@angular/common": "~4.3.1",
    "@angular/compiler": "~4.3.1",
    "@angular/core": "~4.3.1",
    "@angular/forms": "~4.3.1",
    "@angular/http": "~4.3.1",
    "@angular/platform-browser": "~4.3.1",
    "@angular/platform-browser-dynamic": "~4.3.1",
    "@angular/router": "~4.3.1",
    "@ng-bootstrap/ng-bootstrap": "^1.0.0-beta.4",
    "@types/file-saver": "0.0.1",
    "@types/node": "^6.0.45",
    "clean-webpack-plugin": "^0.1.16",
    "core-js": "^2.4.1",
    "html-loader": "^0.5.1",
    "html-webpack-plugin": "^2.30.1",
    "jquery": "^3.2.1",
    "ng2-simple-global": "^1.2.5",
    "rxjs": "^5.1.0",
    "systemjs": "0.19.39",
    "typescript": "^2.0.0",
    "webpack": "^3.5.6",
    "webpack-concat-plugin": "^1.4.1",
    "webpack-merge": "^4.1.0",
    "zone.js": "^0.8.4"
  },
  "repository": {}
}

Upvotes: 1

Views: 190

Answers (1)

edkeveked
edkeveked

Reputation: 18401

The issue is not related to npm but to your settings in my.csproj file. Actually you don't need to use this file to install your npm modules. The .csproj file is used by Visual Studio to organize your project. So there is no need from your part to edit them for your dependencies.

The npm flag --save will save the module as a dependency in your package.json. It is useful when you git clone the project. After cloning the project, npm install will install all the packages that you have installed previously with the flag --save. You don't need to have those lines in your .csproj file, especially if they make your npm install fail.

You can try this:

  • Comment the lines in your my.csproj file
  • Run manually the command locally (you can check that you will have an entry corresponding to those dependencies in your "package.json"; if they are already there, it means that all the dependencies are already installed, i.e you can skip this step)
  • Commit your new "package.json" file

Upvotes: 1

Related Questions