我正在使用Angular 2版本。我曾经通过node.js
命令提示符安装bootstrap。
npm install ngx-bootstrap --save
我添加了像这样的.csproj。这是通过章鱼在服务器上部署我的应用程序,但是我在本地计算机上构建解决方案时遇到了这个问题。
错误:命令“npm install ngx-bootstrap --save”退出代码 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": {}
}
答案 0 :(得分:1)
此问题与npm
无关,而与my.csproj
文件中的设置无关。实际上,您无需使用此文件来安装npm modules
。 Visual Studio使用.csproj
文件来组织您的项目。因此,您无需为依赖项编辑它们。
npm
标记--save
会将模块保存为package.json
中的依赖项。当你git clone
项目时它很有用。克隆项目后,npm install
将使用标记--save
安装先前安装的所有软件包。您不需要在.csproj文件中包含这些行,特别是如果它们使npm install
失败。
你可以试试这个:
my.csproj
文件