Angular 运行错误 Object Prototype may only be an Object or null: undefined
2020-01-01
2613
我的 Angular 应用程序在 package.json 中有几个 npm 依赖项。当我尝试安装 npm 依赖项
npm i
时,出现一些
sha1 似乎已损坏的问题
。为此,我删除了 package-lock.json,然后我可以成功安装所有 npm 依赖项。但
npm start
无法运行应用程序,显示错误为
An unhandled exception occurred: Object prototype may only be an Object or null: undefined
错误日志
0 info it worked if it ends with ok
1 verbose cli [ 'C:\\Program Files\\nodejs\\node.exe',
1 verbose cli 'C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js',
1 verbose cli 'start' ]
2 info using [email protected]
3 info using [email protected]
4 verbose run-script [ 'prestart', 'start', 'poststart' ]
5 info lifecycle [email protected]~prestart: [email protected]
6 info lifecycle [email protected]~start: [email protected]
7 verbose lifecycle [email protected]~start: unsafe-perm in lifecycle true
8 verbose lifecycle [email protected]~start: PATH: C:\Program Files\nodejs\node_modules\npm\node_modules\npm-lifecycle\node-gyp-bin;C:\workspace\myworkspace\2020\fis-employee-ui\node_modules\.bin;C:\Program Files (x86)\Common Files\Oracle\Java\javapath;C:\windows\system32;C:\windows;C:\windows\System32\Wbem;C:\windows\System32\WindowsPowerShell\v1.0\;C:\windows\System32\OpenSSH\;C:\Program Files (x86)\Git\cmd;C:\Program Files\PuTTY\;C:\Program Files\nodejs\;C:\Program Files\Java\jdk1.8.0_212\bin;C:\Program Files\Java\jre1.8.0_212\bin;C:\Program Files (x86)\MySQL\MySQL Utilities 1.6\;C:\Users\e5608029\AppData\Local\Programs\Python\Python37\Scripts\;C:\Users\e5608029\AppData\Local\Programs\Python\Python37\;C:\Users\e5608029\AppData\Local\Microsoft\WindowsApps;C:\Users\e5608029\AppData\Roaming\npm;C:\Users\e5608029\AppData\Local\Programs\Microsoft VS Code\bin
9 verbose lifecycle [email protected]~start: CWD: C:\workspace\myworkspace\2020\fis-employee-ui
10 silly lifecycle [email protected]~start: Args: [ '/d /s /c',
10 silly lifecycle 'ng serve --host 0.0.0.0 --proxy-config proxy.conf.json' ]
11 info lifecycle [email protected]~start: Failed to exec start script
12 verbose stack Error: [email protected] start: `ng serve --host 0.0.0.0 --proxy-config proxy.conf.json`
12 verbose stack spawn ENOENT
12 verbose stack at ChildProcess.<anonymous> (C:\Program Files\nodejs\node_modules\npm\node_modules\npm-lifecycle\lib\spawn.js:48:18)
12 verbose stack at ChildProcess.emit (events.js:182:13)
12 verbose stack at maybeClose (internal/child_process.js:962:16)
12 verbose stack at Process.ChildProcess._handle.onexit (internal/child_process.js:251:5)
13 verbose pkgid [email protected]
14 verbose cwd C:\workspace\myworkspace\2020\fis-employee-ui
15 verbose Windows_NT 10.0.17134
16 verbose argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "start"
17 verbose node v10.15.0
18 verbose npm v6.4.1
19 error file C:\windows\system32\cmd.exe
20 error code ELIFECYCLE
21 error errno ENOENT
22 error syscall spawn
23 error [email protected] start: `ng serve --host 0.0.0.0 --proxy-config proxy.conf.json`
23 error spawn ENOENT
24 error Failed at the [email protected] start script.
24 error This is probably not a problem with npm. There is likely additional logging output above.
25 verbose exit [ 1, true ]
1个回答
删除现有文件后,再次尝试 npm install。然后重试 npm start。如果仍然不起作用,请尝试通过“ng update @angular/cli @angular/core”命令升级您的项目。 您必须按照 此处 所述进行一些更改>
i_sapumal
2020-01-01