Attempting to use 'sanity start' CLI results in 'command not found' - sanity

npm install -g #sanity/cli
sanity init
$ sanity start
bash: sanity: command not found
How can i solve it?

If the installation was successful, it could be that the Sanity CLI wasn't added to your path. Which operating system are you on? If Mac or Linux, running which sanity in your terminal should show a path like /usr/local/bin/sanity. Running echo $PATH in your terminal, you would need to see /usr/local/bin somewhere in that path.

Related

I installed yarn globally, but got error "zsh:command not found : yarn"

npm install -g yarn
> yarn#1.22.15 preinstall /Users/myname/.npm-global/lib/node_modules/yarn
> :; (node ./preinstall.js > /dev/null 2>&1 || true)
/Users/myname/.npm-global/bin/yarn -> /Users/myname/.npm-global/lib/node_modules/yarn/bin/yarn.js
/Users/myname/.npm-global/bin/yarnpkg -> /Users/myname/.npm-global/lib/node_modules/yarn/bin/yarn.js
+ yarn#1.22.15
As I use a mac, I opened the zshrc file.
and then write the code below
export PATH=$PATH:/Users/myname/.npm-global/lib/node_modules/yarn
However, when I entered the yarn --v command, I got the same error as the title.
Could you please tell me what the problem is? What should I do when I have installed a variable globally?
Add the global npm bin to PATH instead:
export PATH="$PATH:$(npm bin -g)"
In your case, this is the same as:
export PATH="$PATH:/Users/myname/.npm-global/bin"
Here is what worked for me on the Mac OS Monterey 12.3.1
npm install -g yarn
npm config get prefix
My command output was: /Users/my_username/.npm-packages
Append that in your /etc/paths using nano
Open up Terminal.
Run the following command:
sudo nano /etc/paths
Enter your password, when prompted.
Go to the bottom of the file, and enter the path you wish to add.
Hit control-x to quit.
Enter “Y” to save the modified buffer.
That’s it! To test it, in new terminal window, type:
echo $PATH
You will see /Users/my_username/.npm-packages/bin appended to your path
Yarn should now work
yarn --version
You will see 2.4.x

Truffle command not found after installation

I installed truffle through npm with the following:
sudo npm install -g truffle
but when I run truffle list on the console it just gives me
bash: truffle: command not found
I had a similar problem. I ran npm i -g truffle and then when I tried to run truffle init I got an error: zsh: command not found: truffle. What solved it for me is to create a local node_modules with truffle installed in it, and then run that copy.
run npm init and make a new npm project
run npm i truffle
run ./node_modules/.bin/truffle init and it should work!
Please make sure you have the latest version of npm and node installed. I had the same issue, I updated npm and node to latest version and it worked.
npm install -g truffle works.
After installing truffle:
npm install -g truffle
Run on your project folder:
npx truffle init
I did it on a Virtual box and had the same issue, but it worked after I restarted the computer. Hopefully that works for you too
You should add the following to your path system variable.
C:\Users\UserName\AppData\Roaming\npm
(This folder contains the truffle.cmd file)
I have tried and it works.
I tried everything. Followed the instruction on official truffle website and above answers.
Still it didn't seem to worked.
Finally, this worked for me.
Go to C:\Users\Username\AppData\Roaming\npm
There you will find truffle.cmd Double click on it and your done.
npm i truffle does the exact same thing as npm install -g truffle except that installs it globally, and without -g it will be installed on the local folder. Try to update the npm, node, and probably you have a broken node installation from previous versions.
Using npm install -g truffle worked for me instead of npm i truffle
Nothing above worked for me, but I did:
nix truffle unbox react
truffle develop
atom . //opens up the react file project in the atom platform
Try to start with your command like
npx truffle <your command>
You should add C:\Users\UserName\AppData\Roaming\npm (it contains truffle.cmd file) to the path user variables. I have tried and it works
If you have a custom path for your packages, then make sure that you are exporting it when the terminal loads.
For bash:
nano ~/.profile
For zsh:
nano ~./zshrc
And add your custom path, most of the time this will be "npm-global".
export PATH=~/.npm-global/bin:$PATH
These are two simple steps the properly solve this problem for Linux Users:
1- Configure npm to install software globally in your home directory as follows :
mkdir ~/.npm-global
npm config set prefix '~/.npm-global'
2- If you are using bash, then execute the following:
echo -n "export PATH=~/.npm-global/bin:$PATH" >> ~/.profile
However, if you are using zsh instead, then execute the following command:
echo -n "export PATH=~/.npm-global/bin:$PATH" >> ~/.zshrc
Note that, if you are using both bash and zsh, it is better to execute the two commands above.

