无法部署地形与Localterra的合同

发布于 2025-02-01 05:06:13 字数 2003 浏览 5 评论 0原文

我正在尝试部署地形的Terra合同: https:///www.npmjs 。

npx terrain deploy counter --signer validator

错误消息:docker:来自守护程序的错误响应:创建$(pwd):“ $(pwd)”包含本地卷名称的无效字符,仅是“ [a-za-za-z0-9] Z0-9 _.-]“允许。如果您打算通过主机目录,请使用绝对路径。 请参阅“ Docker Run - -Help'。

在互联网上搜索后,我发现问题在于我在Windows 10上运行,因此需要将$ PWD替换为%CD%。 我去了地形库进行文件部署。

child_process_1.execSync(`docker run --rm -v "$(pwd)":/code \
        --mount type=volume,source="$(basename "$(pwd)")_cache",target=/code/target \
        --mount type=volume,source=registry_cache,target=/usr/local/cargo/registry \
        cosmwasm/rust-optimizer-arm64:0.12.5`, { stdio: "inherit" });

因此, )_ cache“,target =/code/target \ 并用%cd%替换$ pwd,我得到以下内容:

child_process_1.execSync(`docker run --rm -v "%cd%":/code \
        --mount type=volume,source=registry_cache,target=/usr/local/cargo/registry \
        cosmwasm/rust-optimizer:0.12.5`, { stdio: "inherit" });

这似乎是在触发构建和部署时工作的。但是,我删除了第二行。如果我添加第二行并以%CD%删除$ PWD,我会得到以下内容:

child_process_1.execSync(`docker run --rm -v "%cd%":/code \
        --mount type=volume,source="%(basename "%cd%")_cache%",target=/code/target \
        --mount type=volume,source=registry_cache,target=/usr/local/cargo/registry \
        cosmwasm/rust-optimizer:0.12.5`, { stdio: "inherit" });

但是,这是行不通的。我会收到以下错误

docker:来自守护程序的错误响应:create%(basename c:\ user \ user \ user \ desktop \ apps \ terra \ terra \ my-dapp \ contracts \ contracts \ contracts \ counter)_cache%:“%(basename c:\ user \ user \ user \ desktop) \ apps \ terra \ my-dapp \ Contracts \ Counter \ Counter) CACHE%“包括本地音量名称的无效字符,仅“ [A-ZA-Z0-9] [A-ZA-Z0-9] > .-]“允许。如果您打算通过主机目录,请使用绝对路径。

这个错误看起来像是我使用$ PWD遇到的类似错误,但是现在“ Basename”是问题所在。但是我不知道如何解决这个问题。谁能帮我吗?

I am trying to deploy a Terra contract of the Terrain: https://www.npmjs.com/package/@terra-money/terrain

In order to deploy the counter contract I need to do the following (I am running on windows 10):

npx terrain deploy counter --signer validator

But when I do this I get the following error:

Error message: docker: Error response from daemon: create $(pwd): "$(pwd)" includes invalid characters for a local volume name, only "[a-zA-Z0-9][a-zA-Z0-9_.-]" are allowed. If you intended to pass a host directory, use absolute path.
See 'docker run --help'.

After searching on the internet I found out that the problem is that I am running on windows 10 and therefore need to replace $pwd by %cd%. So I went into the Terrain library to file deployment.js and found the code responsible for this error:

child_process_1.execSync(`docker run --rm -v "$(pwd)":/code \
        --mount type=volume,source="$(basename "$(pwd)")_cache",target=/code/target \
        --mount type=volume,source=registry_cache,target=/usr/local/cargo/registry \
        cosmwasm/rust-optimizer-arm64:0.12.5`, { stdio: "inherit" });

Now when I remove the second line --mount type=volume,source="$(basename "$(pwd)")_cache",target=/code/target \ and replace $pwd with %cd%, I get the following:

child_process_1.execSync(`docker run --rm -v "%cd%":/code \
        --mount type=volume,source=registry_cache,target=/usr/local/cargo/registry \
        cosmwasm/rust-optimizer:0.12.5`, { stdio: "inherit" });

This seems to work as it triggered a built and a deployment. However, I removed the second line. If I add the second line back and remove $pwd with %cd%, I get the following:

child_process_1.execSync(`docker run --rm -v "%cd%":/code \
        --mount type=volume,source="%(basename "%cd%")_cache%",target=/code/target \
        --mount type=volume,source=registry_cache,target=/usr/local/cargo/registry \
        cosmwasm/rust-optimizer:0.12.5`, { stdio: "inherit" });

This however, doesn't work. I get the following error

docker: Error response from daemon: create %(basename C:\Users\user\Desktop\Apps\Terra\my-dapp\contracts\counter)_cache%: "%(basename C:\Users\user\Desktop\Apps\Terra\my-dapp\contracts\counter)cache%" includes invalid characters for a local volume name, only "[a-zA-Z0-9][a-zA-Z0-9.-]" are allowed. If you intended to pass a host directory, use absolute path.

This error looks like a similar error that I had with $pwd but now 'basename' is the problem. But I have no idea how to solve this problem. Can anyone help me out ?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

走野 2025-02-08 05:06:13

我找到了解决方案。对于那些处于相同情况并且不知道发生了什么以及如何解决的人,我指的是我发布解决方案的链接:

https://github.com/terra-money/terrain/terrain/issues/74

I found the solution. For those in the same situation and don't know what is happening and how to solve it, I refer to this link where I posted the solution:

https://github.com/terra-money/terrain/issues/74

梦开始←不甜 2025-02-08 05:06:13

我认为您的解决方案可能是这样的。您只需要带有定界符支架的变量$ PWD的值即可。

child_process_1.execSync(`docker run --rm -v ${pwd}:/code \
    --mount type=volume,source=registry_cache,target=/usr/local/cargo/registry \
    cosmwasm/rust-optimizer:0.12.5`, { stdio: "inherit" });

I think your solution could have been something like this. You just need the value of the variable $pwd, with delimiter brackets.

child_process_1.execSync(`docker run --rm -v ${pwd}:/code \
    --mount type=volume,source=registry_cache,target=/usr/local/cargo/registry \
    cosmwasm/rust-optimizer:0.12.5`, { stdio: "inherit" });
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文