简体   繁体   English

运行 ng serve 发生未处理的异常

[英]Unhandled exception occurred running ng serve

I'm not sure what it means or how to fix it.我不确定这意味着什么或如何解决它。 I just got a new machine and before I pulled down my repo, I installed the latest node, Angular Cli, npm and any other package/framework needed by my app.我刚买了一台新机器,在我下载我的仓库之前,我安装了最新的节点、Angular Cli、npm 和我的应用程序所需的任何其他包/框架。 I cloned the repo and updated all local packages in my project to current versions using npm-check-updates .我使用npm-check-updates克隆了 repo 并更新了我项目中的所有本地包到当前版本。 I then installed the updated packages with >npm install -force to resolve a couple of peer dependency issues.然后,我使用 >npm install -force 安装了更新的软件包,以解决几个对等依赖问题。 I'll post a screen shoot at the very bottom.我将在最底部发布屏幕截图。 But now ng serve doesn't run see error below.但是现在 ng serve 没有运行,请参见下面的错误。 Not sure why?不知道为什么?

➜ client git:(master) ✗ ng serve ➜ 客户端 git:(master) ✗ ng 服务
⠋ Generating browser application bundles (phase: setup)...An unhandled exception occurred: Dev-server address info is not defined. ⠋ 生成浏览器应用程序包(阶段:设置)...发生未处理的异常:未定义开发服务器地址信息。 See "/private/var/folders/l6/zz0rl4793838rf924b4y0tqc0000gn/T/ng-5kND02/angular-errors.log" for further details.有关详细信息,请参阅“/private/var/folders/l6/zz0rl4793838rf924b4y0tqc0000gn/T/ng-5kND02/angular-errors.log”。 ➜ client git:(master) ✗ ➜ 客户端 git:(master) ✗

The error in the index.js file is from this below. index.js 文件中的错误来自以下内容。

 const devServer = createWebpackDevServer(webpackCompiler, devServerConfig); devServer.startCallback(() => { var _a; const address = (_a = devServer.server) === null || _a === void 0 ? void 0 : _a.address(); if (!address) { obs.error(new Error(`Dev-server address info is not defined.`)); return; } result = { success: true, port: typeof address === 'string' ? 0 : address.port, family: typeof address === 'string' ? '' : address.family, address: typeof address === 'string' ? address : address.address, }; });

>npm install -force >npm 安装-force

 ➜ client git:(master) ✗ npm install -f npm WARN using --force Recommended protections disabled. npm WARN ERESOLVE overriding peer dependency npm WARN While resolving: ngx-gallery-9@1.0.6 npm WARN Found: tslib@2.3.1 npm WARN node_modules/tslib npm WARN tslib@"^2.3.1" from the root project npm WARN 22 more (@angular-devkit/build-angular, ...) npm WARN npm WARN Could not resolve dependency: npm WARN peer tslib@"^1.10.0" from ngx-gallery-9@1.0.6 npm WARN node_modules/ngx-gallery-9 npm WARN ngx-gallery-9@"^1.0.6" from the root project npm WARN npm WARN Conflicting peer dependency: tslib@1.14.1 npm WARN node_modules/tslib npm WARN peer tslib@"^1.10.0" from ngx-gallery-9@1.0.6 npm WARN node_modules/ngx-gallery-9 npm WARN ngx-gallery-9@"^1.0.6" from the root project npm WARN deprecated har-validator@5.1.5: this library is no longer supported npm WARN deprecated source-map-resolve@0.6.0: See https://github.com/lydell/source-map-resolve#deprecated npm WARN deprecated uuid@3.4.0: Please upgrade to version 7 or higher. Older versions may use Math.random() in certain circumstances, which is known to be problematic. See https://v8.dev/blog/math-random for details. npm WARN deprecated request@2.88.2: request has been deprecated, see https://github.com/request/request/issues/3142 npm WARN deprecated popper.js@1.16.1: You can find the new Popper v2 at @popperjs/core, this package is dedicated to the legacy v1 npm WARN deprecated tslint@6.1.3: TSLint has been deprecated in favor of ESLint. Please see https://github.com/palantir/tslint/issues/4534 for more information. added 1163 packages, and audited 1164 packages in 37s 118 packages are looking for funding run `npm fund` for details found 0 vulnerabilities

I then installed the updated packages with npm install -force to resolve a couple of peer dependency issues.然后,我使用npm install -force安装了更新的软件包,以解决几个对等依赖问题。

Did you actually manually resolve all the issues or think that the command above would do it for you?您是否真的手动解决了所有问题,或者认为上面的命令会为您解决?

My guess is that the dependencies are not installed properly, but I can be wrong.我的猜测是依赖项没有正确安装,但我可能是错的。

You might want to try the solution I just posted npm not installing unable to resolve dependency tree .您可能想尝试我刚刚发布的解决方案npm not installed unable to resolve dependency tree I also included the link in the post for further troubleshooting.我还在帖子中包含了链接以进行进一步的故障排除。

This might be due to the old version of the node.这可能是由于节点的旧版本。 Kindly update your node version to the latest then run the following command.请将您的节点版本更新到最新版本,然后运行以下命令。

sudo n lts sudo n lts

Then run the following command.然后运行以下命令。

ng run serve

This might help you这可能会帮助你

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 发生未处理的异常:不支持:关键字“id”,使用“$id”作为架构 ID - Angular 13 中的“ng add @ngrx/store” - An unhandled exception occurred: NOT SUPPORTED: keyword "id", use "$id" for schema ID - "ng add @ngrx/store" in Angular 13 处理请求时发生未处理的异常 - An unhandled exception occurred while processing the request 运行ng serve Angular5时出错 - Error when running ng serve Angular5 发生未处理的异常:使用 angular 9 在构建产品上超出调用重试次数 - An unhandled exception occurred: Call retries were exceeded on build prod with angular 9 在Angular 2项目中运行ng serve -aot命令时出错 - Error running ng serve -aot command in Angular 2 project 如何解决 angular 错误“发生未处理的异常:找不到模块'typescript'”? - How to solve angular error "An unhandled exception occurred: Cannot find module 'typescript' "? 发生未处理的异常:找不到模块“@angular-devkit/build-angular” - An unhandled exception occurred: Could not find module "@angular-devkit/build-angular" 发生未处理的异常:脚本文件../node_modules/chart.js 不存在 - An unhandled exception occurred: Script file ../node_modules/chart.js does not exist 使用 MVC IIS 8 错误插入文件夹 C# 发生未处理的访问异常 - Insert Folder C# with MVC IIS 8 Error An unhandled access exception has occurred 运行ng build时,属性“ title”在类型“ {}”上不存在-虽然prod可与ng serve一起使用 - Property 'title' does not exist on type '{}' when running ng build --prod works with ng serve though
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM