Does anyone know why i'm unable to run the go-getting-started application localy?
go get github.com/heroku/go-getting-started/cmd/...
cd $env:GOPATH/src/github.com/heroku/go-getting-started
PS C:\Users\XXXX\gocode\src\github.com\heroku\go-getting-started> heroku local
[OKAY] Loaded ENV .env File as KEY=VALUE Format
[OKAY] Trimming display Output to 107 Columns
11:28:05 PM web.1 | 'go-getting-started' is not recognized as an internal or external command,
11:28:05 PM web.1 | operable program or batch file.
[DONE] Killing all processes with signal null
11:28:05 PM web.1 Exited Abnormally
PS C:\Users\XXXX\gocode\src\github.com\heroku\go-getting-started> code .
According to the Heroku Dev Center:
If you see an error about an unrecognized command or “command not found”, then $GOPATH/bin is likely not in your $PATH or the trailing ... was missing from the go get github.com/heroku/go-getting-started/.... command used during “Prepare the App”.
Make sure $GOPATH/bin (in your case, C:\Users\XXXX\gocode\bin) is in your $PATH variable. The server binary, go-getting-started, is already there, you just need to make it available to the command line.
Related
We have a jenkins pipeline through which we are executing shell script.
Below command i need to executed which is throwing error.
build_date='2022-10-13'
ui_tag_value=`cat /data/lib/jenkins/workspace/ui_tag.properties | grep ${build_date}= | cut -d'=' -
f2`
ERROR :
cat: can't open '/data/lib/jenkins/workspace/ui_tag.properties': No such file or directory
Above command is present in sh file which we are executing through pipeline
File exist on the above path and also command works when used on the server but through jenkins pipeline we are facing issue. Any solution ?
I tried changing permission and paths but no luck. Need any ideas on how can this error be fixed ?
I'm trying to set pm2 to auto start on Mac OS like this pm2 startup
However I keep getting this error:
env: Fusion.app/Contents/Public:/usr/local/bin: No such file or directory
I tried the suggestion from this page: How to use pm2 startup command on Mac? But the even using this command I keep getting the same error: pm2 startup darwin
How can I get pm2 to startup automatically on Mac OS Catalina?
Thanks!
When you run pm2 startup command it suggests you PATH variable. It seems that this variable contains spaces that causes this error. Try to get rid of Fusion.app part of it.
Expanding on zored's answer, what's probably happening is that pm2 isn't generating the correct script because your PATH variable contains spaces (most likely "VMWare Fusion" in your case).
Run echo $PATH, clean it up by escaping the space character using a backslash (\), then manually paste the resulting PATH variable in pm2's generated startup script.
So basically instead of running a generated pm2 script like this:
sudo env PATH=$PATH:/usr/local/bin /usr/local/lib/node_modules/pm2/bin/pm2 startup launchd -u <user> --hp <user_folder>
run something like this:
sudo env PATH=<your `echo $PATH` output with escaped spaces>:/usr/local/bin /usr/local/lib/node_modules/pm2/bin/pm2 startup launchd -u <user> --hp <user_folder>
In case you wonder where the VMWare path parameter is set (and could be changed permanently):
/etc/paths.d/com.vmware.fusion.public
The content of this file is added to the PATH environment
I have a code that reads port number from environment variable or from config. Code looks like this
const port = process.env.PORT || serverConfig.port;
await app.listen(port);
To run app without defining environment variable, I run following yarn command.
yarn start:dev
This command works successfully in Linux shell and Windows command line.
Now, I want to pass environment variable. I tried following,
PORT=2344 yarn start:dev
This commands works successfully in Linux shell but failing in Windows command line. I tried following ways but couldn't get it to work.
Tried: PORT=2344 yarn start:dev
I got error: 'PORT' is not recognized as an internal or external command,
operable program or batch file.
Tried: yarn PORT=2344 start:dev
I got error: yarn run v1.17.3
error Command "PORT=2344" not found.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
Any idea please? I know, I can define environment variables from System Properties in Windows. But any way if I can do it from command line?
i'd suggest you use the NPM module called cross-env. it allows adding particular env variables on the command line regardless of platform. with that said, you may try:
$ cross-env PORT=2344 yarn start:dev
You can chain commands on the Windows command prompt with &(or &&). To set an environment variable you need to use the set command.
The result should look like this: set PORT=1234 && yarn start:dev.
Found a solution for this problem in Windows command prompt.
Create a .env file in project root folder (outside src folder).
Define PORT in it. In my case, contents of .env file will be,
PORT=2344
Run yarn start:dev
Application will use port number that you have specified in .env file.
Put .env file at root. Then following command will expose content of .env file and then run yarn start command
$ source .env && yarn start
or this command
$ export $(cat .env) && yarn start
If update any variable in .env then close the terminal and open new terminal window and can again run above command. Or else can also run unset command to remove existing var.
unset VAR_NAME
You can use popular package dotenv:
create a file .env in root directory
put all your env vars
e.g.:
ENV=DEVELOPMENT
run your code like this
$ node -r dotenv/config your_script.js
here the explanation:
[https://github.com/motdotla/dotenv#preload]
To define environment variables in the Windows command prompt we can use the set command, you can then split your call into two lines.
set PORT=2344
yarn start:dev
The set command persists within the current command prompt, so you only need to run it once.
The equivalent command in bash is 'export'.
FYI (not a direct answer). I was attempting this in VS Code - passing .env variables through yarn to a JavaScript app. Google had very few examples so I'm sharing this for posterity as it's somewhat related.
The following simply substitutes text normally placed directly into the package.json or script file. Use this to quickly obfuscate or externalize your delivery configurations.
In Environment Variable File (.env)
PORT=2344
In Yarn File (package.json)
source .env; yarn ./start.sh --port $PORT
In Yarn Script (start.sh)
#!/bin/bash
while [ $? != 0 ]; do
node dist/src/index.js $1; #replace with your app call#
done
The app then accepts port as a variable. Great for multi-tenant deployments.
I am installing the Laravel Installer as part of a Docker container using Composer. Laravel is installed globally meaning it goes to ~/.composer/vendor and then add an executable under ~/.composer/vendor/bin.
I am adding the directory ~/.composer/vendor/bin to the $PATH in a Dockerfile as follow:
ENV PATH="~/.composer/vendor/bin:${PATH}"
If I run the command docker exec -it php-fpm bash and from inside the container I run echo $PATH I got the following:
# echo $PATH
/opt/remi/php71/root/usr/bin:/opt/remi/php71/root/usr/sbin:~/.composer/vendor/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
If I run the command laravel inside the container I got the following:
# laravel
Laravel Installer 1.3.3
Usage:
command [options] [arguments]
Options:
-h, --help Display this help message
-q, --quiet Do not output any message
-V, --version Display this application version
--ansi Force ANSI output
--no-ansi Disable ANSI output
-n, --no-interaction Do not ask any interactive question
-v|vv|vvv, --verbose Increase the verbosity of messages: 1 for normal output, 2 for more verbose output and 3 for debug
Available commands:
help Displays help for a command
list Lists commands
new Create a new Laravel application.
So everything seems to be working fine. But if I run the following command (outside the container) meaning from the host:
$ docker exec -it php-fpm laravel
I got the following error:
rpc error: code = 13 desc = invalid header field value "oci runtime error: exec failed: container_linux.go:247: starting container process caused \"exec: \\\"laravel\\\": executable file not found in $PATH\"\n"
What I am missing here? Can the command laravel be run from within the host?
The ~ is the problem here, it's not a valid path character for some shells exec doesn't process it as you'd hope, and it isn't expanded for you by the Dockerfile. Be explicit with your path with the following:
ENV PATH=/root/.composer/vendor/bin:${PATH}
I'm running Ubuntu 14.04. I've created a script called startup.sh and given it execute permissions. I put it in my $HOME/bin folder, and I've checked and this is indeed on the PATH. I've rebooted my computer just to be sure. I am still unable to run startup.sh just as a command (typing startup on the command line). Am I wrong in what I've done or assumed is possible?
My end goal was to be able to just type on the command line "startup" and execute the script I created.
$ startup
startup: command not found
$ echo $PATH
/home/travis/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games
$ cd /home/travis/bin && ls -l
total 4
-rwxrwxr-x 1 travis travis 803 Dec 16 10:08 startup.sh
I can still run the script by navigating to $HOME/bin and running bash startup.sh of course, but that wasn't the goal.
Setting executable permissions and a #!/bin/bash line per How do I run a shell script without using "sh" or "bash" commands? did not work for me as an answer, hence my confusion.
If your file is named startup.sh, then the command to run it needs to be startup.sh.
If you want the command to be startup, don't include any extension on your filename: Just name it startup.