我正在尝试使用 UNPKG 作为 CDN导入 Vue.js 组件(@chenfengyuan/vue-qrcode)。
目前,我的设置是这样工作的:
<script src="https://cdn.jsdelivr.net/npm/vue@2.6.0"></script>
<script src="https://unpkg.com/@chenfengyuan/vue-qrcode@1.0.1/dist/vue-qrcode.min.js"></script>
<script>Vue.component(VueQrcode.name, VueQrcode);</script>
<script type="module" src="/client.js"></script>
Run Code Online (Sandbox Code Playgroud)
在我的client.js文件中,我有我的 Vue 实例:
new Vue({
el: "#app",
data: {
msg: "Vue js Hello World - Your First Vue.js App"
}
});
Run Code Online (Sandbox Code Playgroud)
我想要实现的设置是这样的:
<script type="module" src="/client.js"></script>
Run Code Online (Sandbox Code Playgroud)
然后我client.js会看起来像这样:
import Vue from 'https://cdn.jsdelivr.net/npm/vue@2.6.10/dist/vue.esm.browser.js'
import VueQrcode from 'https://unpkg.com/@chenfengyuan/vue-qrcode@1.0.1/dist/vue-qrcode.min.js'
Vue.component(VueQrcode.name, VueQrcode);
new Vue({
el: "#app",
data: {
msg: "Vue js Hello World - Your First Vue.js App"
}
});
Run Code Online (Sandbox Code Playgroud)
Vue 模板(嵌入在 HTML 中)如下: …
我正在尝试使用https://github.com/elastic/stack-docker在 docker 中构建 ELK
但我只需要 Elasticsearch、Kibana 和 Logstash,所以我删除了所有 apm_server、filebeat 等内容。
然后,运行命令:
docker-compose -f setup.yml up
返回以下输出:
之后,每个 docker-compose 命令都抛出相同的错误:
错误:命名卷
"es_data:/usr/share/elasticsearch/data:rw"用于服务,"elasticsearch"但未在卷部分找到声明。
我的setup.yml是这样的:
version: "3.6"
services:
setup:
image: docker/compose:1.21.2
working_dir: "${PWD}"
cap_add: ['SYS_ADMIN']
environment:
- "PWD=${PWD}"
- "ELASTIC_PASSWORD"
- "ELASTIC_VERSION"
- "TAG"
volumes:
- "/var/run/docker.sock:/var/run/docker.sock"
- "${PWD}:${PWD}"
entrypoint: ["/bin/ash", "-c"]
command: ['cat ./scripts/setup.sh | tr -d "\r" | ash']
# command: ["./scripts/setup.sh"]
Run Code Online (Sandbox Code Playgroud)
还有我的 docker-compose.yml:
---
version: '3.6'
services:
# The environment variable "TAG" …Run Code Online (Sandbox Code Playgroud) How do you write a writeFile() function without a callback?
This does not work:
fs.writeFile("/logs/file.log", 'Message')
fs.writeFile("/logs/file.log", 'Message',null)
Run Code Online (Sandbox Code Playgroud)
Both throw a:
TypeError [ERR_INVALID_CALLBACK]: Callback must be a function
Run Code Online (Sandbox Code Playgroud)
I need to implement a non-blocking solution.