我的主管给我寄了一个git repository
在我克隆它并运行npm install
之后
我仍然缺少packages
或彼此不兼容的软件包[有冲突]。
有什么工具可以解决依赖版本中的这种冲突?
这是我的package.json
文件
{
"name": "ang2-conduit",
"version": "0.0.0",
"license": "MIT",
"scripts": {
"ng": "ng",
"start": "ng serve --proxy-config proxy.conf.json",
"build": "ng build",
"test": "ng test",
"lint": "ng lint",
"e2e": "ng e2e"
},
"private": true,
"dependencies": {
"@angular/animations": "4.3.5",
"@angular/common": "^4.0.0",
"@angular/compiler": "^4.0.0",
"@angular/compiler-cli": "^4.3.2",
"@angular/core": "^4.0.0",
"@angular/forms": "^4.0.0",
"@angular/http": "^4.0.0",
"@angular/platform-browser": "^4.0.0",
"@angular/platform-browser-dynamic": "^4.0.0",
"@angular/router": "^4.0.0",
"@types/lodash": "^4.14.85",
"bootstrap": "^3.3.7",
"core-js": "^2.4.1",
"file-saver": "^1.3.3",
"jquery": "^3.2.1",
"lodash": "^4.17.4",
"marked": "^0.3.6",
"ng2-validation": "^4.2.0",
"ngx-bootstrap": "^2.0.0-beta.9",
"ngx-chips": "^1.6.1",
"ngx-file-drop": "^2.0.1",
"ngx-loading": "^1.0.9",
"ngx-pagination": "^3.0.3",
"ngx-toastr": "^6.5.0",
"rxjs": "^5.1.0",
"ts-helpers": "^1.1.2",
"xlsx": "^0.11.14",
"zone.js": "^0.8.4"
},
"devDependencies": {
"@angular/cli": "^1.0.0",
"@angular/compiler-cli": "^4.0.0",
"@types/jasmine": "2.5.47",
"@types/marked": "^0.0.28",
"@types/node": "~7.0.16",
"codelyzer": "~3.0.1",
"jasmine-core": "~2.6.1",
"jasmine-spec-reporter": "~4.1.0",
"karma": "~1.6.0",
"karma-chrome-launcher": "~2.1.0",
"karma-cli": "~1.0.1",
"karma-jasmine": "~1.1.0",
"karma-jasmine-html-reporter": "^0.2.2",
"karma-coverage-istanbul-reporter": "^1.2.1",
"protractor": "~5.1.0",
"ts-node": "~3.0.3",
"tslint": "~5.2.0",
"typescript": "~2.3.2"
}
}
运行npm install
返回:
npm WARN deprecated browserslist@2.11.3: Browserslist 2 could fail on reading Browserslist >3.0 config used in other tools.
npm WARN deprecated istanbul-lib-hook@1.2.1: 1.2.0 should have been a major version bump
npm WARN deprecated hoek@2.16.3: The major version is no longer supported. Please update to 4.x or newer
npm WARN registry Unexpected warning for https://registry.npmjs.org/: Miscellaneous Warning EINTEGRITY: sha1-LePXGIGbwgFldUxKWa+36YM/Zwc= integrity checksum failed when using sha1: wanted sha1-LePXGIGbwgFldUxKWa+36YM/Zwc= but got sha512-UBYHWph6P3tutkbXpW6XYg9ZPbTKjw/YC2hGG1/GEvWwTbvezBUv3h+mmUFw79T3RFPnmedpiXdOBbXX+4l0jg==. (51120 bytes)
npm WARN registry Using stale package data from https://registry.npmjs.org/ due to a request error during revalidation.
> node-sass@4.9.3 install /home/linux/Pjkts/clones/alwataneyaangularwebsite/node_modules/node-sass
> node scripts/install.js
Cached binary found at /home/linux/.npm/node-sass/4.9.3/linux-x64-57_binding.node
> uglifyjs-webpack-plugin@0.4.6 postinstall /home/linux/Pjkts/clones/alwataneyaangularwebsite/node_modules/webpack/node_modules/uglifyjs-webpack-plugin
> node lib/post_install.js
> node-sass@4.9.3 postinstall /home/linux/Pjkts/clones/alwataneyaangularwebsite/node_modules/node-sass
> node scripts/build.js
Binary found at /home/linux/Pjkts/clones/alwataneyaangularwebsite/node_modules/node-sass/vendor/linux-x64-57/binding.node
Testing binary
Binary is fine
npm notice created a lockfile as package-lock.json. You should commit this file.
npm WARN @angular/animations@4.3.5 requires a peer of @angular/core@4.3.5 but none is installed. You must install peer dependencies yourself.
npm WARN ngx-chips@1.9.4 requires a peer of @angular/animations@^6.0.0 but none is installed. You must install peer dependencies yourself.
npm WARN ngx-chips@1.9.4 requires a peer of @angular/common@^6.0.0 but none is installed. You must install peer dependencies yourself.
npm WARN ngx-chips@1.9.4 requires a peer of @angular/core@^6.0.0 but none is installed. You must install peer dependencies yourself.
npm WARN ngx-chips@1.9.4 requires a peer of @angular/forms@^6.0.0 but none is installed. You must install peer dependencies yourself.
npm WARN ngx-chips@1.9.4 requires a peer of rxjs@^6.1.0 but none is installed. You must install peer dependencies yourself.
npm WARN The package @angular/compiler-cli is included as both a dev and production dependency.
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.2.4 (node_modules/fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.2.4: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})
added 1177 packages in 50.639s
此后,我运行ng build
并得到:
ERROR in multi ./node_modules/ngx-toastr/toastr.css ./libs/css/theme.css ./libs/css/bootstrap.css ./libs/css/bootstrap-theme.css ./libs/css/jquery.smartmenus.bootstrap.css ./libs/css/owl.carousel.css ./libs/css/rangeslider.css ./libs/css/jquery.fancybox.min.css ./libs/css/animate.css ./libs/css/bootstrap-datetimepicker.min.css ./node_modules/ng-pick-datetime/assets/style/picker.min.css ./src/styles.css
Module not found: Error: Can't resolve '/home/linux/Pjkts/clones/alwataneyaangularwebsite/node_modules/ng-pick-datetime/assets/style/picker.min.css' in '/home/linux/Pjkts/clones/alwataneyaangularwebsite'
ERROR in ./src/app/add-auctionbatch/add-auctionbatch.component.ts
Module not found: Error: Can't resolve 'date-fns' in '/home/linux/Pjkts/clones/alwataneyaangularwebsite/src/app/add-auctionbatch'
ERROR in ./src/app/display-user/display-user.component.ts
Module not found: Error: Can't resolve 'date-fns' in '/home/linux/Pjkts/clones/alwataneyaangularwebsite/src/app/display-user'
ERROR in ./src/app/edit-user/edit-user.component.ts
Module not found: Error: Can't resolve 'date-fns' in '/home/linux/Pjkts/clones/alwataneyaangularwebsite/src/app/edit-user'
ERROR in ./src/app/app.module.ts
Module not found: Error: Can't resolve 'ng-pick-datetime' in '/home/linux/Pjkts/clones/alwataneyaangularwebsite/src/app'
ERROR in ./src/app/add-auctionbatch/add-auctionbatch.module.ts
Module not found: Error: Can't resolve 'ng-pick-datetime' in '/home/linux/Pjkts/clones/alwataneyaangularwebsite/src/app/add-auctionbatch'
ERROR in ./src/app/display-invoice/display-invoice.module.ts
Module not found: Error: Can't resolve 'ng-pick-datetime' in '/home/linux/Pjkts/clones/alwataneyaangularwebsite/src/app/display-invoice'
ERROR in ./src/app/display-user/display-user.module.ts
Module not found: Error: Can't resolve 'ng-pick-datetime' in '/home/linux/Pjkts/clones/alwataneyaangularwebsite/src/app/display-user'
ERROR in ./src/app/edit-user/edit-user.module.ts
Module not found: Error: Can't resolve 'ng-pick-datetime' in '/home/linux/Pjkts/clones/alwataneyaangularwebsite/src/app/edit-user'
ERROR in /home/linux/Pjkts/clones/alwataneyaangularwebsite/src/app/display-invoice/display-invoice.component.ts (8,24): Cannot find module 'date-fns'.
ERROR in /home/linux/Pjkts/clones/alwataneyaangularwebsite/src/app/add-auctionbatch/add-auctionbatch.module.ts (7,38): Cannot find module 'ng-pick-datetime'.
ERROR in /home/linux/Pjkts/clones/alwataneyaangularwebsite/src/app/add-auctionbatch/add-auctionbatch.component.ts (6,24): Cannot find module 'date-fns'.
ERROR in /home/linux/Pjkts/clones/alwataneyaangularwebsite/src/app/edit-user/edit-user.module.ts (9,38): Cannot find module 'ng-pick-datetime'.
ERROR in /home/linux/Pjkts/clones/alwataneyaangularwebsite/src/app/app.module.ts (49,38): Cannot find module 'ng-pick-datetime'.
ERROR in Error: Metadata version mismatch for module /home/linux/Pjkts/clones/alwataneyaangularwebsite/node_modules/ngx-chips/ngx-chips.d.ts, found version 4, expected 3, resolving symbol AppModule in /home/linux/Pjkts/clones/alwataneyaangularwebsite/src/app/app.module.ts, resolving symbol AppModule in /home/linux/Pjkts/clones/alwataneyaangularwebsite/src/app/app.module.ts
at syntaxError (/home/linux/Pjkts/clones/alwataneyaangularwebsite/node_modules/@angular/compiler/bundles/compiler.umd.js:1729:34)
at simplifyInContext (/home/linux/Pjkts/clones/alwataneyaangularwebsite/node_modules/@angular/compiler/bundles/compiler.umd.js:24979:23)
at StaticReflector.simplify (/home/linux/Pjkts/clones/alwataneyaangularwebsite/node_modules/@angular/compiler/bundles/compiler.umd.js:24991:13)
at StaticReflector.annotations (/home/linux/Pjkts/clones/alwataneyaangularwebsite/node_modules/@angular/compiler/bundles/compiler.umd.js:24418:41)
at _getNgModuleMetadata (/home/linux/Pjkts/clones/alwataneyaangularwebsite/node_modules/@angular/compiler-cli/src/ngtools_impl.js:138:31)
at _extractLazyRoutesFromStaticModule (/home/linux/Pjkts/clones/alwataneyaangularwebsite/node_modules/@angular/compiler-cli/src/ngtools_impl.js:109:26)
at Object.listLazyRoutesOfModule (/home/linux/Pjkts/clones/alwataneyaangularwebsite/node_modules/@angular/compiler-cli/src/ngtools_impl.js:53:22)
at Function.NgTools_InternalApi_NG_2.listLazyRoutes (/home/linux/Pjkts/clones/alwataneyaangularwebsite/node_modules/@angular/compiler-cli/src/ngtools_api.js:91:39)
at AotPlugin._getLazyRoutesFromNgtools (/home/linux/Pjkts/clones/alwataneyaangularwebsite/node_modules/@ngtools/webpack/src/plugin.js:240:66)
at _donePromise.Promise.resolve.then.then.then.then.then (/home/linux/Pjkts/clones/alwataneyaangularwebsite/node_modules/@ngtools/webpack/src/plugin.js:493:24)
at <anonymous>
at process._tickCallback (internal/process/next_tick.js:188:7)
at Function.Module.runMain (module.js:695:11)
at startup (bootstrap_node.js:191:16)
at bootstrap_node.js:612:3
ERROR in /home/linux/Pjkts/clones/alwataneyaangularwebsite/src/app/display-user/display-user.module.ts (9,38): Cannot find module 'ng-pick-datetime'.
ERROR in /home/linux/Pjkts/clones/alwataneyaangularwebsite/src/app/edit-user/edit-user.component.ts (8,24): Cannot find module 'date-fns'.
ERROR in /home/linux/Pjkts/clones/alwataneyaangularwebsite/src/app/display-invoice/display-invoice.module.ts (9,38): Cannot find module 'ng-pick-datetime'.
ERROR in /home/linux/Pjkts/clones/alwataneyaangularwebsite/src/app/display-user/display-user.component.ts (8,24): Cannot find module 'date-fns'.
答案 0 :(得分:0)
只需删除node_modules
目录和package-lock.json
。
然后运行:
npm i
它将安装所有依赖项。 确保备份package-lock.json文件。 安装后,将其放回原处。