1

I am new to using Hyper and programming in general and whenever I start my Hyper terminal I get the the below error. It's not really causing anything to break in my code but was wondering if there was a way to clean it up.

bash: export: `Files(x86)/Common': not a valid identifier
bash: export: `Files/Intel/Shared': not a valid identifier
bash: export: `Libraries/redist/intel64/compiler:/c/Windows/system32:/c/Windows:/c/Windows/System32/Wbem:/c/Windows/System32/WindowsPowerShell/v1.0:/c/Windows/System32/OpenSSH:/c/Program': not a valid identifier
bash: export: `Files/NVIDIA': not a valid identifier
bash: export: `Corporation/NVIDIA': not a valid identifier
bash: export: `NvDLISR:/c/Program': not a valid identifier
bash: export: `Files(x86)/NVIDIA': not a valid identifier
bash: export: `Corporation/PhysX/Common:/c/WINDOWS/system32:/c/WINDOWS:/c/WINDOWS/System32/Wbem:/c/WINDOWS/System32/WindowsPowerShell/v1.0:/c/WINDOWS/System32/OpenSSH:/c/Program': not a valid identifier
bash: export: `Files/dotnet:/c/ProgramData/chocolatey/bin:/cmd:/c/Program': not a valid identifier
bash: export: `Files/nodejs:/c/Users/John/AppData/Local/Programs/Python/Python310:/usr/bin/vendor_perl:/usr/bin/core_perl:/c/Users/John/.npm-global/bin:~/.npm-global/bin': not a valid identifier

Below is what I have in my .bashrc file

export NPM_CONFIG_PREFIX=~/.npm-global
export PATH=C:/Development/ani-gen/env/Scripts:/c/Users/John/bin:/mingw64/bin:/usr/local/bin:/usr/bin:/bin:/mingw64/bin:/usr/bin:/c/Users/John/bin:/c/Program Files (x86)/Common Files/Intel/Shared Libraries/redist/intel64/compiler:/c/Windows/system32:/c/Windows:/c/Windows/System32/Wbem:/c/Windows/System32/WindowsPowerShell/v1.0:/c/Windows/System32/OpenSSH:/c/Program Files/NVIDIA Corporation/NVIDIA NvDLISR:/c/Program Files (x86)/NVIDIA Corporation/PhysX/Common:/c/WINDOWS/system32:/c/WINDOWS:/c/WINDOWS/System32/Wbem:/c/WINDOWS/System32/WindowsPowerShell/v1.0:/c/WINDOWS/System32/OpenSSH:/c/Program Files/dotnet:/c/ProgramData/chocolatey/bin:/cmd:/c/Program Files/nodejs:/c/Users/John/AppData/Local/Programs/Python/Python310:/usr/bin/vendor_perl:/usr/bin/core_perl:/c/Users/John/.npm-global/bin:~/.npm-global/bin

Output of declare -p PATH

