Dist folder reverts changes when dedploying

Discussão em 'Angular' iniciado por Ben, Abril 12, 2025.

  1. Ben

    Ben Guest

    I'm trying to deploy an Angular app to GitHub pages via angular-cli-gh. When I do, it presents me with two errors: "index.html could not be copied to 404.html. Proceeding without it" and .nojekyll file could not be created. ENOENT: no such file or directory, open 'C:[path]\dist\qfilms-angular-client\browser.nojekyll'. There is no "browser" folder within qfilms-angular-client.

    Obviously these files are necessary to actually produce the app. So I tried creating the browser folder, creating the .nojekyll folder, and copying index.html to 404.html manually. However, whenever I run ng deploy --base-href=/qfilms-angular-client, the files I've created vanish from the dist folder and the same errors occur. How would I resolve this?

    My angular.json, in case it's helpful:

    {
    "$schema": "./node_modules/@angular/cli/lib/config/schema.json",
    "version": 1,
    "newProjectRoot": "projects",
    "projects": {
    "qfilms-Angular-client": {
    "projectType": "application",
    "schematics": {
    "@schematics/angular:component": {
    "style": "scss"
    }
    },
    "root": "",
    "sourceRoot": "src",
    "prefix": "app",
    "architect": {
    "build": {
    "builder": "@angular-devkit/build-angular:browser",
    "options": {
    "outputPath": "dist/qfilms-angular-client",
    "index": "src/index.html",
    "main": "src/main.ts",
    "polyfills": [
    "zone.js"
    ],
    "tsConfig": "tsconfig.app.json",
    "inlineStyleLanguage": "scss",
    "assets": [
    "src/favicon.ico",
    "src/assets"
    ],
    "styles": [
    "src/styles.scss"
    ],
    "scripts": []
    },
    "configurations": {
    "production": {
    "budgets": [
    {
    "type": "initial",
    "maximumWarning": "800kb",
    "maximumError": "1.5mb"
    },
    {
    "type": "anyComponentStyle",
    "maximumWarning": "2kb",
    "maximumError": "4kb"
    }
    ],
    "outputHashing": "all"
    },
    "development": {
    "buildOptimizer": false,
    "optimization": false,
    "vendorChunk": true,
    "extractLicenses": false,
    "sourceMap": true,
    "namedChunks": true
    }
    },
    "defaultConfiguration": "production"
    },
    "serve": {
    "builder": "@angular-devkit/build-angular:dev-server",
    "configurations": {
    "production": {
    "browserTarget": "qfilms-Angular-client:build:production"
    },
    "development": {
    "browserTarget": "qfilms-Angular-client:build:development"
    }
    },
    "defaultConfiguration": "development"
    },
    "extract-i18n": {
    "builder": "@angular-devkit/build-angular:extract-i18n",
    "options": {
    "browserTarget": "qfilms-Angular-client:build"
    }
    },
    "test": {
    "builder": "@angular-devkit/build-angular:karma",
    "options": {
    "polyfills": [
    "zone.js",
    "zone.js/testing"
    ],
    "tsConfig": "tsconfig.spec.json",
    "inlineStyleLanguage": "scss",
    "assets": [
    "src/favicon.ico",
    "src/assets"
    ],
    "styles": [
    "src/styles.scss"
    ],
    "scripts": []
    }
    },
    "deploy": {
    "builder": "angular-cli-ghpages:deploy"
    }
    }
    }
    },
    "cli": {
    "analytics": "cf9306e0-6fae-47c1-a8f7-95b7c4551f0f"
    }
    }

    Continue reading...

Compartilhe esta Página