celo-org / developer-tooling

🛠️ SDKs and CLI for interacting with Celo
Apache License 2.0
9 stars 4 forks source link

Cant run commands from @celo/celocli installed globally #164

Open aaronmgdr opened 4 months ago

aaronmgdr commented 4 months ago

Package

@celo/celocli

Have you ensured that all of these are up to date?

What version of the package are you on?

yarn global add @celo/celocli@4.1.0-contracts-11-post-audit.0

What command or function is the bug in?

celocli config:get

Operating System

None

Describe the bug

when installing globally via yarn an error occurs for all commands.

% nvm use 18.17.0
% npm install -g yarn
% yarn global add @celo/celocli@4.0.0-contracts-11-pre.1
% celocli -v
@celo/celocli/4.0.0-contracts-11-pre.1 darwin-arm64 node-v18.17.0
% celocli governance:withdraw --from=$SIGNER
    TypeError: coreTracing.createTracingClient is not a function
aaronmgdr commented 4 months ago

work arounds seem to be

aaronmgdr commented 4 months ago

originally reported by @martinvol

arthurgousset commented 4 months ago

I successfully installed and used @celo/celocli@4.1.0-contracts-11-post-audit.1 on a brand new virtual machine (via codesandbox.io) using the global NPM option ✅

I ran these exact commands (in case it helps anyone to reproduce and test on a new VM too):

# Node setup
$ nvm install 18.17.0

# Version install
$ npm install -g @celo/celocli@4.1.0-contracts-11-post-audit.1

# Version check
$ celocli -v

# Test command
$ celocli network:contracts -n https://forno.celo.org/

I recorded the entire process as proof (but the video is taking a while to upload with my current WiFi connect). I can upload it if necessary.

arthurgousset commented 4 months ago

On that basis, I don't think this is a general bug with the Celo CLI, and thus not a blocker for governance approvers. Instead, this is a local issue on @martinvol's machine, which I hypothesize has to do with one of the following:

  1. a misconfigured PATH variable that points to the wrong executables for the celocli (that means the installed and executed versions are not the same).
  2. some Nodejs cache issue that leads to a mix up of executed celocli versions
arthurgousset commented 4 months ago

Re 2: You could run npm cache clean --force or yarn cache clean to clean the NPM and yarn caches that may have become corrupted, and could be leading to issues with celocli package versions.

Re 1: You could try to uninstall each celocli installations for each Nodejs version with

  1. list all installed celocli versions given your currently used Nodejs version with npm list -g | grep '@celo/celocli'
  2. uninstall a version npm uninstall -g @celo/celocli@<version>

Why "per Nodejs version"? Because NPM packages are tied to the Nodejs version you used when you install them. For example, you could have @celo/celocli@1.x installed with Nodejs 14, and @celo/celocli@1.x installed with Nodejs 16. In that case, if you are running npm uninstall -g @celo/celocli@1.x on Nodejs 14, you would still have @celo/celocli@1.x installed on Nodejs 14. For example, if you switched to Nodejs 14 with nvm use 14.

arthurgousset commented 3 months ago

Moved it to "This sprint" because it doesn't seem like @martinvol is blocked anymore. If he isn't, we should close this issue. If he is, we should set aside some time to figure out what's wrong with his setup.

Not P0/P1, more like P2, but may as well try to get this out of the way.