Приложение Electron / Angular не удалось скомпилировать из-за отсутствия модуля http - PullRequest
0 голосов
/ 21 января 2020

Мне нужно работать над приложением Electron / Angular, которое уже было разработано ранее, я просто пытаюсь добавить функцию. Некоторое время приложение не трогали, но теперь, когда я пытаюсь запустить его в разработке с

ng serve

, я получаю следующую ошибку

Your global Angular CLI version (8.3.23) is greater than your local
version (6.0.8). The local Angular CLI version is used.

To disable this warning use "ng config -g cli.warnings.versionMismatch false".
** Angular Live Development Server is listening on localhost:4200, open your browser on http://localhost:4200/ **
 10% building modules 6/6 modules 0 activei 「wds」: Project is running at http://localhost:4200/
i 「wds」: webpack output is served from /
i 「wds」: 404s will fallback to //index.html

Date: 2020-01-21T17:27:12.816Z
Hash: 9ccbd80f9187de6cbb3f
Time: 4077ms
chunk {main} main.js, main.js.map (main) 355 kB [entry] [rendered]
chunk {polyfills} polyfills.js, polyfills.js.map (polyfills) 354 kB [entry] [rendered]
chunk {runtime} runtime.js, runtime.js.map (runtime) 5.22 kB [entry] [rendered]
chunk {styles} styles.js, styles.js.map (styles) 513 kB [entry] [rendered]
chunk {vendor} vendor.js, vendor.js.map (vendor) 5.5 kB [initial] [rendered]

WARNING in ./src/styles.scss (./node_modules/raw-loader!./node_modules/postcss-loader/lib??embedded!./node_modules/sass-loader/dist/cjs.js??ref--14-3!./src/styles.sc/styles.scss)
(Emitted value instead of an instance of Error) autoprefixer: D:\Helpful Applications\dispatch-electron\src\styles.scss:24:4: grid-auto-rows is not supported by IE grid-auto-rows is not supported by IE

ERROR in src/environments/environment.prod.ts(1,23): error TS2307: Cannot find module '../../config/http'.
src/environments/environment.ts(5,23): error TS2307: Cannot find module '../../config/http'.
src/environments/environment.ts(6,26): error TS2307: Cannot find module '../../config/http.dev'.

i 「wdm」: Failed to compile.

в моем каталоге / config / У меня нет каталога http или http.dev, у меня есть только файл http.template. js, содержащий этот файл.

module.exports = {
    authUrl: "",
    apiUrl: "",
    logUrl: ""
};

Вот мой файл environment.ts

// This file can be replaced during build by using the `fileReplacements` array.
// `ng build ---prod` replaces `environment.ts` with `environment.prod.ts`.
// The list of file replacements can be found in `angular.json`.

import * as http from "../../config/http";
import * as devhttp from "../../config/http.dev";

Object.assign(http, devhttp);

export const environment = {
    production: false,
    http: http
};

/*
 * In development mode, to ignore zone related error stack frames such as
 * `zone.run`, `zoneDelegate.invokeTask` for easier debugging, you can
 * import the following file, but please comment it out in production mode
 * because it will have performance impact when throw error
 */
// import 'zone.js/dist/zone-error';  // Included with Angular CLI.

Вот файл angular. json

{
    "$schema": "./node_modules/@angular/cli/lib/config/schema.json",
    "version": 1,
    "newProjectRoot": "projects",
    "projects": {
        "dispatch-electron": {
            "root": "",
            "sourceRoot": "src",
            "projectType": "application",
            "prefix": "d",
            "schematics": {},
            "architect": {
                "build": {
                    "builder": "@angular-devkit/build-angular:browser",
                    "options": {
                        "outputPath": "dist",
                        "index": "src/index.html",
                        "main": "src/main.ts",
                        "polyfills": "src/polyfills.ts",
                        "tsConfig": "src/tsconfig.app.json",
                        "assets": [
                            "src/favicon.ico",
                            "src/assets"
                        ],
                        "styles": [
                            "src/styles.scss"
                        ],
                        "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
                        }
                    }
                },
                "serve": {
                    "builder": "@angular-devkit/build-angular:dev-server",
                    "options": {
                        "browserTarget": "dispatch-electron:build"
                    },
                    "configurations": {
                        "production": {
                            "browserTarget": "dispatch-electron:build:production"
                        }
                    }
                },
                "extract-i18n": {
                    "builder": "@angular-devkit/build-angular:extract-i18n",
                    "options": {
                        "browserTarget": "dispatch-electron:build"
                    }
                },
                "test": {
                    "builder": "@angular-devkit/build-angular:karma",
                    "options": {
                        "main": "src/test.ts",
                        "polyfills": "src/polyfills.ts",
                        "tsConfig": "src/tsconfig.spec.json",
                        "karmaConfig": "src/karma.conf.js",
                        "styles": [
                            "src/styles.scss"
                        ],
                        "scripts": [],
                        "assets": [
                            "src/favicon.ico",
                            "src/assets"
                        ]
                    }
                },
                "lint": {
                    "builder": "@angular-devkit/build-angular:tslint",
                    "options": {
                        "tsConfig": [
                            "src/tsconfig.app.json",
                            "src/tsconfig.spec.json"
                        ],
                        "exclude": [
                            "**/node_modules/**"
                        ]
                    }
                }
            }
        },
        "dispatch-electron-e2e": {
            "root": "e2e/",
            "projectType": "application",
            "architect": {
                "e2e": {
                    "builder": "@angular-devkit/build-angular:protractor",
                    "options": {
                        "protractorConfig": "e2e/protractor.conf.js",
                        "devServerTarget": "dispatch-electron:serve"
                    },
                    "configurations": {
                        "production": {
                            "devServerTarget": "dispatch-electron:serve:production"
                        }
                    }
                },
                "lint": {
                    "builder": "@angular-devkit/build-angular:tslint",
                    "options": {
                        "tsConfig": "e2e/tsconfig.e2e.json",
                        "exclude": [
                            "**/node_modules/**"
                        ]
                    }
                }
            }
        }
    },
    "defaultProject": "dispatch-electron"
}

У меня мало знаний об этом приложении, поэтому любая помощь будет принята с благодарностью. Я просто хочу получить его в настройках разработки, чтобы я мог работать над этим.

1 Ответ

0 голосов
/ 21 января 2020

Похоже, что файлы отсутствуют. Закомментируйте импорт. Далее попробуйте выяснить значение http. Это может быть логическое значение, но, скорее всего, это объект ключ / значение.

//import * as http from "../../config/http";
//import * as devhttp from "../../config/http.dev";

//Object.assign(http, devhttp);

export const environment = {
    production: false,
    http: http
};
Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...