问题标签 [uncaught-reference-error]

For questions regarding programming in ECMAScript (JavaScript/JS) and its various dialects/implementations (excluding ActionScript). Note JavaScript is NOT the same as Java! Please include all relevant tags on your question; e.g., [node.js], [jquery], [json], [reactjs], [angular], [ember.js], [vue.js], [typescript], [svelte], etc.

0 投票
2 回答
993 浏览

angular - 从 angular 7 升级到 angular 8 或 10 会导致问题

我最近从 angular 7 升级到 angular 8,并且在运行代码时出现错误。代码编译成功,但在浏览器上出现以下错误。有谁知道我该如何解决这个问题?当我升级到 Angular 11 时也会发生同样的错误。我认为问题可能出在 bootstrap 或 webpack 上,因为升级后,它给了我一个 angular.js 样式错误,我用 angular 中的 {input: ''} 修复了这个错误.json 文件。

以下是我的 package.json

我的 angular.json 是

请注意 angular.json 中注释的样式是我在以前版本中的样式,当我取消注释它们时,我收到一个错误,解决方法是添加我为引导程序添加的输入。

最后是我的 index.html

让我知道是否需要任何进一步的文件。

在我在 angular.js 文件中添加带有引导 URL 的 {input:} 之前,我的 angular.js 中有以下内容

在我更改了 angular.json 样式并添加了 (input:(url)} 之前,我收到了以下错误

0 投票
2 回答
1472 浏览

angular - Angular:ReferenceError:初始化前无法访问“FixedDeposit”+循环依赖警告

我已经通过以下 SO Question 寻求解决方案:

Angular:7.2.1 ES6 类 ReferenceError:初始化前无法访问“X”

首先,我在 VS Code 终端上收到以下警告:

检测到循环依赖项中的警告:src\app\modules\asset-classes\fixed-income\fixed-deposits\components\fixed-deposits-details\fixed-deposits-details.component.ts -> src\app\modules\asset -classes\fixed-income\fixed-deposits\components\fixed-deposits-form\fixed-deposits-form.component.ts -> src\app\modules\asset-classes\fixed-income\fixed-deposits\components\固定存款细节\固定存款细节.component.ts

检测到循环依赖项中的警告:src\app\modules\asset-classes\fixed-income\fixed-deposits\components\fixed-deposits-form\fixed-deposits-form.component.ts -> src\app\modules\asset -classes\fixed-income\fixed-reposits\components\fixed-deposits-details\fixed-deposits-details.component.ts -> src\app\modules\asset-classes\fixed-income\fixed-deposits\components\固定存款形式\固定存款形式.component.ts

检测到循环依赖项中的警告:src\app\modules\shared\components\common-dialog\common-dialog.component.ts -> src\app\view-manager.service.ts -> src\app\modules\shared\ components\common-dialog\common-dialog.component.ts

检测到循环依赖中的警告:src\app\view-manager.service.ts -> src\app\modules\shared\components\common-dialog\common-dialog.component.ts -> src\app\view-manager。服务.ts

现在,这显然是因为我各自组件中的以下代码:

固定存款-form.component.ts

在保存点击>>

固定存款详细信息.component.ts

在编辑点击>>

viewService 基本上是我的 ViewManagerService ,它有助于实现角度组件之间的松散耦合,也用于视图导航。由于 FixedDepositsFormsComponent 和 FixedDepositsDetailsComponent 在侧导航中打开(存在于 AppComponent 上),因此 ViewManagerService 负责加载这些组件。

虽然很明显我有一个循环依赖,但我不知道如何修复它。

此外,我的浏览器控制台中出现以下错误:

未捕获的 ReferenceError:在 Module../src/app/modules/asset-classes/fixed-income/fixed-deposits/components/fixed-deposits-的 Module.FixedDeposit (main.js:4274) 初始化之前无法访问“FixedDeposit”细节/固定存款细节.component.ts(固定存款细节.component.ts:21)

现在第 21 行只是指向我在 details 组件上的 @Input 属性:

如果我从我的 FixedDepositsFormComponent 中删除 loadSideNavWithCallback 代码(在保存单击时调用),则没有错误。但我不能取消它,因为我需要该代码来加载详细信息组件。

提前感谢任何帮助。

0 投票
1 回答
77 浏览

javascript - 无法调用外部 js 文件中的 JS 函数 - 未捕获的引用错误

