Ionic 错误:离子服务器弹出未处理的异常:NGCC失败

t5fffqht  于 2022-12-08  发布在  Ionic
关注(0)|答案(2)|浏览(261)

大家好:)从今天开始,我在服务我的离子项目时遇到了一个问题。运行ng serveionic servenpm run start每次都会带来同样的错误:

silasmartin@fd475edb-65e3-4754-a729-c2436b338573 heroes % ionic serve
> ng run app:serve --host=localhost --port=8100
[ng] Options:
[ng]   --version                          Show version number               [boolean]
[ng]   -s, --source                       A path (relative to the working directory)
[ng]                                      of the `node_modules` folder to process.
[ng]                                                      [default: "./node_modules"]
[ng]   -p, --properties                   An array of names of properties in
[ng]                                      package.json to compile (e.g. `module` or
[ng]                                      `es2015`)
[ng]                                      Each of these properties should hold the
[ng]                                      path to a bundle-format.
[ng]                                      If provided, only the specified properties
[ng]                                      are considered for processing.
[ng]                                      If not provided, all the supported format
[ng]                                      properties (e.g. fesm2015, fesm5, es2015,
[ng]                                      esm2015, esm5, main, module) in the
[ng]                                      package.json are considered.        [array]
[ng]   -t, --target                       A relative path (from the `source` path) to
[ng]                                      a single entry-point to process (plus its
[ng]                                      dependencies).
[ng]                                      If this property is provided then
[ng]                                      `error-on-failed-entry-point` is forced to
[ng]                                      true
[ng]   --first-only                       If specified then only the first matching
[ng]                                      package.json property will be compiled.
[ng]                                                                        [boolean]
[ng]   --create-ivy-entry-points          If specified then new `*_ivy_ngcc`
[ng]                                      entry-points will be added to package.json
[ng]                                      rather than modifying the ones in-place.
[ng]                                      For this to work you need to have custom
[ng]                                      resolution set up (e.g. in webpack) to look
[ng]                                      for these new entry-points.
[ng]                                      The Angular CLI does this already, so it is
[ng]                                      safe to use this option if the project is
[ng]                                      being built via the CLI.          [boolean]
[ng]   --legacy-message-ids               Render `$localize` messages with legacy
[ng]                                      format ids.
[ng]                                      The default value is `true`. Only set this
[ng]                                      to `false` if you do not want legacy
[ng]                                      message ids to
[ng]                                      be rendered. For example, if you are not
[ng]                                      using legacy message ids in your
[ng]                                      translation files
[ng]                                      AND are not doing compile-time inlining of
[ng]                                      translations, in which case the extra
[ng]                                      message ids
[ng]                                      would add unwanted size to the final source
[ng]                                      bundle.
[ng]                                      It is safe to leave this set to true if you
[ng]                                      are doing compile-time inlining because the
[ng]                                      extra
[ng]                                      legacy message ids will all be stripped
[ng]                                      during translation.
[ng]                                                        [boolean] [default: true]
[ng]   --async                            Whether to compile asynchronously. This is
[ng]                                      enabled by default as it allows
[ng]                                      compilations to be parallelized.
[ng]                                      Disabling asynchronous compilation may be
[ng]                                      useful for debugging.
[ng]                                                        [boolean] [default: true]
[ng]   -l, --loglevel                     The lowest severity logging message that
[ng]                                      should be output.
[ng]                                      [choices: "debug", "info", "warn", "error"]
[ng]   --invalidate-entry-point-manifest  If this is set then ngcc will not read an
[ng]                                      entry-point manifest file from disk.
[ng]                                      Instead it will walk the directory tree as
[ng]                                      normal looking for entry-points, and then
[ng]                                      write a new manifest file.
[ng]                                                       [boolean] [default: false]
[ng]   --error-on-failed-entry-point      Set this option in order to terminate
[ng]                                      immediately with an error code if an
[ng]                                      entry-point fails to be processed.
[ng]                                      If `-t`/`--target` is provided then this
[ng]                                      property is always true and cannot be
[ng]                                      changed. Otherwise the default is false.
[ng]                                      When set to false, ngcc will continue to
[ng]                                      process entry-points after a failure. In
[ng]                                      which case it will log an error and resume
[ng]                                      processing other entry-points.
[ng]                                                       [boolean] [default: false]
[ng]   --tsconfig                         A path to a tsconfig.json file that will be
[ng]                                      used to configure the Angular compiler and
[ng]                                      module resolution used by ngcc.
[ng]                                      If not provided, ngcc will attempt to read
[ng]                                      a `tsconfig.json` file from the folder
[ng]                                      above that given by the `-s` option.
[ng]                                      Set to false (via `--no-tsconfig`) if you
[ng]                                      do not want ngcc to use any `tsconfig.json`
[ng]                                      file.                              [string]
[ng]   --help                             Show help                         [boolean]
[ng] Unknown arguments: use-program-dependencies, useProgramDependencies
[ng] An unhandled exception occurred: NGCC failed.
[ng] See "/private/var/folders/nm/gndd82px52zfth8b5f54m4c00000gn/T/ng-Anv1eT/angular-errors.log" for further details.

