文章目录
  1. 1. 修改文件权限 chmod 777 filepath
  2. 2. express在发送文件前修改文件,方法使用中间件修改res.write函数
  3. 3. react error
  4. 4. react dom class属性要使用className替换掉
  5. 5. git文件太大或者太多上传失败
  6. 6. charles使用时问题
  7. 7. jquery $(dom).closest(selector) 沿 DOM 树向上遍历,直到找到已应用选择器的一个匹配为止。包括当前元素
  8. 8. 输入法回车问题
  9. 9. express.listen之后还能增加app.use或者app.get吗?

修改文件权限 chmod 777 filepath

express在发送文件前修改文件,方法使用中间件修改res.write函数

1
2
3
4
5
6
7
8
9
10
11
12
app.use(function (req, res, next) {
var write = res.write;
res.write = function (chunk) {
if (~res.getHeader('Content-Type').indexOf('text/html')) {
chunk instanceof Buffer && (chunk = chunk.toString());
chunk = chunk.replace(/(<\/body>)/, "<script>alert('hi')</script>\n\n$1");
res.setHeader('Content-Length', chunk.length);
}
write.apply(this, arguments);
};
next();
});

react error

1
Uncaught Error: Invariant Violation: addComponentAsRefTo(...): Only a ReactOwner can have refs. You might be adding a ref to a component that was not created inside a component's render method, or you have multiple copies of React loaded (details: https://fb.me/react-refs-must-have-owner).

原因: 项目文件夹需要安装react,并且引用react时注意大小写,引入react时对大小写敏感,否则会加载多个版本的react

react dom class属性要使用className替换掉

git文件太大或者太多上传失败

  • git config –global http.postBuffer 999999999

charles使用时问题

jquery $(dom).closest(selector) 沿 DOM 树向上遍历,直到找到已应用选择器的一个匹配为止。包括当前元素

输入法回车问题

express.listen之后还能增加app.use或者app.get吗?

文章目录
  1. 1. 修改文件权限 chmod 777 filepath
  2. 2. express在发送文件前修改文件,方法使用中间件修改res.write函数
  3. 3. react error
  4. 4. react dom class属性要使用className替换掉
  5. 5. git文件太大或者太多上传失败
  6. 6. charles使用时问题
  7. 7. jquery $(dom).closest(selector) 沿 DOM 树向上遍历,直到找到已应用选择器的一个匹配为止。包括当前元素
  8. 8. 输入法回车问题
  9. 9. express.listen之后还能增加app.use或者app.get吗?