在Netlify上部署Angular网站时的空白页

时间:2019-07-10 15:19:11

标签: javascript angular frameworks netlify

我正在尝试使用Angular 7部署项目网站,但它显示的是空白页面。它在本地主机上运行良好。我浪费了一整天试图解决它,但没有成功。关于可能是什么问题的任何想法?提前致谢。这是网站的网址:https://m.alabamarket.com

请在部署日志下方找到

3:57:30 PM: Build ready to start
3:57:33 PM: build-image version: 9e0f207a27642d0115b1ca97cd5e8cebbe492f63
3:57:33 PM: build-image tag: v3.3.2
3:57:33 PM: buildbot version: ef8d0929ed0baabafd8bbb7d0b021e1fc24180c0
3:57:33 PM: Fetching cached dependencies
3:57:33 PM: Starting to download cache of 176.4MB
3:57:35 PM: Finished downloading cache in 1.122552229s
3:57:35 PM: Starting to extract cache
3:57:40 PM: Finished extracting cache in 5.336044214s
3:57:40 PM: Finished fetching cache in 6.509703968s
3:57:40 PM: Starting to prepare the repo for build
3:57:40 PM: Preparing Git Reference refs/heads/RFQ
3:57:42 PM: Starting build script
3:57:42 PM: Installing dependencies
3:57:42 PM: Started restoring cached node version
3:57:44 PM: Finished restoring cached node version
3:57:45 PM: v10.16.0 is already installed.
3:57:46 PM: Now using node v10.16.0 (npm v6.9.0)
3:57:46 PM: Attempting ruby version 2.6.2, read from environment
3:57:47 PM: Using ruby version 2.6.2
3:57:47 PM: Using PHP version 5.6
3:57:47 PM: Started restoring cached node modules
3:57:47 PM: Finished restoring cached node modules
3:57:47 PM: Installing NPM modules using NPM version 6.9.0
3:57:55 PM: npm
3:57:55 PM:  WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.2.9 (node_modules/fsevents):
3:57:55 PM: npm WARN
3:57:55 PM:  notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.2.9: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})
3:57:55 PM: audited 19009 packages in 6.342s
3:57:55 PM: found 0 vulnerabilities
3:57:55 PM: NPM modules installed
3:57:56 PM: Started restoring cached go cache
3:57:56 PM: Finished restoring cached go cache
3:57:56 PM: unset GOOS;
3:57:56 PM: unset GOARCH;
3:57:56 PM: export GOROOT='/opt/buildhome/.gimme/versions/go1.12.linux.amd64';
3:57:56 PM: export PATH="/opt/buildhome/.gimme/versions/go1.12.linux.amd64/bin:${PATH}";
3:57:56 PM: go version >&2;
3:57:56 PM: export GIMME_ENV='/opt/buildhome/.gimme/env/go1.12.linux.amd64.env';
3:57:56 PM: go version go1.12 linux/amd64
3:57:56 PM: Installing missing commands
3:57:56 PM: Verify run directory
3:57:56 PM: Executing user command: ng build
3:58:12 PM: Date: 2019-07-10T14:58:12.768Z
3:58:12 PM: Hash: 50d6e3d977e5b87155d3
3:58:12 PM: Time: 12495ms
3:58:12 PM: chunk {main} main-es5.js, main-es5.js.map (main) 998 kB [initial] [rendered]
3:58:12 PM: chunk {polyfills} polyfills-es5.js, polyfills-es5.js.map (polyfills) 546 kB [initial] [rendered]
3:58:12 PM: chunk {runtime} runtime-es5.js, runtime-es5.js.map (runtime) 6.08 kB [entry] [rendered]
3:58:12 PM: chunk {styles} styles-es5.js, styles-es5.js.map (styles) 671 kB [initial] [rendered]
3:58:12 PM: chunk {vendor} vendor-es5.js, vendor-es5.js.map (vendor) 4.53 MB [initial] [rendered]
3:58:23 PM: Date: 2019-07-10T14:58:23.505Z
3:58:23 PM: Hash: 0b3e57de5bd2dd477a95
3:58:23 PM: Time: 10658ms
3:58:24 PM: Starting post processing
3:58:23 PM: chunk {main} main-es2015.js, main-es2015.js.map (main) 988 kB [initial] [rendered]
3:58:23 PM: chunk {polyfills} polyfills-es2015.js, polyfills-es2015.js.map (polyfills) 248 kB [initial] [rendered]
3:58:23 PM: chunk {runtime} runtime-es2015.js, runtime-es2015.js.map (runtime) 6.08 kB [entry] [rendered]
3:58:23 PM: chunk {styles} styles-es2015.js, styles-es2015.js.map (styles) 671 kB [initial] [rendered]
3:58:23 PM: chunk {vendor} vendor-es2015.js, vendor-es2015.js.map (vendor) 4.35 MB [initial] [rendered]
3:58:23 PM: Skipping functions preparation step: no functions directory set
3:58:23 PM: Caching artifacts
3:58:23 PM: Started saving node modules
3:58:23 PM: Finished saving node modules
3:58:23 PM: Started saving pip cache
3:58:23 PM: Finished saving pip cache
3:58:23 PM: Started saving emacs cask dependencies
3:58:23 PM: Finished saving emacs cask dependencies
3:58:23 PM: Started saving maven dependencies
3:58:23 PM: Finished saving maven dependencies
3:58:23 PM: Started saving boot dependencies
3:58:23 PM: Finished saving boot dependencies
3:58:23 PM: Started saving go dependencies
3:58:23 PM: Finished saving go dependencies
3:58:23 PM: Build script success
3:58:28 PM: Minifying bundle
3:58:23 PM: Starting to deploy site from 'src'
3:58:23 PM: Creating deploy tree 
3:58:24 PM: 0 new files to upload
3:58:24 PM: 0 new functions to upload
3:58:29 PM: Minifying bundle
3:58:33 PM: Minifying bundle
3:58:34 PM: Minifying bundle
3:58:35 PM: Minifying bundle
3:58:44 PM: Post processing done
3:58:44 PM: Site is live
3:58:49 PM: Finished processing build request in 1m16.150366863s

