Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

npm: Invalid anchor version #925

Closed
fanatid opened this issue Oct 25, 2021 · 20 comments
Closed

npm: Invalid anchor version #925

fanatid opened this issue Oct 25, 2021 · 20 comments

Comments

@fanatid
Copy link
Contributor

fanatid commented Oct 25, 2021

npm package 0.18.0 have invalid anchor binary 😞

$ npm ls @project-serum/anchor-cli
solana-protocol@0.2.0 /home/kirill/projects/x-project
└── @project-serum/anchor-cli@0.18.0

$ npx anchor --version
Package binary version is not correct. Expected "anchor-cli 0.18.0", found "anchor-cli 0.17.0".
Trying globally installed anchor.
Failed to get version of global binary: Error: spawnSync undefined/anchor ENOENT
@fanatid
Copy link
Contributor Author

fanatid commented Oct 25, 2021

We can unpublish v0.18.0 and publish v0.18.1 with #928

@armaniferrante
Copy link
Member

Published @project-serum/anchor-cli v0.18.1.

@fanatid
Copy link
Contributor Author

fanatid commented Oct 26, 2021

Problem moved from 0.18.0 vs 0.17.0 to 0.18.1 vs 0.18.0 😄

$ npx anchor --version
Package binary version is not correct. Expected "anchor-cli 0.18.1", found "anchor-cli 0.18.0".
Trying globally installed anchor.
Failed to get version of global binary: Error: spawnSync undefined/anchor ENOENT

@sorim1
Copy link

sorim1 commented Oct 26, 2021

anchor --version
Package binary version is not correct. Expected "anchor-cli 0.18.1", found "anchor-cli 0.18.0".
Trying globally installed anchor.
Failed to get version of global binary: Error: spawnSync undefined/anchor ENOENT

DISCLAIMER: I'm new and setting up everything related to Solana ecosystem for the first time.
If I understood this thread correctly the error I'm receiving isn't something to fix on my system, and it will be resolved soon.

@armaniferrante
Copy link
Member

Problem moved from 0.18.0 vs 0.17.0 to 0.18.1 vs 0.18.0 smile

$ npx anchor --version
Package binary version is not correct. Expected "anchor-cli 0.18.1", found "anchor-cli 0.18.0".
Trying globally installed anchor.
Failed to get version of global binary: Error: spawnSync undefined/anchor ENOENT

Second time's a charm. I didn't realize the Cargo.toml version had to be set properly when publishing the npm package.

@johnrees
Copy link
Contributor

👍 looks good from here, thanks guys

@fanatid
Copy link
Contributor Author

fanatid commented Oct 27, 2021

0.18.2 works, thanks!

@ElvisWong
Copy link

Can't found the tag v0.18.2 using cargo install. Got this error:

cargo install --git https://github.com/project-serum/anchor --tag v0.18.2 anchor-cli --locked

    Updating git repository `https://github.com/project-serum/anchor`
error: failed to find tag `v0.18.2`

@armaniferrante
Copy link
Member

Can't found the tag v0.18.2 using cargo install. Got this error:

cargo install --git https://github.com/project-serum/anchor --tag v0.18.2 anchor-cli --locked

    Updating git repository `https://github.com/project-serum/anchor`
error: failed to find tag `v0.18.2`

v0.18.2 currently only applies to the NPM package.

@lsbyerley
Copy link

lsbyerley commented Oct 31, 2021

npx anchor --version
Only x86_64 / Linux distributed in NPM package right now.
Trying globally installed anchor.
Globally installed anchor version is not correct. Expected "anchor-cli 0.18.2", found "anchor-cli 0.18.0".

Not entirely sure how I fix this?

I used this install command from the docs

cargo install --git https://github.com/project-serum/anchor --tag v0.18.0 anchor-cli --locked

Do i need to downgrade the cli?

@LUK3ARK
Copy link

LUK3ARK commented Nov 2, 2021

Can't found the tag v0.18.2 using cargo install. Got this error:

cargo install --git https://github.com/project-serum/anchor --tag v0.18.2 anchor-cli --locked

    Updating git repository `https://github.com/project-serum/anchor`
error: failed to find tag `v0.18.2`

I am also getting this error :(

@stenio123
Copy link

Try opening a new terminal tab and working from there. In my case it needed the refresh. Once I did that this sequence of commands worked
#945 (comment)

@Hug0x0
Copy link

Hug0x0 commented Nov 28, 2021

I am getting this error !

cargo install --git https://github.com/project-serum/anchor anchor-cli --locked

Updating git repository `https://github.com/project-serum/anchor`

error: the given reference name 'refs/heads/' is not valid; class=Reference (4)

@melchermaxwell
Copy link

If you tried installing Anchor with npm on a non-x86_64 Linux and it failed, then you installed from source successfully but got the errors above ->
Try uninstalling the npm version with:
npm uninstall -g @project-serum/anchor-cli
Then try using the Anchor CLI. Should work without conflict.

@ngundotra
Copy link
Contributor

@melchermaxwell this worked for me on MacOS... thank you!

@S-Burns
Copy link

S-Burns commented Feb 24, 2022

If you tried installing Anchor with npm on a non-x86_64 Linux and it failed, then you installed from source successfully but got the errors above -> Try uninstalling the npm version with: npm uninstall -g @project-serum/anchor-cli Then try using the Anchor CLI. Should work without conflict.

Using npm uninstall -g @project-serum/anchor-cli with the caveat, instead of using npm to install the CLI, I installed and used the AVM( aka Anchor Version Manager)
with 'cargo install --git https://github.com/project-serum/anchor avm --locked --force'
then ran 'avm install latest'
then 'avm use latest'
then restarted the terminal, which worked for me on Ubuntu WSL / Windows Subsystem Linux, .
Also had to set the path variable in linux.

@suraj1771singh
Copy link

C:\WINDOWS\system32>npx anchor --version
Only x86_64 / Linux distributed in NPM package right now.
Trying globally installed anchor.
Failed to get version of global binary: Error: spawnSync \Users\draco\AppData\Roaming\npm/anchor ENOENT

hey help me out, i new to solana , I am getting above error ever installing cli globally by using cmd
npm i -g @project-serum/anchor-cli
still getting an error.

@fanatid
Copy link
Contributor Author

fanatid commented Apr 27, 2022

anchor-cli works only on linux x86-64

@S-Burns
Copy link

S-Burns commented Apr 27, 2022 via email

@IntikhabKhursheed
Copy link

Error: Anchor version not set. Please run avm use latest.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests