我真的很想尝试使用VSCode扩展名的ksonnet,但似乎无法正确设置所有内容,并且我已经阅读了设置说明。
我已经执行以下操作:
brew install ks
brew install jsonnet
ks init traefik
git clone https://github.com/ksonnet/ksonnet-lib.git
ksonnet-lib
添加到设置:
"jsonnet.libPaths": ["/Users/kross/projects/gke/ksonnet-lib"],
traefik
文件夹(不推荐使用,但想知道根路径的解析)这是我看到的错误:
RUNTIME ERROR: couldn't open import "base.libsonnet": no match locally or in the Jsonnet library paths.
Can't find path 'base.libsonnet'. If the file is not in the current directory, it may be necessary to add it to the 'jsonnet.libPaths'. If you are in vscode, you can press 'cmd/ctrl-,' and add the path this library is located at to the 'jsonnet.libPaths' array
注意:预览窗格确实适用于ks generate deployed-service
文件,但是
预览窗格不适用于tutorial redis
实例(但是ks show default
有效):
Command failed: jsonnet -J /Users/kross/projects/gke/ksonnet-lib --ext-code-file "__ksonnet/params"=/Users/kross/projects/gke/traefik/components/params.libsonnet --ext-code-file "__ksonnet/environments"=/Users/kross/projects/gke/traefik/environments/default/params.libsonnet /Users/kross/projects/gke/traefik/components/redis.jsonnet
RUNTIME ERROR: couldn't open import "k.libsonnet": no match locally or in the Jsonnet library paths.
/Users/kross/projects/gke/traefik/components/redis.jsonnet:4:11-31 thunk
/Users/kross/projects/gke/traefik/components/redis.jsonnet:18:11 thunk
std.jsonnet:1239:24
std.jsonnet:1239:15-26 thunk
std.jsonnet:1240:8 thunk
std.jsonnet:1240:8-20 function
std.jsonnet:1240:8-20 function
/Users/kross/projects/gke/traefik/components/redis.jsonnet:(18:1)-(22:4)
我必须错过一些非常基本的东西-这是什么?
答案 0 :(得分:1)
使用VScode JSONNET扩展时,我遇到了类似的错误。参见此处:https://github.com/heptio/vscode-jsonnet/issues/57
我可以通过修改“用户设置”中扩展名的设置来解决此问题:
"jsonnet.libPaths": [
"<my-home-dir-full-path>/go/src/github.com/ksonnet/ksonnet-lib/ksonnet.beta.3"
],
此外,请注意,ksonnet团队目前正在开发官方的ksonnet VSCode扩展。