I can see that nvm and npm is not installed after succesfull installation

I am installing nvm and npm like this:
curl https://raw.githubusercontent.com/creationix/nvm/v0.11.1/install.sh | bash
echo "[[ -s $HOME/.nvm/nvm.sh ]] && . $HOME/.nvm/nvm.sh" >> /home/deployer/.profile
source /home/deployer/.profile
# source ~/.nvm/nvm.sh
nvm install v0.12.9
nvm use v0.12.9
nvm alias default v0.12.9
curl -L https://npmjs.org/install.sh | sh
with bash and clearly see a successfull installation ("It worked" prompt), but after it stops and I type nvm or npm in the console I get:
No command 'nvm' found, did you mean:
The program 'npm' is currently not installed.
If I write this in the console:
source /home/deployer/.profile
nvm starts working, but why I need to repeat this process, not sure.
This suggests that your shell is not sourcing .profile for you. Perhaps you're using a non-login shell; perhaps your OS sources a different file when logging in.
What happens if you add . $HOME/.profile to your .bashrc, for example?

How to npm install with git-bash/mingw32 on win7

I am using git-bash/mingw32 on win7. I am trying to install npm:
$ npm install
sh: npm: command not found.
Git-bash is working normally and is installed correctly. How can I make this work?
There is a couple of reasons for this behaviour:
1) npm not installed
2) npm not in %PATH%
You can add npm to %PATH% by running cmd (win+r -> cmd) as administrator and execute:
SET PATH=%PATH%;c:\here\is\path\to\npm\dir
After that — try run npm again.
while installing node.js when click the set path option.
check system environment path.
# echo $PATH
and see if there is npm/node in it. if not, added them to the system environment.
# set PATH=%PATH%;d:/node/;
mostly reinstall node check the right option will fix this, and update dev env btw.
Another possible reason (if node was installed by Visual Studio): a missing npm bash script.
There is an npm.cmd bath file in the path:
C:\Program Files (x86)\Microsoft Visual Studio 14.0\Web\External\npm.cmd
But git bash wont run .cmd files. So you need to create a bash script for npm.
Create the following file named npm in your node folder: (C:\Program Files (x86)\Microsoft Visual Studio 14.0\Web\External\)
#!/bin/sh
basedir=`dirname "$0"`
case `uname` in
*CYGWIN*) basedir=`cygpath -w "$basedir"`;;
esac
if [ -x "$basedir/node" ]; then
"$basedir/node" "$basedir/node_modules/npm/bin/npm-cli.js" "$#"
ret=$?
else
node "$basedir/node_modules/npm/bin/npm-cli.js" "$#"
ret=$?
fi
exit $ret

Urturn API ur: command not found

I am trying to install urturn api and write my own expression for urturn.com
following http://webdoc.github.com/urturn-expression-api/#!guides/start
After:
npm install urturn-toolbelt -g
I am trying to run sandbox with:
ur sandbox
and got error:
-bash: ur: command not found
Please help
P.S. I am on Mac Os
thanks
It is likely your nodeJS npm/bin folder that is not included in your PATH.
Can you check your PATH variable?
Node NPM package bin files are all symlinked in the same ./bin folder. If you installed NodeJS using Homebrew (brew install node), it should be /usr/local/share/npm/bin.
You can echo your current path using:
echo $PATH
If the folder above does not appear in the list, check your .bashrc or .bash_profile files and fix any problem.
A fix that is likely to work is to add the following line in ~/.bash_profile
PATH=$PATH:/usr/local/share/npm/bin