Ran npm install for OpenZeppelin CLI 2.7 and oz --version returns 2.6.0

After running the npm install for the 2.7 version. When I check OZ --version - it keeps giving me 2.6.0. @abcoathup

1 Like

What if you run npx oz --version…?

1 Like

oh, there is does show 2.7.1. I checked the node_modules/@openzeppelin/cli/package.json that too shows 2.7.1, but the oz --version, still shows 2.6.0 @spalladino

1 Like

Hi @amateur-dev,

It sounds like you have OpenZeppelin CLI installed globally and locally in your project.

oz --version will show the version installed globally and any oz commands will use the global version.

npx oz --version will show the version installed locally in your project and any npx oz commands will use the local version.

To see what packages you have installed globally you can ask npm to list the global packages (depth 0):

npm ls -g --depth=0

To uninstall the global version, run npm uninstall -g @openzeppelin/cli
To install OpenZeppelin CLI globally, run npm install -g @openzeppelin/cli

I tend to only have ganache-cli installed globally and depending what I am working on OpenZeppelin CLI (see: Installing packages locally rather than globally (npx))

1 Like

Hi @amateur-dev,

I hope that your versions are ok now.
Feel free to ask all the questions that you need.

Yes, all OK. I had a lot of issues because of docker. I work only through docker containers and updating globally is a mess in docker containers. Also, the GitHub for cli mentions that cli should be installed globally.

1 Like

Hi @amateur-dev,

If you get a chance would be interested to know your development environment setup.

Does using nvm help with global installs in docker?

I currently only have ganache-cli installed globally.

1 Like

Yes, nvm does help with global Node Versions inside the docker container. I also wrote my answer in the [dev setup] (What is your smart contract development environment setup?)
What I have done is
(A) base ubuntu docker image
(B) installed, git, node, npm, nvm
© installed ganache-cli global {plus a 1000 other apt install that are needed for keccak, truffle and solc}
(D) installed geth {for ganache-cli fork}

after tons of experimenting and learning came to conclusion that I will HAVE to
(E) install OZ right in this container

docker commit this image

Now use it for my OZ projects as separate containers. Each of these child containers has to go through a lot of mess for updating any global npm package.

Hope this is helpful. More than happy to elaborate more. Thank you.

D

1 Like