简体   繁体   中英

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. I cloned the repo and updated all local packages in my project to current versions using npm-check-updates . I then installed the updated packages with >npm install -force to resolve a couple of peer dependency issues. I'll post a screen shoot at the very bottom. But now ng serve doesn't run see error below. Not sure why?

➜ client git:(master) ✗ ng serve
⠋ 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. ➜ client git:(master) ✗

The error in the index.js file is from this below.

 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

 ➜ 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.

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 . 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

Then run the following command.

ng run serve

This might help you

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM