You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Angular 17项目运行后出现ReferenceError: document is not defined错误求助

Angular 17演示应用运行报错问题

我正在创建Angular 17演示应用以探索其特性,项目成功运行后会出现如下错误。当前项目未使用任何动画,也未调用类似document.getElement...的代码。以下为错误栈信息及package.json依赖供参考:

at e2.n2.appendCursorAnimationCss (/Users/shubhambhardwaj/demo/node_modules/typed.js/dist/typed.module.js:1:3024)
at e2.n2.load (/Users/shubhambhardwaj/demo/node_modules/typed.js/dist/typed.module.js:1:2719)
at t2 (/Users/shubhambhardwaj/demo/node_modules/typed.js/dist/typed.module.js:1:4695)
at NgxTypedJsComponent.ngAfterViewInit (/Users/shubhambhardwaj/demo/node_modules/ngx-typed-js/fesm2020/ngx-typed-js.mjs:21:18)
at callHookInternal (/Users/shubhambhardwaj/portfolio/demo/node_modules/@angular/core/fesm2022/core.mjs:3523:14)
at callHook (/Users/shubhambhardwaj/demo/node_modules/@angular/core/fesm2022/core.mjs:3550:13)
at callHooks (/Users/shubhambhardwaj/demo/node_modules/@angular/core/fesm2022/core.mjs:3505:17)
at executeInitAndCheckHooks (/Users/shubhambhardwaj/demo/node_modules/@angular/core/fesm2022/core.mjs:3455:9)
at refreshView (/Users/shubhambhardwaj/dmeo/node_modules/@angular/core/fesm2022/core.mjs:13461:21)
at detectChangesInView (/Users/shubhambhardwaj/demo/node_modules/@angular/core/fesm2022/core.mjs:13615:9)

Package.json依赖:

"dependencies": {
    "@angular/animations": "^17.0.0",
    "@angular/cdk": "^17.0.3",
    "@angular/common": "^17.0.0",
    "@angular/compiler": "^17.0.0",
    "@angular/core": "^17.0.0",
    "@angular/forms": "^17.0.0",
    "@angular/material": "^17.0.3",
    "@angular/platform-browser": "^17.0.0",
    "@angular/platform-browser-dynamic": "^17.0.0",
    "@angular/platform-server": "^17.0.0",
    "@angular/router": "^17.0.0",
    "@angular/ssr": "^17.0.6",
    "bootstrap": "^5.3.2",
    "express": "^4.18.2",
    "ngx-typed-js": "^2.1.1",
    "rxjs": "~7.8.0",
    "tslib": "^2.3.0",
    "zone.js": "~0.14.2"
  }

内容的提问来源于stack exchange,提问作者Shubham Bhardwaj

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.06.28 14:57:40