Go moq : running "moq": exec: "moq": executable file not found in $PATH - linux

when trying the example of the moq framework, I get the following exception when I enter "go generate":
example.go:5: running "moq": exec: "moq": executable file not found in $PATH
What should I do? I'm using Kubuntu 16.04
PS: I tried
export PATH=$PATH:/home/[...]/go/src/github.com/matryer/moq
without success

#sprabhakaran got the right answer. I only needed to add the go binary folder to the PATH global variable:
export PATH=$PATH:/home/[...]/go/bin
and if it doesn't work, check that moq was correctly installed.

First, install using the following command:
go install github.com/matryer/moq#latest
Go binary should be added to the global PATH
export PATH=$PATH:$HOME/go/bin
worked for me on MAC

Related

CompileDaemon "command not found" Not using docker

I hade CompileDaemon working in my golang app before, but it stopped working on my WSL Ubuntu. I tried everything to get it working, and then reinstalled WSL switching to Debian. I am not using docker. I then tried things again and it still says command not found even after installing it two different ways:
go get github.com/githubnemo/CompileDaemon
go: added github.com/fatih/color v1.9.0
go: added github.com/fsnotify/fsnotify v1.4.9
go: added github.com/githubnemo/CompileDaemon v1.4.0
go: added github.com/mattn/go-colorable v0.1.4
go: added github.com/mattn/go-isatty v0.0.11
go: added github.com/radovskyb/watcher v1.0.7
go: added golang.org/x/sys v0.0.0-20191026070338-33540a1f6037
OR
go install -mod=mod github.com/githubnemo/CompileDaemon
Then when I run CompileDaemon --command="./folder_name"
returns:
bash: CompileDaemon: command not found
I face the same issue, here is how I solve it.
It seems that GOPATH is not added to ENVIRONMENT VARIABLE as expected.
vim ~/.zshrc
...
export GOPATH="/Users/YOUR_PROFILE_NAME/go" # set GOPATH
export PATH=$PATH:$GOPATH/bin. # append GOPATH to PATH
don't forget to
source ~/.zshrc

mac - az command not found azure

I am trying to install Azure CLI 2.0 on my mac. I followed official documentation but facing this error.
bash: az: command not found
How can I fix this error on mac?
rather than following this link
https://learn.microsoft.com/en-us/cli/azure/get-started-with-azure-cli
I suggest to install using home-brew on mac. Its simpler
brew update && brew install azure-cli
ref:
https://learn.microsoft.com/en-us/cli/azure/install-azure-cli-macos
I hit the same issue.
Search around for how to create a ".bash_profile" file.
This file usually (always?) exists at /Users/myusername/ folder
Then you will either create this file or edit this file.
Here is a "before" and "after" of my ".bash_profile".
export PATH=$PATH:/Applications/Terraform
export M2_HOME=/Users/shollid3/apache-maven-3.6.0
export PATH=$PATH:$M2_HOME/bin
and after
export PATH=$PATH:/Applications/Terraform
export PATH=$PATH:/usr/local/homebrew/bin
export M2_HOME=/Users/shollid3/apache-maven-3.6.0
export PATH=$PATH:$M2_HOME/bin
Obviously, the addition is
/usr/local/homebrew/bin
Use "where is" to (drum roll) find out where your "az" exists on your computer.
My "paper trail" was:
this below url
https://learn.microsoft.com/en-us/cli/azure/install-azure-cli-macos?view=azure-cli-latest
led me to this below url:
https://docs.brew.sh/Installation.html
and eventually, that is how I got "az" installed to /usr/local/homebrew/bin
But regardless of where you have your "az", you can see how to add/edit bash_profile to get the path pointed to where you "az" is.
Try the following command, or simply close and restart the Terminal session:
exec -l $SHELL
If that does not fix the issue, please share the output of your PATH variable by running
echo $PATH

Unable to access Node on Mac - command not found

I am getting the following response when I try to access node from terminal
node:command not found
I researched and found that I have to set PATH. I tried the following:
export PATH="/usr/local/bin/node:$PATH">> ~/.profile
It runs (I assume since the terminal doesn't return anything). But when I echo the path I get the following response
export PATH=/usr/local/bin/node:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/Users/arihantjain/NVPACK/android-sdk-macosx/platform-tools:/Users/arihantjain/NVPACK/android-sdk-macosx/tools:/Users/arihantjain/NVPACK/apache-ant-1.8.2/bin
Clearly, I think the path isn't getting set. How can I do that? If not, is there a way to change the default installation directory of node. I used the .pkg installer to install Node.

teach me how to set up a path correctly

I installed casperjs by npm install command on my mac os x.
But, when I try using casperjs in command line, it gives me the error below.
$ casperjs cas.js
-bash: /usr/local/bin/casperjs: No such file or directory
I checked if casperjs is installed by using which command.
The result is below.
$ which casperjs
-bash: /Users/Hayato/.nodebrew/current/bin/casperjs
I think what I need to do is to setup a path in a different way so that when I run "casperjs test.js", it runs "/Users/Hayato/.nodebrew/current/bin/casperjs" instead of "/usr/local/bin/casperjs".
But, I'm not familiar with this kind of terminal task, and don't know how to do this.
Please could anyone teach me how to setup a path correctly?
Thanks!
If you want to use casperjs in the directory you specified, add this to your ~/.bash_profile
export PATH=/Users/Hayato/.nodebrew/current/bin/:$PATH
Save the file
That will add all scripts in the /Users/Hayato/.nodebrew/current/bin directory to your path.
After that.. close the terminal and then reopen it:
You can check the path by doing:
echo $PATH
You should see the path you just added.
Then when you do the following:
which casperjs
it should use the new location.
Let me know if this works for you!
But, the issue may be something deeper, did you get errors when you installed casperjs via brew?
You may want to try linking it again using
brew link casperjs
If that doesn't work you may have some permission issues.
Check out these previously answered questions:
brew link didn't complete
Fixing homebrew permissions

cordova ./create function not found Ubuntu 12.04

I'm digging around in PhoneGap to build a quick prototype we need.
When I navigate to the
~/cordova-2.1.0/bin$
and run
./create ~/jdphonegap com.jdphonegap.app JDPhoneGap
I get the following error
unexpected operator
./create: 48: ./create: function: not found
I'm not the only one:
https://groups.google.com/forum/?fromgroups=#!topic/phonegap/uI_rmd-Gto0
A little help?
Change the first line in create script from
#! /bin/sh
to
#!/bin/bash
Download commons-codec-1.6 from main server:
http://archive.apache.org/dist/commons/codec/binaries/commons-codec-1.6-bin.tar.gz
Extract the commons-codec-1.6.jar and place it to the cordova-android/framework/libs/ (need to create libs)
Alternatively change the URL of this package in create script at line 96
Install ant if you don't have it: http://archive.apache.org/dist/ant/ant-current-bin.zip, extract and add the ant bin folder in your PATH
Example for ant installed in /usr/local:
export PATH=/usr/local/ant/bin:$PATH
Then you can run the create script as documented.
see this line of create script:
ANDROID_BIN=$( which android )
if the environment variable "android" is not set it does not work.
In my case, I ran the following command:
export PATH= android-sdk-linux/tools/:$PATH
and with this it worked.

Resources