js我有一个小表单,当单击提交按钮时应该运行一个函数。不幸的是,每当单击提交按钮时,我都会在控制台中不断收到错误消息,即未定义该功能。js包含该函数的脚本文件被集成在 body 标记和外部脚本文件的最底部

0 投票
1 回答
69 浏览

javascript - 如何修复此井字游戏的未捕获参考错误

我正在做一个 HTML、CSS、JSS tictactoe 项目,我遇到了一个错误,当我尝试使用 console.log在我的文本编辑器中:


“未捕获的 ReferenceError:未定义 topLeft”
if (topLeft && topLeft === topMiddle && topLeft === topRight) {

我的代码:

我所做的代码似乎与视频相同,所以我不确定为什么会收到此错误。

参考

  • GitHub

教程中的人有他自己的 GitHub,代码在这里输入链接描述

  • YouTube

这将是我目前的流程在此处输入链接描述

我之前发布了一个类似的问题,这是我第一次解决问题。有点担心它可能会再次关闭,所以请让我知道我做错了问题的哪一部分。

0 投票
1 回答
93 浏览

javascript - 未定义的未捕获参考 ID

我正在尝试创建一个按钮来清除这两种形式,如下面的代码所示。我能够弄清楚清除表单的代码仅适用于最后编码的表单。因此,如果我首先输入表单 id zxy 的代码,然后尝试清除表单,我会收到错误消息,但清除表单 id 手动输入的代码有效。但是,如果我将表单 id zxy 的代码粘贴到表单 id manualEntry 下方,则相反。

无论哪种形式在顶部都会收到错误消息“未捕获的引用错误:x 未定义。

希望这很清楚。这是我的代码。

0 投票
0 回答
14 浏览

jquery - 将 Bootstrap 材质导入现有的反应项目

我正在尝试将 Bootstrap Material Design 导入我的反应项目。我对此相当陌生,并尝试了我在互联网和 Stackoverflow 上可以找到的所有内容。每次我尝试导入 Bootstrap Material Design 时,我的浏览器都会收到“ReferenceError: jQuery is not defined”。当我将其注释掉时,它仅在没有材料设计组件的情况下工作。

在此先感谢您的帮助。

0 投票
0 回答
30 浏览

javascript - 使用 fetch() 从 API 获取数据

我第一次使用 fetch() 从 API 获取一些数据:'https://www.codewars.com/api/v1/users/thenarfer'。

我的目标是 console.log 数据。我相信数据是 JSON 格式。

我使用以下代码得到的错误是:Uncaught ReferenceError: data is not defined

POST 或 GET 是正确的方法吗?我如何从这里继续?

0 投票
2 回答
37 浏览

javascript - 未在 javascript 中定义未捕获的引用错误

你好,我是 JavaScript 的初学者。我正在尝试访问 script.js 中 user.js 的功能,但它抛出了错误,我也附加了 ss,下面是我正在做的事情的实现。

我创建了 4 个文件

index.js(起始文件):

home.ejs(在 /views 中):

user.js(在 /utils 中):

script.js(在 /public 中):

在运行这个我得到以下错误

在此处输入图像描述

如何访问 script.js 中的 user.js 函数

0 投票
1 回答
69 浏览

javascript - Prebid.js Uncaught ReferenceError: pbjs is not defined

尽管包含 Prebid.js,但我们仍然收到 Uncaught ReferenceError: pbjs is not defined。https://testdomaininads.ml为整页。

0 投票
1 回答
263 浏览

php - PHP致命错误:未捕获的错误:调用未定义的函数

我最近从旧的 PHP5xx 迁移到 PHP7.4.23 版本,下面是测试 localhost URL 时的错误消息。我可以确认 index.php 已引用包含来自同一文件夹目标的 rightbar.php。如果我删除对 rightbar.php 的引用,那么该网站将完美加载。我不是编码员,但在这方面需要一些很大的帮助。网站错误:`PHP致命错误:

未捕获的错误:调用 C:\inetpub\wwwroot\tamilmelisai\rightbar.php:169 中未定义的函数 getResultBYkeyword() 堆栈跟踪:#0 C:\inetpub\wwwroot\tamilmelisai\index.php(28): include() # 1 {main} 在第 169 行的 C:\inetpub\wwwroot\tamilmelisai\rightbar.php 中抛出`

rightbar.php 的第 169 行代码如下: