项目中遇到的bug、问题总结
1. Cannot set property 'captcha' of undefined
在node项目中使用svg-captcha生成验证码报错
captcha的代码,这里有一个session.captcha,检查app.js,发现session没设置
exports.captcha = async(req, res, next) => {
// 创建验证码
const captcha = svgCaptcha.create()
// 验证码文本
req.session.captcha = captcha.text
// 设置响应内容类型
res.type('svg') // 使用ejs等模块时如果报错 res.type('html)
res.status(200).send(captcha.data)
}
在app.js中加入session就可以了
const express = require('express')
const app = express()
const session = require('express-session')
app.use(session({
secret: 'keyboard cat',
resave: false,
saveUninitialized: true
}))
这种错误一般是没定义属性引起的,检查一下使用的变量是否都有引入
2.Module build failed: Error: ENOENT: no such file or directory, open 'xxxxxxxxx'
切换分支后报找不到文件的错误
这种情况一般是你切换分支后你的小伙伴修改了代码提交,你切回来之后就有可能读不出修改的文件
这时候强制使用远程分支覆盖本地分支就可以了
git fetch --all
git reset --hard origin/master 这里是写你用来覆盖的分支名称,一般就是你当前所在的分支
git pull
3../node_modules/_css-loader@0.28.11@css-loader??ref--11-1!./node_modules/_postcss-loader@2.1.6@postcss-loader/lib??ref--11-2!./node_modules/_sass-loader@7.1.0@sass-loader/lib/loader.js??ref--11-3!./src/components/main/financingManagement/financing/creditFrom/from.scss Module build failed: undefined ^ Media query expression must begin with '(' in E:\Project\F2B_v3.0\src\components\main\financingManagement\financing\creditFrom\from.scss (line 3, column 3)
在项目中引入scss文件报错,
(function (exports, require, module, __filename, __dirname) { import { check, validationResult } from '_express-validator@5.3.1@express-validator/check';
在项目中引入资源错误 ,在项目中是这样写的,这样会报错
const express = require('express')
const questionCtrl = require('../controller/question.js')
const router = express.Router()
router
.get('/questions/new', questionCtrl.showNew)
module.exports = router //router需要导出
Refused to apply style from '<URL>' because its MIME type ('text/html') is not a supported stylesheet MIME type, and strict MIME checking is enabled..
在node项目中打开页面报错
这是因为解析静态资源错误,检查一下静态资源的引入路径是否正确,然后重启一下项目,有时候不重启项目,这些解析资源的工作不会更改
7.
Cannot destructure property `user` of 'undefined' or 'null'
页面报错
这种是把一个对象结构赋值时报错的,原因是req.cookies没有值,
$ vue -V
bash: vue: command not found
找不到vue模块
解决: npm install -g vue
npm install -g vue-cli
npm install -g vue-cli
npm WARN deprecated coffee-script@1.12.7: CoffeeScript on NPM has moved to "coffeescript" (no hyphen)
安装vue-cli报错
j解决: npm i -g coffeescript
npm install -g vue-cli
运行效果:
$ vue -V
2.9.6
完成!
9.
vue create vuex-api
vue create is a Vue CLI 3 only command and you are using Vue CLI 2.9.6.
You may want to run the following to upgrade to Vue CLI 3:
npm uninstall -g vue-cli
npm install -g @vue/cli
使用vue创建项目报错,create只支持vue cli 3版本,按照提示,卸载姐版本,npm uninstall -g vue-cli安装新版本 npm install -g @vue/cli
npm install -g @vue/cli
npm WARN deprecated cross-spawn-async@2.2.5: cross-spawn no longer requires a build toolchain, use it instead
安装新版本vue-cli报错,
解决方法: cnpm install -g @vue/cli
重新运行
$ vue create vuex-api
? Your connection to the default yarn registry seems to be slow.
Use https://registry.npm.taobao.org for faster installation? (Y/n)
创建项目成功!
项目中遇到的bug、问题总结的更多相关文章
- SpringBoot项目中遇到的BUG
1.启动项目的时候报错 1.Error starting ApplicationContext. To display the auto-configuration report re-run you ...
- 项目中遇到的bug
1. babel编译转换时发生了报错: BabelLoaderError: SyntaxError: Unexpected token babel预置的转换器是 babel-preset-es2015 ...
- Maven 配置tomcat和findbug插件(在eclipse建立的项目中)
tomcat插件 a) tomcat的maven插件可以在tomcat的官网上寻找,这就是tomcat插件的plugin b) 将tomcat的plugin配置到项目的po ...
- Go1.13 标准库的 http 包爆出重大 bug,你的项目中招了吗? 原创: 王亚楼 Go语言中文网 今天
Go1.13 标准库的 http 包爆出重大 bug,你的项目中招了吗? 原创: 王亚楼 Go语言中文网 今天
- 项目中容易出现的BUG预警
之前没有记录BUG的习惯导致在同一个坑里边栽了好几次,于是将最近几个项目中遇到的问题整理一下,在进行新项目时预警一遍: 使用携带有搜索功能的分页查询时,注意当用户更改了查询条件但没有点击查询按钮直接点 ...
- 解决webpack项目中打包时候内存溢出的bug JavaScript heap out of memory
vue 项目 npm run dev 的时候一直卡住不动:后来找到报错是 Ineffective mark-compacts near heap limit Allocation failed - J ...
- 企业应用开发模式 ERP项目中应用到的技术和工具
一.基础技术选型 C# .NET 3.5/4.0 这两个版本的.NET已经相当方便(Linq, Lambda,Parallel),语法简洁,配合WCF和WF两项技术,可以满足快速开发,维护方便的目标 ...
- JSPatch来更新已上线的App中出现的BUG(超级详细)
JSPatch的作用是什么呢? 简单来说:(后面有具体的操作步骤以及在操作过程中会出现的错误) 1.iOS应用程序上架到AppStore需要等待苹果公司的审核,一般审核时间需要1到2周.虽然程序在上架 ...
- 多War项目中静态文件的共享方案
[原创申明:文章为原创,欢迎非盈利性转载,但转载必须注明来源] 在互联网产品中,一般会有多个项目(Jar.WAR)组成一个产品线.这些WAR项目,因为使用相同的前端架构(jQuery.easyui等) ...
随机推荐
- [GO]使用select实现超时
package main import ( "fmt" "time" ) func main() { ch := make(chan int) quit := ...
- python 函数星号参数说明
转自: python 函数参数的传递(参数带星号的说明) python中函数参数的传递是通过赋值来传递的.函数参数的使用又有俩个方面值得注意:1.函数参数是如何定义的 2.在调用函数的过程中参数是如何 ...
- C#调用windows命令行(CMD)
using System.Diagnostics; public static void StartCmd(String command){Process p = new Process();p.St ...
- Android-Application来传递数据
在上一篇博客中介绍到,Android-Intent意图传递数据,能够传递基本数据类型系列,能够传递对象(需要序列化),等操作: 但是如果要传递 List<T>,这种类型的数据,就不能通过I ...
- [LeetCode 题解]: pow(x,n)
前言 [LeetCode 题解]系列传送门: http://www.cnblogs.com/double-win/category/573499.html 1.题目描述 Implement po ...
- [LINK]List of .NET Dependency Injection Containers (IOC)
http://www.hanselman.com/blog/ListOfNETDependencyInjectionContainersIOC.aspx I'm trying to expand my ...
- Python 单元测试 增强系统健壮性
问题背景交代 注意,JulyNovel只爬取免费小说,所有vip章节全部导航至起点网站,遵循robots协议,所有数据仅供学习用途,侵删 通过编写单元测试,提高JulyNovel系统可靠性 首先我们知 ...
- Re:从零开始的Spring Security Oauth2(一)
前言 今天来聊聊一个接口对接的场景,A厂家有一套HTTP接口需要提供给B厂家使用,由于是外网环境,所以需要有一套安全机制保障,这个时候oauth2就可以作为一个方案. 关于oauth2,其实是一个规范 ...
- 高性能无锁队列 Disruptor 初体验
原文地址: haifeiWu和他朋友们的博客 博客地址:www.hchstudio.cn 欢迎转载,转载请注明作者及出处,谢谢! 最近一直在研究队列的一些问题,今天楼主要分享一个高性能的队列 Disr ...
- 不可逆转(SDOI2010地精部落)
提供一个简单一点的思路,不需要滚动数组,也不需要一些奇奇怪怪的性质. 我们考虑设\(f[i]\)为\(1\)到\(i\)中有多少种波动数列. 我们可以注意到,波动数列分为先降后升和先升后降两种,但是我 ...