[ERROR] ng has unexpectedly closed (exit code 127).
        
        The Ionic CLI will exit. Please check any output above for error details.
silasmartin@fd475edb-65e3-4754-a729-c2436b338573 heroes % ng serve
Options:
  --version                          Show version number               [boolean]
  -s, --source                       A path (relative to the working directory)
                                     of the `node_modules` folder to process.
                                                     [default: "./node_modules"]
  -p, --properties                   An array of names of properties in
                                     package.json to compile (e.g. `module` or
                                     `es2015`)
                                     Each of these properties should hold the
                                     path to a bundle-format.
                                     If provided, only the specified properties
                                     are considered for processing.
                                     If not provided, all the supported format
                                     properties (e.g. fesm2015, fesm5, es2015,
                                     esm2015, esm5, main, module) in the
                                     package.json are considered.        [array]
  -t, --target                       A relative path (from the `source` path) to
                                     a single entry-point to process (plus its
                                     dependencies).
                                     If this property is provided then
                                     `error-on-failed-entry-point` is forced to
                                     true
  --first-only                       If specified then only the first matching
                                     package.json property will be compiled.
                                                                       [boolean]
  --create-ivy-entry-points          If specified then new `*_ivy_ngcc`
                                     entry-points will be added to package.json
                                     rather than modifying the ones in-place.
                                     For this to work you need to have custom
                                     resolution set up (e.g. in webpack) to look
                                     for these new entry-points.
                                     The Angular CLI does this already, so it is
                                     safe to use this option if the project is
                                     being built via the CLI.          [boolean]
  --legacy-message-ids               Render `$localize` messages with legacy
                                     format ids.
                                     The default value is `true`. Only set this
                                     to `false` if you do not want legacy
                                     message ids to
                                     be rendered. For example, if you are not
                                     using legacy message ids in your
                                     translation files
                                     AND are not doing compile-time inlining of
                                     translations, in which case the extra
                                     message ids
                                     would add unwanted size to the final source
                                     bundle.
                                     It is safe to leave this set to true if you
                                     are doing compile-time inlining because the
                                     extra
                                     legacy message ids will all be stripped
                                     during translation.
                                                       [boolean] [default: true]
  --async                            Whether to compile asynchronously. This is
                                     enabled by default as it allows
                                     compilations to be parallelized.
                                     Disabling asynchronous compilation may be
                                     useful for debugging.
                                                       [boolean] [default: true]
  -l, --loglevel                     The lowest severity logging message that
                                     should be output.
                                     [choices: "debug", "info", "warn", "error"]
  --invalidate-entry-point-manifest  If this is set then ngcc will not read an
                                     entry-point manifest file from disk.
                                     Instead it will walk the directory tree as
                                     normal looking for entry-points, and then
                                     write a new manifest file.
                                                      [boolean] [default: false]
  --error-on-failed-entry-point      Set this option in order to terminate
                                     immediately with an error code if an
                                     entry-point fails to be processed.
                                     If `-t`/`--target` is provided then this
                                     property is always true and cannot be
                                     changed. Otherwise the default is false.
                                     When set to false, ngcc will continue to
                                     process entry-points after a failure. In
                                     which case it will log an error and resume
                                     processing other entry-points.
                                                      [boolean] [default: false]
  --tsconfig                         A path to a tsconfig.json file that will be
                                     used to configure the Angular compiler and
                                     module resolution used by ngcc.
                                     If not provided, ngcc will attempt to read
                                     a `tsconfig.json` file from the folder
                                     above that given by the `-s` option.
                                     Set to false (via `--no-tsconfig`) if you
                                     do not want ngcc to use any `tsconfig.json`
                                     file.                              [string]
  --help                             Show help                         [boolean]

Unknown arguments: use-program-dependencies, useProgramDependencies
An unhandled exception occurred: NGCC failed.
See "/private/var/folders/nm/gndd82px52zfth8b5f54m4c00000gn/T/ng-8jXxGx/angular-errors.log" for further details.
silasmartin@fd475edb-65e3-4754-a729-c2436b338573 heroes % npm run start

> Heroes@0.0.1 start /Users/silasmartin/Projekte/heroes
> ng serve

