首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >在WSL2 ubuntu 20.04上运行时,运行在坞内的角应用程序可以工作,而在Ubuntu18.04.2上运行时,无法找到模块@角/编译器-cli。

在WSL2 ubuntu 20.04上运行时,运行在坞内的角应用程序可以工作,而在Ubuntu18.04.2上运行时,无法找到模块@角/编译器-cli。
EN

Stack Overflow用户
提问于 2021-09-15 11:00:56
回答 1查看 319关注 0票数 0

10+几个小时以来,我一直在讨论这个问题。我用码头在不同的机器上有相同的行为,但在这里我不能使它工作。

我已经在我的WSL2 ubuntu20.04.2上创建了一个坞-组合开发堆栈,为了启动一个角/瓶/mysql应用程序,它工作得很好。

为了在这台机器上进行开发,我想在远程服务器上运行这个堆栈,这是一种测试/开发服务器,Ubuntu18.04.2。不同的操作系统应该不重要,因为我管理码头内部的一切。

但是,当我在Ubuntu18.04.2上运行“sudo组合”时,与我的角容器相关的错误如下:

代码语言:javascript
复制
angular-front | An unhandled exception occurred: Cannot find module '@angular/compiler-cli'
angular-front | Require stack:
angular-front | - /app/node_modules/@ngtools/webpack/src/angular_compiler_plugin.js
angular-front | - /app/node_modules/@ngtools/webpack/src/index.js
angular-front | - /app/node_modules/@angular-devkit/build-angular/src/angular-cli-files/models/webpack-configs/typescript.js
angular-front | - /app/node_modules/@angular-devkit/build-angular/src/angular-cli-files/models/webpack-configs/index.js
angular-front | - /app/node_modules/@angular-devkit/build-angular/src/browser/index.js
angular-front | - /app/node_modules/@angular-devkit/build-angular/src/dev-server/index.js
angular-front | - /app/node_modules/@angular-devkit/architect/node/node-modules-architect-host.js
angular-front | - /app/node_modules/@angular-devkit/architect/node/index.js
angular-front | - /app/node_modules/@angular/cli/models/architect-command.js
angular-front | - /app/node_modules/@angular/cli/commands/serve-impl.js
angular-front | - /app/node_modules/@angular-devkit/schematics/tools/export-ref.js
angular-front | - /app/node_modules/@angular-devkit/schematics/tools/index.js
angular-front | - /app/node_modules/@angular/cli/utilities/json-schema.js
angular-front | - /app/node_modules/@angular/cli/models/command-runner.js
angular-front | - /app/node_modules/@angular/cli/lib/cli/index.js
angular-front | - /app/node_modules/@angular/cli/lib/init.js
angular-front | - /app/node_modules/@angular/cli/bin/ng
angular-front | See "/tmp/ng-EEaQZX/angular-errors.log" for further details.
angular-front | npm ERR! code ELIFECYCLE
angular-front | npm ERR! syscall spawn
angular-front | npm ERR! file sh
angular-front | npm ERR! errno ENOENT
angular-front | npm ERR! Scrapy@6.2.0 start: `ng serve`
angular-front | npm ERR! spawn ENOENT
angular-front | npm ERR!
angular-front | npm ERR! Failed at the Scrapy@6.2.0 start script.
angular-front | npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
angular-front |
angular-front | npm ERR! A complete log of this run can be found in:
angular-front | npm ERR!     /root/.npm/_logs/2021-09-15T10_27_31_226Z-debug.log

这是我的docker-compose.yml,我们可能需要关注的是“角”服务:

代码语言:javascript
复制
# Use root/example as user/password credentials
version: '3.1'

services:

  db:
    image: mariadb
    restart: always
    environment:
      MYSQL_ROOT_PASSWORD: !!!
      MYSQL_DATABASE: !!!!!!!!!
      MYSQL_USER: !!!!!!!
      MYSQL_PASSWORD: !!!!!!
    container_name: database_db
    ports:
    - "3307:3306"
  python:
    container_name: python-back
    build:
      context: ./myappback
    command: nodemon -L -e js,py --exec python3 -m flask run --host=0.0.0.0
    ports:
     - "5000:5000"
    working_dir: /app
    volumes:
      - ./myappback:/app
  angular:
    container_name: angular-front
    build:
      context: ./myappfront
      dockerfile: dockerfile_dev
    ports:
     - "4200:4200"
    working_dir: /app
    volumes:
     - ./myappfront:/app
     - /app/node_modules

下面是用于构建角应用程序的dockerfile_dev:

代码语言:javascript
复制
FROM node:12.14.1

WORKDIR /app
RUN mkdir node_modules
COPY package.json ./

RUN ls
RUN ls /app
RUN npm install -g --unsafe-perm @angular/cli@8.3.29  nodemon 
RUN ng --version
RUN npm install 

EXPOSE 4200 49153

RUN ng --version
CMD ["npm","start"]

我试着用"ng -- version“来调试包版本,这两台服务器上的一切都是相似的:

