我正在从事Angular 4项目。我创建了一个具有某些依赖项的项目。该项目本身运行良好。
现在我希望在另一个项目中使用该项目。我将前一个项目添加到后者的package.json(在依赖项下)。
现在,当我运行npm install
时,将安装该软件包,但没有安装其依赖项,因此必须手动安装它们才能使我的项目正常工作。
谁能告诉我为什么会这样?我在执行此操作时是否有任何错误?
代码:
ui-common package.json
"dependencies": {
"@angular/cdk": "^2.0.0-beta.11",
"@angular/common": "^4.4.6",
"@angular/compiler": "^4.4.6",
"@angular/core": "^4.4.6",
"@angular/forms": "^4.4.6",
"@angular/http": "^4.4.6",
"@angular/material": "^2.0.0-beta.11",
"@angular/platform-browser": "^4.4.6",
"@angular/platform-browser-dynamic": "^4.4.6",
"@angular/router": "^4.4.6",
"ag-grid": "^17.1.1",
"ag-grid-angular": "^17.1.0",
"angular-split": "=0.2.2",
"angular-tree-component": "^7.0.2-beta1",
"core-js": "=2.5.1",
"draggabilly": "^2.2.0", // The one causing trouble
"foundation-sites": "=6.3.1",
"rxjs": "^5.5.2",
"x2js": "^3.2.1",
"zone.js": "=0.8.18"
}
client-app package.json
"dependencies": {
"@angular/animations": "^4.3.1",
"@angular/cdk": "^2.0.0-beta.11",
"@angular/common": "=4.4.6",
"@angular/compiler": "=4.4.6",
"@angular/core": "=4.4.6",
"@angular/forms": "=4.4.6",
"@angular/http": "=4.4.6",
"@angular/material": "^2.0.0-beta.11",
"@angular/platform-browser": "=4.4.6",
"@angular/platform-browser-dynamic": "=4.4.6",
"@angular/router": "=4.4.6",
"@goldsam/ng-golden-layout": "0.0.3",
"@ngui/scrollable": "^0.9.1",
"@ngui/utils": "^0.8.1",
"ag-grid": "^16.0.1",
"ag-grid-angular": "^16.0.0",
"angular-tree-component": "=7.0.2-beta1",
"core-js": "=2.5.1",
"enhanced-resolve": "=3.4.1",
"foundation-sites": "=6.3.1",
"golden-layout": "^1.5.9",
"intl": "=1.2.5",
"mdn-polyfills": "=5.5.0",
"morgan": "=1.9.0",
"popper.js": "^1.12.9",
"rxjs": "=5.5.2",
"typescript-collections": "1.3.2",
"ui-common": "1.0.0-beta.25", // package included here
"zone.js": "=0.8.18"
}
答案 0 :(得分:0)
您是否尝试过npm install --include依赖项。也可能是因为您可能也在运行旧版本,所以您需要这样做
npm install -v 2.0.0
这应该在Atom项目文件夹中安装gem依赖项