Issue with installing and running Sanity CLI, resolved by using NVM.
11 replies
Last updated: Dec 19, 2021
H
Hello everyone, I just can’t get the sanity cli up and running.
After typing in
I only get the following output
after typing in
After typing in
npm install -g @sanity/cli
changed 1 package, and audited 2 packages in 2s found 0 vulnerabilities
sanityI get the following error message
zsh: command not found: sanity
Dec 19, 2021, 10:08 AM
Looks like your npm binary path is not part of
Not sure how familiar you are with node and npm, but I tend to recommend that people use a node versioning manager like NVM (
https://github.com/nvm-sh/nvm ).
Anyway, you should be able to run
Which should fix it for the current terminal session. Or you can add it to your shell environment for a more long-term solution. (This is usually taken care of during the node.js installation process, though)
$PATHindeed.
Not sure how familiar you are with node and npm, but I tend to recommend that people use a node versioning manager like NVM (
https://github.com/nvm-sh/nvm ).
Anyway, you should be able to run
npm binto see the path that you need to add to your
$PATH. Temporarily you could do something like:
export PATH=$(npm bin):$PATH
Dec 19, 2021, 10:21 AM
H
If I run
I put in my .zshrc file the following line
But the errors stay the same
npm binI get the response
/Users/henryauffahrt/node_modules/.bin
I put in my .zshrc file the following line
export PATH="/Users/henryauffahrt/node_modules/:$PATH"
But the errors stay the same
Dec 19, 2021, 10:32 AM
H
I just installed nvm as you recommend. But the error stays the same 😞
Dec 19, 2021, 10:38 AM
H
I complete throw away my ~/.zshrc config.. it was a mess build up over the years. I also throw away my oh-my-zsh folder. And build up everything new. Currently try to install sanity cli but get an EACCES error. But I don’t want to install it as superuser. Found this documentation to solve it: https://docs.npmjs.com/resolving-eacces-permissions-errors-when-installing-packages-globally
Dec 19, 2021, 11:56 AM
H
There I found this information in the very beginning “Reinstall npm with a node version manager (recommended),”
The same you recommend me. I already installed nvm. But my current session is not using npm over nvm… after type in
The same you recommend me. I already installed nvm. But my current session is not using npm over nvm… after type in
nvm use 16it works!
Dec 19, 2021, 11:58 AM
H
But I’m wondering how could I make sure in a new terminal windows session that it will use the nvm version as default?
Dec 19, 2021, 11:58 AM
H
also on a new terminal windows I need to type in
nvm use16before I can use
sanity
Dec 19, 2021, 12:00 PM
H
This is the solution:
nvm alias default 16
Dec 19, 2021, 12:01 PM
H
Thanks for your help
user Z
!Dec 19, 2021, 12:20 PM
Sanity– build remarkable experiences at scale
Sanity is a modern headless CMS that treats content as data to power your digital business. Free to get started, and pay-as-you-go on all plans.