I'm trying to pull a heroku database to my local Windows computer by using
heroku pg:pull HEROKU_POSTGRESQL_DATABASE mydatabase --app myapp
However, when I run this command I get the following error:
'env' is not recognized as an internal or external command, operable
program or batch file. ! The local psql command could not be located !
For help installing psql, see PostgreSQL-local-setup
I do have psql in my path, and I can successfully call psql from my command line. I can even call heroku pg:info --app myapp successfully, and it shows the existence of my database.
Any suggestions?
I believe the answer given here is really inaccurate so I will answer:
See, when there is an error such as "'env' is not recognized as an internal or external command, operable program or batch file" it means that the system is trying to execute a command named env. This has nothing to do at all with setting up your environment variables.
Env is not a command in windows, but in unix. I understand that you have a windows machine though. What you can do is run "git bash". (You could get it by itself but it comes with Heroku's CLI).
This gives you a unix-like environment where the "env" command is supported, and then you can run the actual heroku pg:pull command :)
I hope this helps!
I realize this is from months ago, but I'll answer in hopes of helping somebody else. You need to set your path variables. My Computer > Advanced system settings; Click on "Environment variables" and then look at "System variables". Scroll down to "Path" or "PATH", edit it, and go to the very end of the text box. Add ;C:\Program Files (x86)\PostgreSQL\9.3\bin and ;C:\Program Files (x86)\PostgreSQL\9.3\lib (or whatever your equivalent paths are for bin and lib). Restart your command prompt and it should work. :)
Related
I have PTC integrity installed on my PC, but I would like to use CLI commands.
Unforonutaly, no PTC command is recognized in my console. Probably I have to set up some system env variables?
Or do I need some extra software/server installed besides?
I tried the next commands so far:
man imabout
man "im about"
man "im"
No manual entry for
im
si
'im' is not recognized as an internal or external command, operable
program or batch file.
when im is not recognized by your system, then
1) PTC is not running
or
2) your environmental variable is missing the entry:
C:\Program Files\Integrity\Lifecyle Manager Client\bin
First, check if you are using the client network if yes then use the
respective VPN with pulse secure or any VPN set-up with the
respective client VPN.
Second, if its in local n/w or at server location use the below basic
command
mksapiviewer --iplocal --xml im connect --hostname=HOSTNAME --port=7001
--user=ALM_USER --password=PASSWORD > Filename.txt
This will give you output in the text file and which is generated in the user folder or you can give manual file location.
If XML's exit code is coming "0" then it means the command run successfully.
This issue occurs when Tool path is not added into the PATH variable, please add the upto the Client_Install_Dir/bin directory.
Sometimes I have a problem with running various commands (I'm using Git Bash, if that matters). For example, when I try to execute:
az container exec --resource-group My-RG --name influxdb-container --exec-command "/bin/bash"
The command above should normally "SSH" me into the Azure Container Instance. However, instead, I'm getting:
'C:\Program' is not recognized as an internal or external command,
operable program or batch file.
I found a lot of posts on SO with such error, however, the issue in those posts was about invoking commands without proper quoting of "C:\Program Files". In my case, however, there is no "Program Files" anywhere, so I have a hard time figuring out what is wrong.
az command is recognized by the shell, when I invoke it alone, I'm getting proper response from Azure CLI.
I am also getting a similar error when running docker commands sometimes. Unfortunately, right now I do not know which command exactly would cause that.
This issue happens only on my Windows machine. When I run the command from Linux or macOS, it just works.
Screenshot of the error:
And the proof that az works:
There are some things different between Linux and Windows for Azure CLI. But still, there is some configuration that is the same. You can also set the environment variable PATH the same as in Linux.
In Linux, the az command is in the path /usr/bin/, and this path is also set the environment variable PATH. Then the az command can be recognized by the shell. So the same in Windows, you can also append the path of the Azure CLI in the environment variable PATH. The screenshot shows the configuration on my side:
Then the az command can also be recognized by the CMD:
But you can also use WSL in the Windows and the same experience of the Azure CLI as in Linux.
I had a very similar issue but with AWS sam.cmd command.
Ended up solving it by editing my environment variables -> editing the "Path" system variable and using the "short path" to this command (which doesn't have any spaces) instead of the "long path". (A nice utility called Path Copy Copy helped with doing this.)
Changed from: C:\Program Files\Amazon\AWSSAMCLI\bin to: C:\PROGRA~1\Amazon\AWSSAM~1\bin
Would suspect doing something similar for the az command would have solved your issue. Suspect it may be something to do with Git Bash automatically putting quotes around the whole command when the path to the executable has whitespace in it.
I have added C:\MinGW\bin to my user path, and I made sure that gcc.exe exists in the C:\MinGW\bin folder.
When I run this I get:
gcc -- version
'gcc' is not recognized as an internal or external command,
operable program or batch file.
But when I run it on Git Bash, the command executes properly. Does anyone know why this is happening?
CMD.exe may still have your old %PATH% environment variable value.
If you've updated it in the Environment Variables tab under Computer / Properties, you might be able to close and re-open the command prompt to get the new environment variable value.
See How do you add a Windows environment variable without rebooting? on Server Fault.
I would like to ask you if it's normal that my "Setting environment" changes after each system reboot or even if I just close my cmd console.
for example, I'm using python 3.5, when I wan to use python or to uses pip under the cmd I got an error like :
C:\>python
'python' is not recognized as an internal or external command,
operable program or batch file.
To fix this, I use :
set PATH=%PATH%;C:\Python35
It works after, but as I said before, once I restart my computer, or I close the console, I've the same problem !!!
Thanks in advance for your help and comments. I just would like to inform you that I'm using Windows 7 - 64bits.
You need to add this path in System (Windows+Pause key), Advanced, Environment variables. There you have two sections, System and User, in System, edit the PATH key.
The next time you start a console the path will be present.
Alternaly, if you don't want to modify the setting there (or you have no rights) you could start the app with a batch file which sets the path before launching the app.
In Ruby you can adapt the environment variables from within the script itself by using ENV eg ENV['path'] += 'C:\\Python35'
, I'm sure Python can do this too but wouldn't know how. In your use case this won't help of course.
The SETX command will set the variable permanently. Use SETX /? for information. Set a persistent environment variable from cmd.exe
For Python, many developers use venv which is included with the Python install. https://docs.python.org/3/library/venv.html?highlight=venv#module-venv
I've been trying to install the 64bit version of PostgreSQL 9.2 for Windows on my machine (Windows 7 64bit) and get this error:
The environment variable COMPSPEC does not seem to point to the cmd.exe or there is a trailing semi colon present.
I've installed it as Administrator.
I disabled the antivirus (Microsoft Security Essentials) and the firewall.
Running:
"%COMSPEC%" /C "echo test ok"
returned test ok
I've checked my System Environment Variables for trailing semi colon and I couldn't find any.
I then installed the 32bit version and managed to get to the end of the install with a different error message stating: Problem running post-install step. Installation may not complete correctly Error reading the C:\Program Files (x86)\PostgreSQL\9.2\data\postgresql.conf but there is no postgresql.conf file in that directory. It did install the application and when I try to connect the server with the red X on it it says fail at the bottom and it won't connect after I type in my password.
How can I connect to this server connection?
ComSpec is a generic error message for any installation failure.
Identifying the problem
Navigate to below path
c:\Users\XXXXXX\AppData\Local\Temp
Open 'bitrock_installer_XXXX.log'
Check, if you are getting below error:
Script stderr:
'"C:\Users\XXXXX\AppData\Local\Temp\POSTGR~1\TEMP_C~1.BAT"' is not recognized as an internal or external command, operable program or batch file.
Error running
C:\Users\XXXXX\AppData\Local\Temp/postgresql_installer_47b21c4ea1/temp_check_comspec.bat :
'"C:\Users\XXXXX\AppData\Local\Temp\POSTGR~1\TEMP_C~1.BAT"' is not recognized as an internal or external command,
operable program or batch file.
This is a problem with '8.3 file names and directories' (e.g. '\Postgres Install' -> '\POSTGR~1')
Microsoft article on disabling 8.3 file names and directories: https://support.microsoft.com/en-gb/kb/121007
Solution:
Open command prompt in admin mode
Execute following command to change the format based on your drive or all drives
Sample commands:
fsutil 8dot3name set 1" - disable 8dot3 name creation on all volumes
fsutil 8dot3name set C: 1" - disable 8dot3 name creation on c:
Execute the installation as a user having admin privileges
After install, consider resetting the 8dot3name setting to default (2) to avoid unintended consequences
Hope it solves the problem!
Very easy fix:
Just open Advanced System Settings in Control Panel and create a new System Variable( in the System Variable instead of User Variable section).
In the variable name, enter ComSpec and then in the variable value , enter C:\Windows\system32\cmd.exe.
Alternative fix:
If you have already the ComSpec variable in the System Variable section, remove the ;at the end of it this should fix it.
It's not COMPSPEC it's just COMSPEC. Please show the output of:
echo %COMSPEC%
Note that COMSPEC could be set to something different in the Administrator account you're running the installer as. I'm not sure how to find that out, but it might appear in the PostgreSQL installer log, so please upload that and link to it in your post. See Reporting an installation error for info on where to get the installer log.
See the PostgreSQL for Windows FAQ entry Check the COMSPEC environment variable.
Here's a report I made suggesting that the installer should test for this explicitly and here's my blog post on the topic.
I got the same problem, and i found in the log:
Script stderr:
'C:\Users\S300' is not recognized as an internal or external command,
operable program or batch file.
Error running C:\Users\S300 (i5)\AppData\Local\Temp/postgresql_installer_56caeadbd6/temp_check_comspec.bat : 'C:\Users\S300' is not recognized as an internal or external command,
operable program or batch file.
I change in User Variables TEMP to D:\TEMP and TMP to D:\TEMP.
And Solved My Problem.
In my case , the Installer was in %USERPROFILE%\DownloadsP{ Windows download folder}, I moved the installer to desktop and ran again. weird it worked lol.
I had a similar problem. After installation, the data folder contained no postgres.conf file. It only contained a single folder named "pg_log".
I described the solution that I used here: Postgres Installation Error reading file postgresql.conf
Basically, it would be helpful to check if the user has full permissions for the postgres folder, and run "init_db" and "pg_ctl start" commands again. If the path contains a space character, try using a relative path for the pg_ctl data folder argument.
I'm running Windows Server 2003 R2, and I have been unable to resolve this problem with the installer, so I resorted to using the binary PostgreSQL package. Hopefully this will be an alternative for others who do not want to perform an OS reinstall.
First, some background (hopefully useful to the developers)
It started out with the postgres service failing to start (the server had been running reliably for over a year). I assumed it was a corrupted PostgreSQL installation, so I uninstalled and attempted to reinstall. I encountered the following error:
There has been an error.
The environment variable COMSPEC does not seem to point to the cmd.exe or there is a trailing semicolon present.
Please fix this variable and restart installation.
However, the COMSPEC variable is set properly, verified with:
echo %COMSPEC%
C:\WINDOWS\system32\cmd.exe
and:
"%COMSPEC%" /C "echo test ok"
test ok
Since this is Windows Server 2003, there is no UCA wrapper around the Administrator account, so that is not causing the problem.
Manual Installation
NET USER postgres /ADD
C:\pgsql\bin\initdb.exe -U postgres -A password -E utf8 -W -D C:\pgsql\data
runas /user:postgres "C:\pgsql\bin\pg_ctl -D C:/pgsql/data -l C:/pgsql/logfile.txt start"
just do it run as administrator and change the environment system variable
like create a new variable 'ComSpec' and value type 'C:\Windows\system32\cmd.exe'.
If the installer exe is on a network share that mapped drive might actually not be accessible to the installer as it runs as administrator. This can often happen in some virtual machine arrangements such as running windows in a parallels VM. Copy the installer to a local drive first and you won't have a problem.
What worked for me after trying to enter the commandline given her in cmd.exe
I found it was named cmd1.exe in system32.. so i copied the file and renamed it as cmd.exe and installation finished
Open Environment Variables, you can do this on Windows 7 by typing environment variables in the Search program and files bar when pressing the start button at the bottom left of the desktop. And create a new System Variable(in the 'System Variable' instead of 'User Variable' section).
In the variable name, enter ComSpec and then in the variable value , enter C:\Windows\system32\cmd.exe.
That's all. Hope it works!
Alternative fix:
If you already got the ComSpec variable in the System Variable section, remove the ; at the end of it this should fix it.
First find the path to cmd.exe(mostly it is C:\Windows\System32\cmd.exe).
Go to the enviornment variable and add this path to system variable path.And also create new variable in user variable called ComSpec and add this path as value. And you are ready to go.