sanity: Command not found

Hello!

I have a problem with running the sanity command. I have installed the Sanity CLI with npm install -g @sanity/cli and when I write sanity init, I get this error message: bash: sanity: command not found

I am using npm version 6.14.4 and node version v12.16.2 I am not quite sure about wath sanity-version it is, but I think it would be the newest one.

About this issue

  • Original URL
  • State: closed
  • Created 4 years ago
  • Reactions: 6
  • Comments: 39 (1 by maintainers)

Most upvoted comments

@danielmartinsen try using npx sanity init

This may be caused by npm not being configured properly, that is, not being part of the path that your shell is looking through when you execute commands. It’s a bit hard to say without more information.

You should be able to use npx @sanity/cli init

Having the same issue here. Using yarn (1.22.4) + lerna (3.20.2) with yarn workspaces.

$ sanity start
/bin/sh: sanity: command not found

Edit: Fixed it. Was missing the @sanity/cli dependency in the package.json after I removed it from global dependencies.

Had the same issue npx @sanity/cli init works for me. is it a thing to bother about npm not being configured properly.

npx @sanity/cli init

npx @sanity/cli start

try this it’s work

@saikat100 @Raqibnur you can try npx sanity start or you can install the CLI using npm install -g @sanity/cli to try the command again. Hopefully, that helps 😄

Also I had a problem while using “javascriptmastery” coupon I used this code line and worked.

npx @sanity/cli init --coupon javascriptmastery2022

npm run start
> sanity start
sh: sanity: command not found

npm run start gives error