代码语言:javascript
复制
     _                      _                 ____ _     ___
    / \   _ __   __ _ _   _| | __ _ _ __     / ___| |   |_ _|
   / △ \ | '_ \ / _` | | | | |/ _` | '__|   | |   | |    | |
  / ___ \| | | | (_| | |_| | | (_| | |      | |___| |___ | |
 /_/   \_\_| |_|\__, |\__,_|_|\__,_|_|       \____|_____|___|
                |___/


Angular CLI: 8.3.29
Node: 12.14.1
OS: linux x64
Angular: 8.2.14
... animations, common, compiler, compiler-cli, core, forms
... language-service, platform-browser, platform-browser-dynamic
... router, service-worker

Package                           Version
-----------------------------------------------------------
@angular-devkit/architect         0.803.29
@angular-devkit/build-angular     0.803.29
@angular-devkit/build-optimizer   0.803.29
@angular-devkit/build-webpack     0.803.29
@angular-devkit/core              8.3.29
@angular-devkit/schematics        8.3.29
@angular/cdk                      8.2.3
@angular/cli                      8.3.29
@angular/flex-layout              8.0.0-beta.27
@angular/material                 8.2.3
@angular/pwa                      0.803.29
@ngtools/webpack                  8.3.29
@schematics/angular               8.3.29
@schematics/update                0.803.29
rxjs                              6.5.5
typescript                        3.5.3
webpack                           4.39.2

我使用角8,因为我还没有迁移到最新版本。

这里也是我的package.json:

代码语言:javascript
复制
{
  "name": "Scrapy",
  "version": "6.2.0",
  "scripts": {
    "ng": "ng",
    "start": "ng serve",
    "build": "ng build --prod",
    "build_test": "ng build --configuration=test",
    "test": "ng test",
    "lint": "ng lint",
    "e2e": "ng e2e"
  },
  "private": true,
  "dependencies": {
    "@agm/core": "1.0.0",
    "@amcharts/amcharts4": "^4.10.18",
    "@angular-devkit/build-angular": "0.803.29",
    "@angular/animations": "8.2.14",
    "@angular/cdk": "8.2.3",
    "@angular/common": "8.2.14",
    "@angular/compiler": "8.2.14",
    "@angular/core": "8.2.14",
    "@angular/flex-layout": "^8.0.0-beta.27",
    "@angular/forms": "8.2.14",
    "@angular/material": "^8.2.3",
    "@angular/platform-browser": "8.2.14",
    "@angular/platform-browser-dynamic": "8.2.14",
    "@angular/pwa": "0.803.29",
    "@angular/router": "8.2.14",
    "@angular/service-worker": "8.2.14",
    "@ngx-translate/core": "^11.0.1",
    "@ngx-translate/http-loader": "^4.0.0",
    "@nicky-lenaers/ngx-scroll-to": "^3.0.1",
    "angular-calendar": "~0.28.0",
    "angular-sortablejs": "^2.7.0",
    "chart.js": "~2.9.3",
    "chart.piecelabel.js": "~0.15.0",
    "chartjs": "^0.3.24",
    "chartjs-plugin-annotation": "^0.5.7",
    "hammerjs": "^2.0.8",
    "highlight.js": "^11.2.0",
    "lodash": "^4.17.21",
    "lodash-es": "~4.17.15",
    "material-design-icons": "^3.0.1",
    "moment": "~2.24.0",
    "ngx-file-drop": "^8.0.8",
    "ngx-quill": "~7.3.9",
    "node-sass": "^4.14.1",
    "normalize.css": "~8.0.1",
    "quill": "~1.3.7",
    "rxjs": "~6.5.3",
    "rxjs-compat": "~6.5.3",
    "screenfull": "~5.0.0",
    "simplebar": "5.0.7",
    "smoothscroll-polyfill": "^0.4.4",
    "sortablejs": "~1.10.1",
    "stream": "0.0.2",
    "vis-data": "^6.5.3",
    "vis-network": "^7.6.10",
    "vis-util": "^4.1.0",
    "zone.js": "~0.10.2"
  },
  "devDependencies": {
    "@angular/cli": "8.3.29",
    "@angular/compiler-cli": "8.2.14",
    "@angular/language-service": "8.2.14",
    "@types/chart.js": "~2.9.1",
    "@types/jasmine": "~3.4.6",
    "@types/jasminewd2": "~2.0.8",
    "@types/lodash-es": "~4.17.3",
    "@types/node": "~12.12.9",
    "codelyzer": "~5.2.0",
    "jasmine-core": "~3.5.0",
    "jasmine-spec-reporter": "~4.2.1",
    "karma": "~4.4.1",
    "karma-chrome-launcher": "~3.1.0",
    "karma-coverage-istanbul-reporter": "~2.1.0",
    "karma-jasmine": "~2.0.1",
    "karma-jasmine-html-reporter": "^1.4.2",
    "protractor": "~5.4.2",
    "ts-node": "~8.5.2",
    "tslint": "~5.20.1",
    "typescript": "3.5.3"
  }
}

也许这是角/cli版本和角/编译器-cli之间的问题?

任何专家都能帮我调试这个吗?我试过几件事

在dockerfile

  • "npm中运行"npm安装-g“和"npm安装”的
  • 在dockerfile_dev
  • check中的
  • 中运行“npm安装-g”和“npm安装”,每次运行10次,重新生成角

的图像。

EN

回答 1

Stack Overflow用户

发布于 2021-09-15 11:08:30

这条线

代码语言:javascript
复制
angular-front | npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

是暗示这不是国家预防机制的问题,而是其他的问题

我遇到了这样的情况,经过大量搜索,我发现原因是服务器内存不足(内存只有4GB)。最后,我增加了更多的交换区域来解决这个问题。

最近,我在AWS (ECR ->elastic容器注册中心)上找到了另一个解决方案:您是如何构建容器并将码头容器推送到AWS的?

希望这能对你有所帮助。

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/69191853

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档