skip to Main Content

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:UsersuserDesktopAppsTerramy-dappcontractscounter)_cache%: "%(basename C:UsersuserDesktopAppsTerramy-dappcontractscounter)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 ?

2

Answers


  1. Chosen as BEST ANSWER

    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


  2. 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" });
    
    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search