Quantcast
Channel: Ionic Forum - Latest topics
Viewing all articles
Browse latest Browse all 70440

Self is not defined in ionic angular server side rendering

$
0
0

@YAsh0011 wrote:

I am following https://ionicframework.com/blog/ssr-with-angular-universal-and-ionic this tutorial everything setup is successfully done and also these command run sucessfully npm run build:ssr and npm run serve:ssr then they give me port for run website in browser Node Express server listening on http://localhost:4000 , but when open this port in chrome I got the error ERROR ReferenceError: self is not defined

ReferenceError: self is not defined
    at Object.607 (F:\ionic4-project\app\dist\2.js:44:9)
    at __webpack_require__ (F:\ionic4-project\app\dist\server.js:26:30)
    at __webpack_require__.t (F:\ionic4-project\app\dist\server.js:83:33)
    at ZoneDelegate.invoke (F:\ionic4-project\app\dist\server.js:585:26)
    at Object.onInvoke (F:\ionic4-project\app\dist\server.js:20315:33)
    at ZoneDelegate.invoke (F:\ionic4-project\app\dist\server.js:584:52)
    at Zone.run (F:\ionic4-project\app\dist\server.js:344:43)
    at F:\ionic4-project\app\dist\server.js:1083:34
    at ZoneDelegate.invokeTask (F:\ionic4-project\app\dist\server.js:617:31)
    at Object.onInvokeTask (F:\ionic4-project\app\dist\server.js:20306:33)

my project package.json

