
node
当代词圣李白
这个作者很懒,什么都没留下…
展开
-
egg Cannot find module ‘diagnostics_channel‘
出现 Cannot find module 'diagnostics_channel'原创 2022-10-30 12:05:16 · 3434 阅读 · 1 评论 -
修改 node_modules 依赖包
第一步安装依赖npm i patch-package第二步修改package.json,添加命令package.json"scripts": { "postinstall": "patch-package"}第三步修改源码(以element-ui为例)第四步 生成补丁yarn patch-package package-name(修改的包名)或者npx patch-package package-name(npm版本 > 5.2)第五步 测试补丁是否有效手动删除n翻译 2021-12-29 09:59:57 · 538 阅读 · 0 评论 -
egg-sequelize update +1
// service/xx.jsconst { literal } = require("sequelize");await app.model.xx.update( { total: literal("total + 1"), }, { where: { id:1, }, });原创 2021-07-27 22:32:55 · 751 阅读 · 0 评论 -
node 访问本地127.0.0.1 ENOTFOUND
参考文章地址正确写法var optionsget = { host : 'localhost', port : 3010, path : '/quote/random', // the rest of the url with parameters if needed method : 'GET' // do GET};把http 去掉试试,错误写法var optionsget = { host : 'http://localhost', por原创 2021-04-16 22:58:11 · 489 阅读 · 0 评论 -
egg 文件中转下载
后台代码:controller: const fs = require('fs'); const path = require('path'); var request = require('request'); async downLoad() { const { ctx } = this; let url = ctx.query.url || null; function downloadFile(url, filename, callback) { v原创 2020-06-03 14:16:12 · 1159 阅读 · 0 评论 -
node css js img 请求失败
总结一句话:需要设置静态文件目录这里以express 框架为例:const express = require(‘express’);const app = express();const io = require(‘socket.io’)const fs = require(‘fs’)app.use(express.static(“public”));app.get(’/’, f...原创 2019-07-28 16:34:56 · 212 阅读 · 0 评论