Jest vscode拓展运行中的本地化问题
今天遇到了一个奇怪的问题。用vscode拓展运行Jest和直接npx run jest
的结果不同。
今天遇到了一个奇怪的问题。用vscode拓展运行Jest和直接npx run jest
的结果不同。
今天研究了一下JS中的异步迭代。
(void 0) is not a function
在将gatsby-node.js
转换为gatsby-node.ts
之后出现错误:
ERROR #11321 PLUGIN
"gatsby-node.js" threw an error while running the createPages lifecycle:
(void 0) is not a function
File: .cache/compiled/gatsby-node.js:1:1887
TypeError: (void 0) is not a function
如果只看报错内容,这是一个比较隐晦的错误,直接Google没法得到什么有用的信息,Traceback也只有混淆后的代码,给定位错误错误带来困难。不过官方文档中,TypeScript and Gatsby的Current limitations一节中是有提到这个问题的。
require.resolve
You can’t use require.resolve in your files. You’ll need to replace these instances with a path.resolve call.
需要使用path.resolve
替换require.resolve
,就像这样:
+ import path from "path"
+ const template = path.resolve(`src/templates/template.tsx`)
- const template = require.resolve(`./src/templates/template.tsx`)
gpg这个东西实在是太烦人了。愉快地敲完代码准备commit时,一个error: gpg failed to sign the data
把好心情都破坏了。简要记录一下这次的gpg排错流程。
在配置code-server的docker容器时,发现需要增加端口映射作开发用。docker容器在建立后就无法再通过-p
参数更改端口映射,更改端口映射的方法有使用docker commit
后重新docker run
、修改容器的hostconfig.json
等、使用pipework
等。本文记录利用docker network
和nginx来实现改变现有docker容器的端口映射的方法。