Options:
  --version                          Show version number               [boolean]
  -s, --source                       A path (relative to the working directory)
                                     of the `node_modules` folder to process.
                                                     [default: "./node_modules"]
  -p, --properties                   An array of names of properties in
                                     package.json to compile (e.g. `module` or
                                     `es2015`)
                                     Each of these properties should hold the
                                     path to a bundle-format.
                                     If provided, only the specified properties
                                     are considered for processing.
                                     If not provided, all the supported format
                                     properties (e.g. fesm2015, fesm5, es2015,
                                     esm2015, esm5, main, module) in the
                                     package.json are considered.        [array]
  -t, --target                       A relative path (from the `source` path) to
                                     a single entry-point to process (plus its
                                     dependencies).
                                     If this property is provided then
                                     `error-on-failed-entry-point` is forced to
                                     true
  --first-only                       If specified then only the first matching
                                     package.json property will be compiled.
                                                                       [boolean]
  --create-ivy-entry-points          If specified then new `*_ivy_ngcc`
                                     entry-points will be added to package.json
                                     rather than modifying the ones in-place.
                                     For this to work you need to have custom
                                     resolution set up (e.g. in webpack) to look
                                     for these new entry-points.
                                     The Angular CLI does this already, so it is
                                     safe to use this option if the project is
                                     being built via the CLI.          [boolean]
  --legacy-message-ids               Render `$localize` messages with legacy
                                     format ids.
                                     The default value is `true`. Only set this
                                     to `false` if you do not want legacy
                                     message ids to
                                     be rendered. For example, if you are not
                                     using legacy message ids in your
                                     translation files
                                     AND are not doing compile-time inlining of
                                     translations, in which case the extra
                                     message ids
                                     would add unwanted size to the final source
                                     bundle.
                                     It is safe to leave this set to true if you
                                     are doing compile-time inlining because the
                                     extra
                                     legacy message ids will all be stripped
                                     during translation.
                                                       [boolean] [default: true]
  --async                            Whether to compile asynchronously. This is
                                     enabled by default as it allows
                                     compilations to be parallelized.
                                     Disabling asynchronous compilation may be
                                     useful for debugging.
                                                       [boolean] [default: true]
  -l, --loglevel                     The lowest severity logging message that
                                     should be output.
                                     [choices: "debug", "info", "warn", "error"]
  --invalidate-entry-point-manifest  If this is set then ngcc will not read an
                                     entry-point manifest file from disk.
                                     Instead it will walk the directory tree as
                                     normal looking for entry-points, and then
                                     write a new manifest file.
                                                      [boolean] [default: false]
  --error-on-failed-entry-point      Set this option in order to terminate
                                     immediately with an error code if an
                                     entry-point fails to be processed.
                                     If `-t`/`--target` is provided then this
                                     property is always true and cannot be
                                     changed. Otherwise the default is false.
                                     When set to false, ngcc will continue to
                                     process entry-points after a failure. In
                                     which case it will log an error and resume
                                     processing other entry-points.
                                                      [boolean] [default: false]
  --tsconfig                         A path to a tsconfig.json file that will be
                                     used to configure the Angular compiler and
                                     module resolution used by ngcc.
                                     If not provided, ngcc will attempt to read
                                     a `tsconfig.json` file from the folder
                                     above that given by the `-s` option.
                                     Set to false (via `--no-tsconfig`) if you
                                     do not want ngcc to use any `tsconfig.json`
                                     file.                              [string]
  --help                             Show help                         [boolean]

Unknown arguments: use-program-dependencies, useProgramDependencies
An unhandled exception occurred: NGCC failed.
See "/private/var/folders/nm/gndd82px52zfth8b5f54m4c00000gn/T/ng-0q7q2B/angular-errors.log" for further details.
npm ERR! code ELIFECYCLE
npm ERR! syscall spawn
npm ERR! file sh
npm ERR! errno ENOENT
npm ERR! Heroes@0.0.1 start: `ng serve`
npm ERR! spawn ENOENT
npm ERR! 
npm ERR! Failed at the Heroes@0.0.1 start script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     /Users/silasmartin/.npm/_logs/2020-10-11T18_18_02_584Z-debug.log

请帮助我,即使将项目重置到最后一个工作点也没有帮助。我试图删除node_modules目录并重新安装npm install或将"enableivy"=false添加到tsconfig.json。我不知道问题出在哪里。
感谢您的支持:)塞拉斯

q0qdq0h2

q0qdq0h21#

更新Angular cli和核心对我很有效:

ng update @angular/cli @angular/core
nhhxz33t

nhhxz33t2#

我今天遇到了同样的问题,在通过SVN合并那个特定文件夹中的代码后-这似乎搞砸了一些事情。
清除了一切,从SVN得到了来源,并再次尝试,错误消失了。
作为一个提示,当您遇到上述错误时,类似的情况也可能是您的场景中的原因。

相关问题