ошибка: «Без сервера: офлайн не найден». при попытке запустить Angular 9 Universal с отключенным сервером - PullRequest
1 голос
/ 27 февраля 2020

My Angular 9 Универсальное приложение работает локально . Но я не могу запустить его с отключенным сервером. Я получаю эту ошибку:

{
currentRoute: "get - /",
error: "Serverless-offline: route not found.",
existingRoutes: [
"* - /production",
"* - /production/{proxy*}"
],
statusCode: 404
}

Вот мой serverless.yml код, сгенерированный @ ng-toolkit / serverless:

# generated by @ng-toolkit/serverless
service: brmed

plugins:
  - serverless-apigw-binary
  - serverless-offline

provider:
  name: aws
  runtime: nodejs12.x
  memorySize: 192
  timeout: 30
  stage: production
  region: us-east-2

package:
  exclude:
   - src/**
   - node_modules/**
   - firebug-lite/**
   - e2e/**
   - coverage/**
   - '!node_modules/aws-serverless-express/**'
   - '!node_modules/binary-case/**'
   - '!node_modules/type-is/**'
   - '!node_modules/media-typer/**'
   - '!node_modules/mime-types/**'
   - '!node_modules/mime-db/**'

custom:
  apigwBinary:
    types:
      - '*/*'
  serverless-offline:
    httpPort: 8181

functions:
  api:
    handler: lambda.universal
    events:
      - http: ANY {proxy+}
      - http: ANY /

Вот мой package. json file:

{
  "name": "brmed",
  "version": "0.0.0",
  "scripts": {
    "ng": "ng",
    "start": "ng serve",
    "build": "ng build --prod --build-optimizer --output-path=\"dist/BRMed/browser",
    "test": "ng test",
    "lint": "ng lint",
    "e2e": "ng e2e",
    "dev:ssr": "ng run BRMed:serve-ssr",
    "serve:ssr": "serverless offline start",
    "build:ssr": "ng build --prod && ng run BRMed:server:production",
    "prerender": "ng run BRMed:prerender",
    "build:browser:prod": "ng build --prod",
    "build:browser:serverless": "ng build --prod --base-href /production/",
    "build:serverless": "npm run build:browser:serverless && npm run build:server:serverless",
    "build:prod": "npm run build:browser:prod && npm run build:server:prod",
    "build:prod:deploy": "npm run build:prod && npm run deploy",
    "build:serverless:deploy": "npm run build:serverless && npm run deploy",
    "deploy": "serverless deploy",
    "terminate": "serverless remove",
    "server": "node local.js",
    "build:server:prod": "ng run BRMed:server && webpack --config webpack.server.config.js --progress --colors",
    "build:server:serverless": "ng run BRMed:server:serverless && webpack --config webpack.server.config.js --progress --colors"
  },
  "private": true,
  "dependencies": {
    "@agm/core": "^1.0.0-beta.7",
    "@angular/animations": "^9.0.2",
    "@angular/cdk": "^9.0.1",
    "@angular/common": "^9.0.2",
    "@angular/compiler": "^9.0.2",
    "@angular/forms": "^9.0.2",
    "@angular/localize": "^9.0.2",
    "@angular/material": "^9.0.1",
    "@angular/platform-browser": "^9.0.2",
    "@angular/platform-browser-dynamic": "^9.0.2",
    "@angular/router": "^9.0.2",
    "@fortawesome/angular-fontawesome": "^0.6.0",
    "@fortawesome/fontawesome-svg-core": "^1.2.27",
    "@fortawesome/free-brands-svg-icons": "^5.12.1",
    "@fortawesome/free-regular-svg-icons": "^5.12.1",
    "@fortawesome/free-solid-svg-icons": "^5.12.1",
    "@ng-bootstrap/ng-bootstrap": "^4.1.0",
    "@ng-toolkit/serverless": "^8.0.3",
    "@nguniversal/express-engine": "^9.0.1",
    "@nguniversal/module-map-ngfactory-loader": "^8.2.6",
    "@sentry/browser": "^5.12.4",
    "@types/googlemaps": "^3.39.3",
    "angular-gauge-chart": "^0.7.2",
    "angular-google-charts": "^0.1.6",
    "angular2-text-mask": "^9.0.0",
    "aws-serverless-express": "^3.2.0",
    "bootstrap": "^4.3.1",
    "core-js": "^2.5.4",
    "cors": "~2.8.4",
    "cp-cli": "^1.1.0",
    "express": "^4.15.2",
    "hammerjs": "^2.0.8",
    "intersection-observer": "^0.7.0",
    "jquery": "^1.9.1",
    "ng-intercom": "^8.0.2",
    "ng-lazyload-image": "^6.1.0",
    "ngx-device-detector": "^1.3.11",
    "node-sass": "^4.13.0",
    "popper.js": "^1.14.7",
    "postcss": "^7.0.27",
    "rxjs": "~6.5.4",
    "serverless": "^1.64.1",
    "serverless-http": "^2.3.2",
    "tslib": "^1.11.0",
    "webpack": "^4.41.6",
    "webpack-cli": "^3.3.11",
    "ws": "^7.1.1",
    "zone.js": "~0.9.1"
  },
  "devDependencies": {
    "@angular-devkit/build-angular": "^0.900.3",
    "@angular/cli": "^9.0.3",
    "@angular/compiler-cli": "^9.0.2",
    "@angular/core": "^9.0.2",
    "@angular/language-service": "^9.0.2",
    "@angular/platform-server": "^9.0.0",
    "@nguniversal/builders": "^9.0.1",
    "@types/express": "^4.17.0",
    "@types/jasmine": "~2.8.8",
    "@types/jasminewd2": "~2.0.3",
    "@types/node": "^8.9.5",
    "@types/stripe-v3": "^3.1.3",
    "codelyzer": "~4.5.0",
    "jasmine-core": "~2.99.1",
    "jasmine-spec-reporter": "~4.2.1",
    "karma": "~4.0.0",
    "karma-chrome-launcher": "~2.2.0",
    "karma-coverage-istanbul-reporter": "~2.0.1",
    "karma-jasmine": "~1.1.2",
    "karma-jasmine-html-reporter": "^0.2.2",
    "opencollective": "^1.0.3",
    "protractor": "~5.4.0",
    "serverless-apigw-binary": "^0.4.4",
    "serverless-offline": "^6.0.0-alpha.67",
    "ts-loader": "4.2.0",
    "ts-node": "~7.0.0",
    "tslint": "~5.11.0",
    "typescript": "^3.7.5"
  }
}

Я много исследовал в Интернете, чтобы найти решение этой проблемы, но безуспешно. Возможно стандартные процедуры, которые работали с Angular 8, не работают с Angular 9.

Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...