Ric*_*ard 9 npm docker angular
我有一个 Angular 9(* 更新,这应该是 Angular 11),它是在 Ubuntu 和 Mac 机器上开发的。以下命令运行没有问题:
npm install
Run Code Online (Sandbox Code Playgroud)
所以现在我需要将其部署到Linux Centos 7服务器上。所以我对它进行了 Docker 化。当 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
Run Code Online (Sandbox Code Playgroud)
有想法吗?
附加信息:
我尝试查看建议的日志:
/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
Run Code Online (Sandbox Code Playgroud)
包.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"
}
}
Run Code Online (Sandbox Code Playgroud)
小智 3
您说您的应用程序是用 ng 9 编写的,但有一些错误行,例如npm ERR! Found: @angular/common@11.0.9ngangular-datatables@"^10.0.0"版本为 11。这可能是问题,因为 Angular-Datatables 版本 10.0.0 和 Angular 11 之间存在依赖关系。修复该问题并它会工作得很好