{
  "name": "app",
  "version": "1.0.1",
  "author": "hello",
  "homepage": "http://app.com/",
  "scripts": {
    "ng": "ng",
    "start": "ng serve",
    "build": "ng build",
    "test": "ng test",
    "lint": "ng lint",
    "e2e": "ng e2e",
    "serve": "ionic serve --no-livereload --lab",
    "pwa": "ng build --prod --base-href /demo/app-pwa/ --deploy-url /demo/app-pwa/",
    "compile:server": "webpack --config webpack.server.config.js --progress --colors",
    "serve:ssr": "node dist/server",
    "build:ssr": "npm run build:client-and-server-bundles && npm run compile:server",
    "build:client-and-server-bundles": "ng build --prod && ng run app:server:production"
  },
  "private": true,
  "dependencies": {
    "@angular/animations": "^7.2.15",
    "@angular/common": "^7.2.2",
    "@angular/core": "^7.2.2",
    "@angular/fire": "^5.2.1",
    "@angular/forms": "^7.2.2",
    "@angular/http": "^7.2.2",
    "@angular/platform-browser": "^7.2.2",
    "@angular/platform-browser-dynamic": "^7.2.2",
    "@angular/platform-server": "^7.2.2",
    "@angular/pwa": "^0.900.7",
    "@angular/router": "^7.2.2",
    "@angular/service-worker": "^8.2.14",
    "@ionic-native/admob-free": "^5.12.0",
    "@ionic-native/core": "^5.0.0",
    "@ionic-native/file": "^5.12.0",
    "@ionic-native/file-transfer": "^5.8.0",
    "@ionic-native/firebase-dynamic-links": "^5.14.0",
    "@ionic-native/firebase-messaging": "^5.13.0",
    "@ionic-native/ionic-webview": "^5.12.0",
    "@ionic-native/media": "^5.9.0",
    "@ionic-native/music-controls": "^5.12.0",
    "@ionic-native/native-audio": "^5.8.0",
    "@ionic-native/social-sharing": "^5.12.0",
    "@ionic-native/splash-screen": "^5.0.0",
    "@ionic-native/status-bar": "^5.0.0",
    "@ionic/angular": "^4.1.0",
    "@ionic/angular-server": "^5.0.7",
    "@ionic/storage": "^2.2.0",
    "@nguniversal/express-engine": "^7.1.1",
    "@nguniversal/module-map-ngfactory-loader": "0.0.0",
    "@ngx-translate/core": "^11.0.1",
    "@ngx-translate/http-loader": "^4.0.0",
    "cordova": "^9.0.0",
    "cordova-admob-sdk": "^0.24.1",
    "cordova-android": "8.1.0",
    "cordova-ios": "^5.0.1",
    "cordova-plugin-admob-free": "0.27.0",
    "cordova-plugin-androidx": "1.0.2",
    "cordova-plugin-androidx-adapter": "1.1.0",
    "cordova-plugin-device": "2.0.2",
    "cordova-plugin-file": "^6.0.2",
    "cordova-plugin-file-transfer": "^1.7.1",
    "cordova-plugin-firebase-dynamiclinks": "3.0.0",
    "cordova-plugin-firebase-messaging": "^3.0.0",
    "cordova-plugin-ionic-keyboard": "^2.2.0",
    "cordova-plugin-media": "^5.0.3",
    "cordova-plugin-music-controls": "git+https://github.com/amitkhare/cordova-music-controls-plugin.git",
    "cordova-plugin-nativeaudio": "^3.0.9",
    "cordova-plugin-splashscreen": "5.0.2",
    "cordova-plugin-statusbar": "2.4.2",
    "cordova-plugin-whitelist": "1.3.3",
    "cordova-plugin-x-socialsharing": "5.4.7",
    "cordova-promise-polyfill": "0.0.2",
    "cordova-sqlite-storage": "^3.2.1",
    "cordova-support-android-plugin": "^1.0.1",
    "cordova-support-google-services": "^1.3.1",
    "core-js": "^2.5.4",
    "es6-promise-plugin": "4.2.2",
    "express": "^4.15.2",
    "firebase": "^6.3.1",
    "moment": "^2.24.0",
    "phonegap-plugin-push": "2.2.3",
    "rxjs": "~6.5.1",
    "tslib": "^1.9.0",
    "typescript": "^3.2.4",
    "zone.js": "~0.8.29"
  },
  "devDependencies": {
    "@angular-devkit/architect": "~0.13.8",
    "@angular-devkit/build-angular": "~0.13.8",
    "@angular-devkit/core": "~7.3.8",
    "@angular-devkit/schematics": "~7.3.8",
    "@angular/cli": "~7.3.8",
    "@angular/compiler": "~7.2.2",
    "@angular/compiler-cli": "~7.2.2",
    "@angular/language-service": "~7.2.2",
    "@ionic/angular-toolkit": "~1.5.1",
    "@ionic/lab": "2.0.6",
    "@types/jasmine": "~2.8.8",
    "@types/jasminewd2": "~2.0.3",
    "@types/node": "~12.0.0",
    "codelyzer": "~4.5.0",
    "cordova-plugin-device": "^2.0.2",
    "cordova-plugin-ionic-keyboard": "^2.2.0",
    "cordova-plugin-ionic-webview": "^4.1.1",
    "cordova-plugin-splashscreen": "^5.0.2",
    "cordova-plugin-statusbar": "^2.4.2",
    "cordova-plugin-whitelist": "^1.3.3",
    "jasmine-core": "~2.99.1",
    "jasmine-spec-reporter": "~4.2.1",
    "karma": "~4.1.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-loader": "^5.2.0",
    "ts-node": "~8.1.0",
    "tslint": "~5.17.0",
    "webpack-cli": "^3.1.0"
  },
  "description": "An Ionic project",
  "cordova": {
    "plugins": {
      "cordova-plugin-whitelist": {},
      "cordova-plugin-statusbar": {},
      "cordova-plugin-device": {},
      "cordova-plugin-splashscreen": {},
      "cordova-plugin-file": {},
      "cordova-plugin-media": {
        "KEEP_AVAUDIOSESSION_ALWAYS_ACTIVE": "NO"
      },
      "cordova-plugin-music-controls": {},
      "cordova-sqlite-storage": {},
      "cordova-plugin-file-transfer": {},
      "cordova-plugin-x-socialsharing": {
        "ANDROID_SUPPORT_V4_VERSION": "24.1.1+",
        "PHOTO_LIBRARY_ADD_USAGE_DESCRIPTION": "This app requires photo library access to function properly.",
        "PHOTO_LIBRARY_USAGE_DESCRIPTION": "This app requires photo library access to function properly."
      },
      "cordova-plugin-androidx": {},
      "cordova-plugin-androidx-adapter": {},
      "cordova-plugin-admob-free": {
        "ADMOB_APP_ID": "ca-app-pub-~xxx"
      },
      "cordova-plugin-ionic-keyboard": {},
      "cordova-plugin-ionic-webview": {
        "ANDROID_SUPPORT_ANNOTATIONS_VERSION": "27.0.1"
      },
      "cordova-admob-sdk": {
        "PLAY_SERVICES_VERSION": "+"
      },
      "cordova-plugin-firebase-messaging": {},
      "cordova-plugin-firebase-dynamiclinks": {
        "APP_DOMAIN": "app.com",
        "PAGE_LINK_DOMAIN": "app.page.link",
        "FIREBASE_CORE_VERSION": "17.0.+",
        "FIREBASE_DYNAMIC_LINKS_VERSION": "18.0.+"
      }
    },
    "platforms": [
      "ios",
      "android"
    ]
  }
}

Ionic Info

Ionic:

   Ionic CLI                     : 5.2.7 (C:\Users\xxx\AppData\Roaming\nvm\v10.16.3\node_modules\ionic)
   Ionic Framework               : @ionic/angular 4.11.10
   @angular-devkit/build-angular : 0.13.9
   @angular-devkit/schematics    : 7.3.9
   @angular/cli                  : 7.3.9
   @ionic/angular-toolkit        : 1.5.1

Cordova:

   Cordova CLI       : 9.0.0 (cordova-lib@9.0.1)
   Cordova Platforms : not available
   Cordova Plugins   : not available

Utility:

   cordova-res : 0.6.0
   native-run  : 0.3.0

System:

   Android SDK Tools : 26.1.1 (C:\Users\xxx\AppData\Local\Android\sdk)
   NodeJS            : v10.16.3 (C:\Program Files\nodejs\node.exe)
   npm               : 6.9.0
   OS                : Windows 10

Please help

Posts: 1

Participants: 1

Read full topic


Viewing all articles
Browse latest Browse all 70440

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>