POST http://localhost:3000/users/getadminlistmsg 404 (Not Found) Uncaught (in promise) ReferenceErro

Uncaught (in promise) error问题排查 从字面意思上看,是“未被发现的错误”,我之前一直觉得既然前端已经拿到后端返回的数据了,那一定是前端的代码写的有问题。但排查了一遍又一遍,仍然没有发现前端代码有什么问题。错误的代码是直接返回了data数据,而加了AjaxResult.success()方法后,报错信息:Uncaught (in promise) error。ConutValue对象很简单,就是从数据库中统计出4个数字。其实前端已经拿到后端返回的数据了。相当于加了个状态码,这样就好了。 阅读详情

项目场景:

POST http://localhost:3000/users/getadminlistmsg 404 (Not Found)
Uncaught (in promise) ReferenceError: Message is not defined
at eval.
提示:这里简述项目相关背景:前后端分离项目,elem+vue+node.js+express


问题描述

提示:这里描述项目中遇到的问题:

在前端调用的是get请求,postman上面测试能够从接口获取数据,但是浏览器返回post失败,我尝试把后端改成post(用postman测试,依然可以得到数据),然后前端不出现POST404了,但是拿不到数据,还是显示后面Uncaught的错误

后端代码:

/* 获取管理员列表 */
static getAdminList(){
return new Promise((resolve,reject)=>{
let sql = "select * from myusers_db where type=3"
this.query(sql).then(result=>{
console.log(result)
resolve(result)
}).catch(err=>{
console.log("数据读取失败")
reject("数据读取失败了!")
})
})
}

/* 获取管理员列表 */
static async getAdminListMsg(req,resp){
let body = req.body
let adminData = await this.getAdminList()
if(adminData.length!=0){
console.log("读取管理员数据成功")
resp.send(adminData)
} else{
console.log(adminData)
console.log(adminData.length)
resp.status(500).send("读取管理员数据失败")
}
}