$ declare -p PATH
declare -x PATH="/c/Users/John/bin:/mingw64/bin:/usr/local/bin:/usr/bin:/bin:/mingw64/bin:/usr/bin:/c/Users/John/bin:/c/Program Files (x86)/Common Files/Intel/Shared Libraries/redist/intel64/compiler:/c/Windows/system32:/c/Windows:/c/Windows/System32/Wbem:/c/Windows/System32/WindowsPowerShell/v1.0:/c/Windows/System32/OpenSSH:/c/Program Files/NVIDIA Corporation/NVIDIA NvDLISR:/c/Program Files (x86)/NVIDIA Corporation/PhysX/Common:/c/WINDOWS/system32:/c/WINDOWS:/c/WINDOWS/System32/Wbem:/c/WINDOWS/System32/WindowsPowerShell/v1.0:/c/WINDOWS/System32/OpenSSH:/c/Program Files/dotnet:/cmd:/c/Program Files/nodejs:/usr/bin/vendor_perl:/usr/bin/core_perl:/c/Users/John/.npm-global/bin:/c/Users/John/.npm-global/bin"
totablue
  • 31
  • 7
  • `export variable="value"` -- include the quotes so spaces are treated as part of the value, not a separator between arguments. Mind that `~` doesn't work in quotes; easy solution is to use `$HOME` instead. – Charles Duffy Nov 28 '22 at 00:47
  • The reason you get the specific error you do is because when someone runs `export var1 var2 var3` without any `=`, it takes existing shell variables and copies them into the environment; so when you have spaces in your values, it sees them as a separator between arguments and tries to read the thing on the right as the name of the next variable to be exported. – Charles Duffy Nov 28 '22 at 00:48
  • ...as an illustrative example, `export var1=value var2 var3` sets `var1` to have `value`, then exports shell variables `var2` and `var3`, making them into environment variables with the values they already have. Because the shell supports that syntax, it can't read `export var1=value var2 var3` as meaning `export var1="value var2 var3"`. – Charles Duffy Nov 28 '22 at 00:49
  • Adding quotes got rid of the errors. But I have ```~``` in my variable but doesn't give back any errors? Should I still replate the whole string with ```$HOME```? – totablue Nov 28 '22 at 00:50
  • BTW, because `PATH` is almost always _already_ in the environment, using `export` when changing it is almost universally unnecessary. – Charles Duffy Nov 28 '22 at 00:50
  • in your `PATH` assignment you have this: `/c/Program Files (x86)/Common Files/Intel/Shared Libraries/redist/intel64/compiler` ... notice the spaces; if you don't quote the entire contents of your `PATH` assignment then the initial assignment stops at the first space and then the OS treats the rest of the line as (invalid) commands; so, try `export PATH="C:/Development .... :~/.npm-global/bin"` – markp-fuso Nov 28 '22 at 00:50
  • And yes, you should change the `~` to `$HOME` when it exists inside quotes -- otherwise not all programs will successfully honor the PATH elements with the tildes in them. (And for parameter expansions like `$HOME` to work, make sure you're specifically using double quotes rather than single quotes; in single quotes almost everything is literal). – Charles Duffy Nov 28 '22 at 00:50
  • (Stripping the hyperterm references from the question because this isn't terminal-related behavior; you'd see it with any other terminal type as well -- the terminal just displays the shell's output and collects input for it, so it's only pertinent for questions that are particular to shell/terminal interaction; think about things like controlling text color, or toggling local echo, or hiding passwords while they're being typed, or so forth). – Charles Duffy Nov 28 '22 at 00:54
  • @CharlesDuffy Adding the quotes around my Path variable seems to get rid of the error but for some reason I can't get ```code .``` to work to open visual studio code. I couldn't find any relevant answers. Do you happen to know what might be causing this?? – totablue Nov 28 '22 at 14:21
  • Not without more information. First, which entry in that PATH is expected to point to the location of `code.exe`? Second, does the error message indicate that the aforementioned executable isn't found, or that something else is going wrong? (Also, could you provide output of `declare -p PATH` as amended?) – Charles Duffy Nov 28 '22 at 14:22
  • Also, `c:/` is for Windows-style PATHs, whereas `/c/` is for mingw-style ones; they generally shouldn't be mixed -- one or the other is correct depending on where you're doing the configuration. – Charles Duffy Nov 28 '22 at 14:24
  • I don't specifically know which PATH is supposed to point to the location of code.exe because I only ticked the option to add to PATH when installing. But I get the error saying ```bash: code: command not found``` whenever I add double quotes to the ```export PATH=``` but whenever I comment out the whole line it works without a problem. – totablue Nov 28 '22 at 14:31
  • Then `code` is presumably in a place that's in your _default_ PATH but not the one you're explicitly specifying. – Charles Duffy Nov 28 '22 at 14:41
  • Use `type code` when you have the line commented out to see where the executable is, and make sure that location is one of the ones in the list you're defining. – Charles Duffy Nov 28 '22 at 14:41
  • using ```type code``` and adding that to my ```export PATH``` fixed the issue! Does the exports in .bashrc overwrite whatever is in my default PATH? which is why it's causing my ```code .``` to not work? – totablue Nov 28 '22 at 14:44
  • Yes, `export var=value` overwrites the previous value of `var`. – Charles Duffy Nov 28 '22 at 15:43

0 Answers0