启动角度开发服务器时遇到问题

时间:2020-01-31 05:18:09

标签: node.js angular typescript npm rxjs

启动开发服务器时,我正在使用最新版本的angular并面临以下问题。

An unhandled exception occurred: Object prototype may only be an Object or null: undefined
See "/tmp/ng-3lbO1f/angular-errors.log" for further details.
npm ERR! code ELIFECYCLE
npm ERR! syscall spawn
npm ERR! file sh
npm ERR! errno ENOENT
npm ERR! pay-auth@1.0.0 start: `ng serve --open`
npm ERR! spawn ENOENT
npm ERR! 
npm ERR! Failed at the pay-auth@1.0.0 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!     /home/.npm/_logs/2020-01-31T05_05_55_332Z-debug.log

/home/.npm/_logs/2020-01-31T05_05_55_332Z-debug.log -请查找日志

0 info it worked if it ends with ok
1 verbose cli [
1 verbose cli   '/home/.nvm/versions/node/v12.14.1/bin/node',
1 verbose cli   '/home/.nvm/versions/node/v12.14.1/bin/npm',
1 verbose cli   'start'
1 verbose cli ]
2 info using npm@6.13.4
3 info using node@v12.14.1
4 verbose run-script [ 'prestart', 'start', 'poststart' ]
5 info lifecycle pay-auth@1.0.0~prestart: pay-auth@1.0.0
6 info lifecycle pay-auth@1.0.0~start: pay-auth@1.0.0
7 verbose lifecycle pay-auth@1.0.0~start: unsafe-perm in lifecycle true
8 verbose lifecycle pay-auth@1.0.0~start: PATH: /home/.nvm/versions/node/v12.14.1/lib/node_modules/npm/node_modules/npm-lifecycle/node-gyp-bin:/home/Desktop/dump/PayAuth/node_modules/.bin:/home/.nvm/versions/node/v12.14.1/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin:/usr/lib/jvm/java-8-oracle/bin:/usr/lib/jvm/java-8-oracle/db/bin:/usr/lib/jvm/java-8-oracle/jre/bin
9 verbose lifecycle pay-auth@1.0.0~start: CWD: /home/Desktop/dump/PayAuth
10 silly lifecycle pay-auth@1.0.0~start: Args: [ '-c', 'ng serve --open' ]
11 info lifecycle pay-auth@1.0.0~start: Failed to exec start script
12 verbose stack Error: pay-auth@1.0.0 start: `ng serve --open`
12 verbose stack spawn ENOENT
12 verbose stack     at ChildProcess.<anonymous> (/home/.nvm/versions/node/v12.14.1/lib/node_modules/npm/node_modules/npm-lifecycle/lib/spawn.js:48:18)
12 verbose stack     at ChildProcess.emit (events.js:223:5)
12 verbose stack     at maybeClose (internal/child_process.js:1021:16)
12 verbose stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:283:5)
13 verbose pkgid pay-auth@1.0.0
14 verbose cwd /home/Desktop/dump/PayAuth
15 verbose Linux 4.15.0-72-generic
16 verbose argv "/home/.nvm/versions/node/v12.14.1/bin/node" "/home/.nvm/versions/node/v12.14.1/bin/npm" "start"
17 verbose node v12.14.1
18 verbose npm  v6.13.4
19 error code ELIFECYCLE
20 error syscall spawn
21 error file sh
22 error errno ENOENT
23 error pay-auth@1.0.0 start: `ng serve --open`
23 error spawn ENOENT
24 error Failed at the pay-auth@1.0.0 start script.
24 error This is probably not a problem with npm. There is likely additional logging output above.

请找到angular和其他库的版本

Angular CLI: 8.3.23
Node: 12.14.1
OS: linux x64
Angular: 8.2.14
... animations, common, compiler-cli, core, forms
... language-service, platform-browser, platform-browser-dynamic
... router

Package                           Version
-----------------------------------------------------------
@angular-devkit/architect         0.803.23
@angular-devkit/build-angular     0.803.23
@angular-devkit/build-optimizer   0.803.23
@angular-devkit/build-webpack     0.803.23
@angular-devkit/core              8.3.23
@angular-devkit/schematics        8.3.23
@angular/cdk                      8.2.3
@angular/cli                      8.3.23
@angular/compiler                 8.0.3
@angular/http                     8.0.0-beta.10
@angular/material                 8.2.3
@ngtools/webpack                  8.3.23
@schematics/angular               8.3.23
@schematics/update                0.803.23
rxjs                              6.5.4
typescript                        3.5.3
webpack                           4.39.2

请先帮助并感谢。

我曾多次尝试删除节点模块并重新安装npm软件包。但这并没有帮助我

1 个答案:

答案 0 :(得分:2)

尝试将您的@ angular / compiler升级到其他软件包的相同级别(8.3.23)。这可能会导致此不匹配问题。