请在下面找到angular.json的内容:

{
  "$schema": "./node_modules/@angular/cli/lib/config/schema.json",
  "version": 1,
  "newProjectRoot": "projects",
  "projects": {
    "mobile": {
      "projectType": "application",
      "schematics": {},
      "root": "",
      "sourceRoot": "src",
      "prefix": "app",
      "architect": {
        "build": {
          "builder": "@angular-devkit/build-angular:browser",
          "options": {
            "outputPath": "dist/mobile",
            "index": "src/index.html",
            "main": "src/main.ts",
            "polyfills": "src/polyfills.ts",
            "tsConfig": "tsconfig.app.json",
            "aot": false,
            "assets": [
              "src/favicon.ico",
              "src/assets"
            ],
            "styles": [
              "./src/bootstrap/css/bootstrap.css",
              "src/styles.css"
            ],
            "scripts": []
          },
          "configurations": {
            "production": {
              "fileReplacements": [
                {
                  "replace": "src/environments/environment.ts",
                  "with": "src/environments/environment.prod.ts"
                }
              ],
              "optimization": true,
              "outputHashing": "all",
              "sourceMap": false,
              "extractCss": true,
              "namedChunks": false,
              "aot": true,
              "extractLicenses": true,
              "vendorChunk": false,
              "buildOptimizer": true,
              "budgets": [
                {
                  "type": "initial",
                  "maximumWarning": "2mb",
                  "maximumError": "5mb"
                }
              ]
            }
          }
        },
        "serve": {
          "builder": "@angular-devkit/build-angular:dev-server",
          "options": {
            "browserTarget": "mobile:build"
          },
          "configurations": {
            "production": {
              "browserTarget": "mobile:build:production"
            }
          }
        },
        "extract-i18n": {
          "builder": "@angular-devkit/build-angular:extract-i18n",
          "options": {
            "browserTarget": "mobile:build"
          }
        },
        "test": {
          "builder": "@angular-devkit/build-angular:karma",
          "options": {
            "main": "src/test.ts",
            "polyfills": "src/polyfills.ts",
            "tsConfig": "tsconfig.spec.json",
            "karmaConfig": "karma.conf.js",
            "assets": [
              "src/favicon.ico",
              "src/assets"
            ],
            "styles": [
              "src/styles.css"
            ],
            "scripts": []
          }
        },
        "lint": {
          "builder": "@angular-devkit/build-angular:tslint",
          "options": {
            "tsConfig": [
              "tsconfig.app.json",
              "tsconfig.spec.json",
              "e2e/tsconfig.json"
            ],
            "exclude": [
              "**/node_modules/**"
            ]
          }
        },
        "e2e": {
          "builder": "@angular-devkit/build-angular:protractor",
          "options": {
            "protractorConfig": "e2e/protractor.conf.js",
            "devServerTarget": "mobile:serve"
          },
          "configurations": {
            "production": {
              "devServerTarget": "mobile:serve:production"
            }
          }
        }
      }
    }},
  "defaultProject": "mobile"
}

1 个答案:

答案 0 :(得分:1)

enter image description here

如果您查看源代码,它们没有引用任何polyfill或main js文件,请确保您的dist文件夹包含所有js文件(如果不尝试重建和重新部署)。

如果问题仍然存在,请共享angular.json文件