/* 获取管理员列表接口 */
router.get('/getadminlistmsg',function(req,res){
user.getAdminListMsg(req,res)
})
前端代码
封装的axios
/**

//封装axios方法,为不需要登录操作时使用
@param options 配置
/
let Axios=(options)=>{
axios({
url:options.url,
method:options.method||'POST',
data: options.data,
params: options.data
}).then(result=>{
console.log("成功进入axios")
if (options.success) options.success(result.data)
}).catch(err=>{
let msg = err.response ? err.response.data:'请求异常'
if (options.error){
options.error(msg)
Message.error({message: msg, offset: 150});
}else {
Message.error({message: msg, offset: 150});
}
})
}
Vue.prototype.$axios = Axios

前端页面在created获取数据:
created () {
this.$axios({
url:'/users/getadminlistmsg',
methods:'GET',
data:{},
success:(result)=>{
this.id = result.id
this.type = "管理员"
username = result.username
}
})
},


浏览器返回:
POST http://localhost:3000/users/getadminlistmsg 404 (Not Found)

Uncaught (in promise) ReferenceError: Message is not defined
at eval.

原因分析:

提示:这里填写问题的分析:

例如:未在前端main.js引入message组件,封装的axios有问题


解决方案:

提示:这里填写该问题的具体解决方案:

例如:将存在问题解决即可!

全网超详细解决Uncaught ReferenceError: Vue is not defined的问题,以及dom文档的加载顺序和js ,css,html执行顺序 全网超详细解决Uncaught ReferenceError: Vue is not defined的问题,以及dom文档的加载顺序和js ,css,html执行顺序。$(function(){})和$(document).ready(function(){}的区别。 阅读详情

相关推荐

Uncaught (in promise) Error: timeout of 10000ms exceeded---SpringCloud Alibaba_若依微服务框架改造---工作笔记009

这个错误: 先说说原因,网上的方法都不行,都试过了....因为我的8080端口,被nodejs进程占用了, 我果断,杀掉了nodejs进程,但是,再去启动若依的gateway,发现 11:40:40.340 [reactor-http-nio-2] ERROR c.r.g.h.GatewayExceptionHandler - [handle,56] - [网关异常处理]请求路径:/sockjs-node/418/xmwqatvl/xhr_streaming,异常信息:404 NOT_FOUND g

添柴程序猿的专栏 1万+

报`Uncaught (in promise)`错误解决办法

使用了promise,但是在使用的过程中报错误,第一次遇到这种错误,所以在此记录下,方便以后解决问题只要在 new Promise 后面加上,就不会报错了。

weixin_46721670的博客 7万+

Paraview:Python Calculator Filter

python calculator过滤器 from paraview.simple import * connection = servermanager.Connect('localhost',11111) er = servermanager.sources.EnSightreader(CaseFileName='/.../data.case') er.PointArrays = ['x_velocity','1','y_velocity','1','z_velocity','1','cp','1']

haimianjie2012的专栏 3495

GET http://localhost:8080/xx/xx 404 (Not Found) 和Uncaught (in promise) Error: failed报错的原因

关于vuecli代理服务,明明给服务器发请求,却报错说,GET http://localhost:8080/xx/xx 404 (Not Found) 和Uncaught (in promise) Error: failed,说给本地发请求了

weixin_49931650的博客 4651

【fNIRS可视化学习1】基于NIRS-SPM进行光极可视化并计算通道坐标

设头皮上的目标点为P₀(x₀, y₀, z₀),需要在大脑皮层点集S上找到最合适的投影点P'。

Rose9614的博客 2208

PCA9548实战:从硬件连接到Linux驱动的I2C扩展全解析

本文详细解析了PCA9548 I2C多路复用器从硬件连接到Linux驱动配置的全过程。涵盖硬件引脚连接、电源去耦、地址选择等关键设计要点,以及Linux驱动加载、设备树配置和应用层编程技巧,帮助开发者高效实现I2C总线扩展。

weixin_28726391的博客 410

Vue报错:Uncaught (in promise) ReferenceError Message is not defined at eval

问题: 在封装的请求文件request.js中判断状态码为400时单独引入的element组件Message控制台显示undefined,原因未知; 报错信息如下: 修改前: 解决:

m0_67400972的博客 3948

Conda报错急救指南:遇到Malformed version string ‘~‘怎么办?(附最新解决方案)

本文深度解析Conda报错`Malformed version string '~'`的根源与解决方案。该错误通常由版本字符串解析异常或Conda版本过旧引起。文章提供了从清理缓存、针对性升级到环境重建的完整修复流程,并强调了升级Conda至最新版本是解决此类`CondaValueError`问题的根本方法,帮助开发者高效恢复工作环境。

weixin_28835789的博客 647

Vue报错:Uncaught (in promise) ReferenceError: Message is not defined at eval

问题: 在封装的请求文件request.js中判断状态码为400时单独引入的element组件Message控制台显示undefined,原因未知; 报错信息如下: 修改前: 解决:

小龙爷的博客 1万+

winedt + miktex + SumatraPDF 搭建latex环境

整个环境包含三部分: - winedt: 前端编辑器 - miktex: 后端编译器 - SumatraPDF: 预览器顺序无关紧要, 不过如果先装miktex的话, 可能会被winedt在安装的时候自动找到路径从而不需要设置.1.安装miktex首先在latex-project官网, 打开”get”后, 有四种平台: Linux, Mac OS, Windows, Online. 我写论文

Iteration makes perfection. 6462

PCL 动态半径滤波【2025最新版】

使用PCL实现的2022年最新SCI论文——【Design of Dust-Filtering Algorithms for LiDAR Sensors Using Intensity and Range Information in Off-Road Vehicles】 一文中提出用于自动驾驶点云剔除粉尘、雨雪等影响因素导致的噪声点滤波算法。

点云侠的博客 1472

报错Uncaught (in promise) 以及 nginx 配置后刷新报404

解决方法:在axios.js中,在使用Promise的时候,最后写一行另外:vue.config.js 设置了devServer中的proxy以后,需要,切记。

qi__lu的博客 958

YOLOv8n轻量化实战:10分钟打通实时摄像头目标检测,附参数调优与避坑指南

本文介绍了如何快速入门YOLOv8目标检测框架,通过摄像头实战实现实时检测。YOLOv8凭借轻量化架构和跨平台优势,是新手入门的理想选择。文章详细讲解了环境搭建(1分钟完成)、核心代码逻辑(3分钟掌握)以及性能调优技巧(3分钟进阶),提供可直接运行的代码示例。重点包括:模型选择(优先yolov8n.pt)、摄像头参数优化、置信度阈值调整、检测类别指定等实用技巧,帮助开发者快速实现10-15FPS的实时检测效果,并针对不同场景提供优化建议。

专注于Python爬虫开发,分享爬虫技巧、项目实战与反爬经验,使用Scrapy、BeautifulSoup等工具,解决数据抓取难题。 370

前端向后端发起请求时,报Uncaught (in promise) ReferenceError: ***** is not defined的错

在前端向后端发起请求的时候,接口等都封装好了的。但是报Uncaught (in promise) ReferenceError: getGoods is not defined。

qq_51910659的博客 6675

AI人工智能与数据挖掘的技术融合趋势

我们的目的是搞清楚AI人工智能和数据挖掘是怎么融合在一起的,以及这种融合未来会有什么样的发展趋势。范围涵盖了这两种技术融合的原理、应用场景,还有未来可能面临的挑战。我们会先讲讲AI人工智能和数据挖掘是什么,它们之间有什么关系。然后说说它们融合的算法原理、数学模型。接着通过一个实际的项目案例,看看它们是怎么在实际中运用的。还会介绍一些它们的应用场景和相关工具。最后分析一下未来的发展趋势和挑战,并且总结学到的知识,提出一些思考题让大家思考。AI人工智能。

AI 领航者的博客 1367

NTscan扫描工具

ntscan是一个扫描器,可以扫描没有密码和弱密码的共享,先到配置文件中填写猜测的用户名和密码,扫描过程中右侧出现的是扫描日志。

Uncaught (in promise) 的解决方法,可能原因

// http response 拦截器 service.interceptors.response.use( response => { debugger if (!response.config.noLoading) { closeLoading() } if (response.data instanceof Blob) { return Promise.resolve(response.data) } else if (re.

一点光辉的博客 21万+

efm32 入门.pdf

本PDF共计22页,介绍的是操作驱动API,下载与否自己斟酌。

前台axios发送POST请求报错 404 (Not Found)

前台axios发送POST请求报错 404 (Not Found)

weixin_45436474的博客 3195

深度学习工具包 DeepLearningToolbox

深度学习工具包Deprecation notice.-----This toolbox is outdated and no longer maintained.There are much better tools available for deep learning than this toolbox, e.g. [Theano](http://deeplearning.net/software/theano/), [torch](http://torch.ch/) or [tensorflow](http://www.tensorflow.org/)I would suggest you use one of the tools mentioned above rather than use this toolbox.Best, Rasmus.DeepLearnToolbox================A Matlab toolbox for Deep Learning.Deep Learning is a new subfield of machine learning that focuses on learning deep hierarchical models of data.It is inspired by the human brain's apparent deep (layered, hierarchical) architecture.A good overview of the theory of Deep Learning theory is[Learning Deep Architectures for AI](http://www.iro.umontreal.ca/~bengioy/papers/ftml_book.pdf)For a more informal introduction, see the following videos by Geoffrey Hinton and Andrew Ng.* [The Next Generation of Neural Networks](http://www.youtube.com/watch?v=AyzOUbkUf3M) (Hinton, 2007)* [Recent Developments in Deep Learning](http://www.youtube.com/watch?v=VdIURAu1-aU) (Hinton, 2010)* [Unsupervised Feature Learning and Deep Learning](http://www.youtube.com/watch?v=ZmNOAtZIgIk) (Ng, 2011)If you use this toolbox in your research please cite [Prediction as a candidate for learning deep hierarchical models of data](http://www2.imm.dtu.dk/pubdb/views/publication_details.php?id=6284)```@MASTERSTHESIS\{IMM2012-06284, author = "R. B. Palm", title = "Prediction as a candidate for learning deep hierarchical models of data", year = "2012",}```Contact: rasmusbergpalm at gmail dot comDirectories included in the toolbox-----------------------------------`NN/` - A library for Feedforward Backpropagation Neural Networks`CNN/` - A library for Convolutional Neural Networks`DBN/` - A library for Deep Belief Networks`SAE/` - A library for Stacked Auto-Encoders`CAE/` - A library for Convolutional Auto-Encoders`util/` - Utility functions used by the libraries`data/` - Data used by the examples`tests/` - unit tests to verify toolbox is workingFor references on each library check REFS.mdSetup-----1. Download.2. addpath(genpath('DeepLearnToolbox'));Example: Deep Belief Network---------------------```matlabfunction test_example_DBNload mnist_uint8;train_x = double(train_x) / 255;test_x = double(test_x) / 255;train_y = double(train_y);test_y = double(test_y);%% ex1 train a 100 hidden unit RBM and visualize its weightsrand('state',0)dbn.sizes = [100];opts.numepochs = 1;opts.batchsize = 100;opts.momentum = 0;opts.alpha = 1;dbn = dbnsetup(dbn, train_x, opts);dbn = dbntrain(dbn, train_x, opts);figure; visualize(dbn.rbm{1}.W'); % Visualize the RBM weights%% ex2 train a 100-100 hidden unit DBN and use its weights to initialize a NNrand('state',0)%train dbndbn.sizes = [100 100];opts.numepochs = 1;opts.batchsize = 100;opts.momentum = 0;opts.alpha = 1;dbn = dbnsetup(dbn, train_x, opts);dbn = dbntrain(dbn, train_x, opts);%unfold dbn to nnnn = dbnunfoldtonn(dbn, 10);nn.activation_function = 'sigm';%train nnopts.numepochs = 1;opts.batchsize = 100;nn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.10, 'Too big error');```Example: Stacked Auto-Encoders---------------------```matlabfunction test_example_SAEload mnist_uint8;train_x = double(train_x)/255;test_x = double(test_x)/255;train_y = double(train_y);test_y = double(test_y);%% ex1 train a 100 hidden unit SDAE and use it to initialize a FFNN% Setup and train a stacked denoising autoencoder (SDAE)rand('state',0)sae = saesetup([784 100]);sae.ae{1}.activation_function = 'sigm';sae.ae{1}.learningRate = 1;sae.ae{1}.inputZeroMaskedFraction = 0.5;opts.numepochs = 1;opts.batchsize = 100;sae = saetrain(sae, train_x, opts);visualize(sae.ae{1}.W{1}(:,2:end)')% Use the SDAE to initialize a FFNNnn = nnsetup([784 100 10]);nn.activation_function = 'sigm';nn.learningRate = 1;nn.W{1} = sae.ae{1}.W{1};% Train the FFNNopts.numepochs = 1;opts.batchsize = 100;nn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.16, 'Too big error');```Example: Convolutional Neural Nets---------------------```matlabfunction test_example_CNNload mnist_uint8;train_x = double(reshape(train_x',28,28,60000))/255;test_x = double(reshape(test_x',28,28,10000))/255;train_y = double(train_y');test_y = double(test_y');%% ex1 Train a 6c-2s-12c-2s Convolutional neural network %will run 1 epoch in about 200 second and get around 11% error. %With 100 epochs you'll get around 1.2% errorrand('state',0)cnn.layers = { struct('type', 'i') %input layer struct('type', 'c', 'outputmaps', 6, 'kernelsize', 5) %convolution layer struct('type', 's', 'scale', 2) %sub sampling layer struct('type', 'c', 'outputmaps', 12, 'kernelsize', 5) %convolution layer struct('type', 's', 'scale', 2) %subsampling layer};cnn = cnnsetup(cnn, train_x, train_y);opts.alpha = 1;opts.batchsize = 50;opts.numepochs = 1;cnn = cnntrain(cnn, train_x, train_y, opts);[er, bad] = cnntest(cnn, test_x, test_y);%plot mean squared errorfigure; plot(cnn.rL);assert(er<0.12, 'Too big error');```Example: Neural Networks---------------------```matlabfunction test_example_NNload mnist_uint8;train_x = double(train_x) / 255;test_x = double(test_x) / 255;train_y = double(train_y);test_y = double(test_y);% normalize[train_x, mu, sigma] = zscore(train_x);test_x = normalize(test_x, mu, sigma);%% ex1 vanilla neural netrand('state',0)nn = nnsetup([784 100 10]);opts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samples[nn, L] = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.08, 'Too big error');%% ex2 neural net with L2 weight decayrand('state',0)nn = nnsetup([784 100 10]);nn.weightPenaltyL2 = 1e-4; % L2 weight decayopts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex3 neural net with dropoutrand('state',0)nn = nnsetup([784 100 10]);nn.dropoutFraction = 0.5; % Dropout fraction opts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex4 neural net with sigmoid activation functionrand('state',0)nn = nnsetup([784 100 10]);nn.activation_function = 'sigm'; % Sigmoid activation functionnn.learningRate = 1; % Sigm require a lower learning rateopts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex5 plotting functionalityrand('state',0)nn = nnsetup([784 20 10]);opts.numepochs = 5; % Number of full sweeps through datann.output = 'softmax'; % use softmax outputopts.batchsize = 1000; % Take a mean gradient step over this many samplesopts.plot = 1; % enable plottingnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex6 neural net with sigmoid activation and plotting of validation and training error% split training data into training and validation datavx = train_x(1:10000,:);tx = train_x(10001:end,:);vy = train_y(1:10000,:);ty = train_y(10001:end,:);rand('state',0)nn = nnsetup([784 20 10]); nn.output = 'softmax'; % use softmax outputopts.numepochs = 5; % Number of full sweeps through dataopts.batchsize = 1000; % Take a mean gradient step over this many samplesopts.plot = 1; % enable plottingnn = nntrain(nn, tx, ty, opts, vx, vy); % nntrain takes validation set as last two arguments (optionally)[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');```[![Bitdeli Badge](https://d2weczhvl823v0.cloudfront.net/rasmusbergpalm/deeplearntoolbox/trend.png)](https://bitdeli.com/free "Bitdeli Badge")

LinePhone3.2.7(android端最新版本) sip客户端

SIP客户端For android:LinePhone3.2.7(最新版本),官网地址:http://www.linphone.org/

写react时,axios网络请求报Uncaught (in promise) Error: Request failed with status code 404

写react时,axios网络请求报Uncaught (in promise) Error: Request failed with status code 404,跨域问题,没有写跨域文件。

m0_57255222的博客 2853

Uncaught (in promise) ReferenceError: params is not defined --- 已解决

Uncaught (in promise) ReferenceError: params is not defined

持之以恒 3012

使用element-ui的Message组件遇“Message is not defined”

Vue使用element组件。

m0_59329998的博客 2341

Vue Uncaught (in promise) Error: Request failed with status code 404报错解决

问题描述: Uncaught (in promise) Error: Request failed with status code 404 问题分析: 1、若依RuoYi框架的前台配置的后台端口和实际上后台的端口不一致。 解决办法:找到vue.config.js文件,将target属性配置为实际上的后台地址。 devServer: { host: '0.0.0.0', port: port, open: true, proxy: { // det

旭东怪的博客 7181

微信小程序报错:Uncaught (in promise) ReferenceError: _ is not defined( INC自增自减 MUL 自乘 相关问题)

微信小程序报错:Uncaught(inpromise)ReferenceError:_isnotdefined 解决办法:在你的代码中添加如下代码中 红色部分 //保存授权信息shouquan_type: ture增加1false减少1 save_shouquan_info(openid,shouquan_type,callback){ ...

one312的专栏 1万+

为什么get请求成功,而post请求却失败返回404(not found)

查阅了很多相关资料后,发现都没有这个问题的解决方案。还在想着是不是这个问题太容易了,在一位朋友的帮助下,解决此问题。真是太 low 了,饭要一口一口吃,路要一步一步走啊,基础很重要。 解决方案 后台接口路由设置: 请求设置: 首页返回: 请求成功了 然后我们将请求的方式改为 post 这时候却返回 NOT FOUND 原因分析: 请求确实改了, 但是后台的路由设置没改呀。 最后,希望这篇文章没有辜负大家的期待。 ...

weixin_48573538的博客 3045

Uncaught (in promise) ReferenceError: reject is not defined的出现原因及解决

Uncaught (in promise) ReferenceError: reject is not defined的出现原因及解决

weixin_43858851的博客 2436
下一篇: 后端向数据库更改update数据,用postman调试返回结果Okpacket{},但是数据没存进去。
yusdddd_
博客等级 码龄7年 4粉丝 8原创
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

当前余额3.43元 前往充值 >
需支付:10.00元
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付元
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值