Prisco
Prisco

Reputation: 733

Error: angular application starting problem

I have a problem during my angular application boot phase:

In my docker based on node:11.10.1 version during the starting phase with the following package.json file, the application fails to start:

{
  "name": "myapplication",
  "version": "0.0.0",
  "scripts": {
    "ng": "ng",
    "start": "export NODE_ENV=dev && ng serve --port 3000 --proxy-config server.js ",
    "build": "ng build",
    "test": "ng test",
    "lint": "ng lint",
    "e2e": "ng e2e"
  },
  "private": true,
  "dependencies": {
    "@angular/animations": "~7.2.0",
    "@angular/common": "~7.2.0",
    "@angular/compiler": "~7.2.0",
    "@angular/core": "~7.2.0",
    "@angular/forms": "~7.2.0",
    "@angular/http": "^7.2.15",
    "@angular/platform-browser": "~7.2.0",
    "@angular/platform-browser-dynamic": "~7.2.0",
    "@angular/router": "~7.2.0",
    "@eds/vanilla": "^3.2.0",
    "body-parser": "^1.19.0",
    "core-js": "^2.5.4",
    "cors": "^2.8.5",
    "d3": "^5.12.0",
    "dragula": "^3.7.2",
    "express": "^4.17.1",
    "mapbox-gl": "^1.4.1",
    "microsoft-adal-angular6": "^1.3.0",
    "mongoose": "^5.7.5",
    "ng2-completer": "^3.0.2",
    "ng2-datepicker": "^3.1.1",
    "ng2-smart-table": "^1.5.0",
    "ngx-permissions": "^7.0.3",
    "nodemailer": "^6.3.1",
    "rxjs": "~6.3.3",
    "tslib": "^1.9.0",
    "zone.js": "~0.8.26"
  },
  "devDependencies": {
    "@angular-devkit/build-angular": "~0.13.0",
    "@angular/cli": "~7.3.9",
    "@angular/compiler-cli": "~7.2.0",
    "@angular/language-service": "~7.2.0",
    "@types/jasmine": "~2.8.8",
    "@types/jasminewd2": "^2.0.8",
    "@types/node": "~8.9.4",
    "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",
    "protractor": "~5.4.0",
    "ts-node": "~7.0.0",
    "tslint": "~5.11.0",
    "typescript": "~3.2.2"
  }
}

Here the error:

root@0eb895345c14:/usr/src/app# npm start

> [email protected] start /usr/src/app
> export NODE_ENV=dev && ng serve --port 3000 --proxy-config server.js 

Object prototype may only be an Object or null: undefined
TypeError: Object prototype may only be an Object or null: undefined
    at setPrototypeOf (<anonymous>)
    at Object.__extends (/usr/src/app/node_modules/tslib/tslib.js:65:9)
    at /usr/src/app/node_modules/@angular/compiler-cli/src/ngtsc/indexer/src/template.js:115:17
    at /usr/src/app/node_modules/@angular/compiler-cli/src/ngtsc/indexer/src/template.js:314:6
    at /usr/src/app/node_modules/@angular/compiler-cli/src/ngtsc/indexer/src/template.js:3:17
    at Object.<anonymous> (/usr/src/app/node_modules/@angular/compiler-cli/src/ngtsc/indexer/src/template.js:9:3)
    at Module._compile (internal/modules/cjs/loader.js:738:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:749:10)
    at Module.load (internal/modules/cjs/loader.js:630:32)
    at tryModuleLoad (internal/modules/cjs/loader.js:570:12)
    at Function.Module._load (internal/modules/cjs/loader.js:562:3)
    at Module.require (internal/modules/cjs/loader.js:667:17)
    at require (internal/modules/cjs/helpers.js:20:18)
    at /usr/src/app/node_modules/@angular/compiler-cli/src/ngtsc/indexer/src/transform.js:20:22
    at /usr/src/app/node_modules/@angular/compiler-cli/src/ngtsc/indexer/src/transform.js:10:17
    at Object.<anonymous> (/usr/src/app/node_modules/@angular/compiler-cli/src/ngtsc/indexer/src/transform.js:16:3)
    at Module._compile (internal/modules/cjs/loader.js:738:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:749:10)
    at Module.load (internal/modules/cjs/loader.js:630:32)
    at tryModuleLoad (internal/modules/cjs/loader.js:570:12)
    at Function.Module._load (internal/modules/cjs/loader.js:562:3)
    at Module.require (internal/modules/cjs/loader.js:667:17)
    at require (internal/modules/cjs/helpers.js:20:18)
    at /usr/src/app/node_modules/@angular/compiler-cli/src/ngtsc/program.js:31:23
    at /usr/src/app/node_modules/@angular/compiler-cli/src/ngtsc/program.js:10:17
    at Object.<anonymous> (/usr/src/app/node_modules/@angular/compiler-cli/src/ngtsc/program.js:16:3)
    at Module._compile (internal/modules/cjs/loader.js:738:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:749:10)

What is the right sequence to start the application? In my Dockerfile I put the following steps:

RUN npm install 
RUN npm audit fix --force
RUN npm start

Thanks for helping.

Upvotes: 0

Views: 528

Answers (1)

Jordi Cuevas
Jordi Cuevas

Reputation: 56

Hi just do an update of your packages with the following:

ng update @angular/cli @angular/core

Upvotes: 1

Related Questions