我有一个Angular 9 (* UPDATE,这意味着Angular 11),它是在Ubuntu和Mac机器上开发的。下面的命令可以正常工作:
npm install
所以现在我需要将它部署到Linux Centos 7服务器。所以我把它码头化了。当Dockerfile想要执行npm install
时,它会得到以下错误:
Step 4/13 : RUN npm install
---> Running in 42f10bf7732c
npm notice
npm notice New patch version of npm available! 7.4.0 -> 7.4.3
npm notice Changelog: <https://github.com/npm/cli/releases/tag/v7.4.3>
npm notice Run `npm install -g npm@7.4.3` to update!
npm notice
npm ERR! code ERESOLVE
npm ERR! ERESOLVE unable to resolve dependency tree
npm ERR!
npm ERR! While resolving: nexct-ng-ui@0.0.0
npm ERR! Found: @angular/common@11.0.9
npm ERR! node_modules/@angular/common
npm ERR! @angular/common@"~11.0.0" from the root project
npm ERR!
npm ERR! Could not resolve dependency:
npm ERR! peer @angular/common@"^10.2.2" from angular-datatables@10.1.0
npm ERR! node_modules/angular-datatables
npm ERR! angular-datatables@"^10.0.0" from the root project
npm ERR!
npm ERR! Fix the upstream dependency conflict, or retry
npm ERR! this command with --force, or --legacy-peer-deps
npm ERR! to accept an incorrect (and potentially broken) dependency resolution.
npm ERR!
npm ERR! See /root/.npm/eresolve-report.txt for a full report.
npm ERR! A complete log of this run can be found in:
npm ERR! /root/.npm/_logs/2021-01-27T12_02_45_235Z-debug.log
Ay想法?
额外的信息:
我试着查看建议的日志:
/root/.npm/eresolve-report.txt: No such file or directory
/root/.npm/_logs/2021-01-27T12_02_45_235Z-debug.log: No such file or directory
package.json
{
"name": "nexct-ng-ui",
"version": "0.0.0",
"scripts": {
"ng": "ng",
"start": "ng serve",
"build": "ng build",
"test": "ng test",
"lint": "ng lint",
"e2e": "ng e2e"
},
"private": true,
"dependencies": {
"@angular/animations": "~11.0.0",
"@angular/common": "~11.0.0",
"@angular/compiler": "~11.0.0",
"@angular/core": "~11.0.0",
"@angular/forms": "~11.0.0",
"@angular/platform-browser": "~11.0.0",
"@angular/platform-browser-dynamic": "~11.0.0",
"@angular/router": "~11.0.0",
"@fortawesome/fontawesome-free": "^5.15.1",
"angular-datatables": "^10.0.0",
"bootstrap": "^4.5.3",
"datatables.net": "^1.10.22",
"datatables.net-dt": "^1.10.22",
"jquery": "^3.5.1",
"ng-recaptcha": "^6.0.2",
"popper.js": "^1.16.1",
"rxjs": "~6.6.0",
"tslib": "^2.0.0",
"zone.js": "~0.10.2"
},
"devDependencies": {
"@angular-devkit/build-angular": "~0.1100.1",
"@angular/cli": "~11.0.1",
"@angular/compiler-cli": "~11.0.0",
"@types/datatables.net": "^1.10.19",
"@types/jasmine": "~3.6.0",
"@types/jquery": "^3.5.4",
"@types/node": "^12.11.1",
"codelyzer": "^6.0.0",
"jasmine-core": "~3.6.0",
"jasmine-spec-reporter": "~5.0.0",
"karma": "~5.1.0",
"karma-chrome-launcher": "~3.1.0",
"karma-coverage": "~2.0.3",
"karma-jasmine": "~4.0.0",
"karma-jasmine-html-reporter": "^1.5.0",
"protractor": "~7.0.0",
"ts-node": "~8.3.0",
"tslint": "~6.1.0",
"typescript": "~4.0.2"
}
}
您说您的应用程序是用ng 9编写的,但有一些行错误,如npm ERR! Found: @angular/common@11.0.9
和angular-datatables@"^10.0.0"
,其中ng版本为11。这可能是问题所在,因为angular-datatable 10.0.0版本和angular 11之间存在依赖关系。修复这个问题,它就可以正常工作了