Why is Appcellerator Titanium's terminal different from my OSs terminal? - node.js

I'm having the following problem installing Titanium Studio. On my Mac (OSX Yosemite), the terminal shows that I have Node, NPM, Titanium, Alloy etc. all installed and 'callable' from any path. Titanium Studio keeps failing to run because it can't find the CLI.
If I go to Titanium's terminal view, absolutely nothing seems to be installed. Even 'ls', 'cd' etc. cannot be run. Anyone know what I'm missing here? It's like .bashrec never gets loaded or something. Would appreciate any pointers in the right direction,
cheers,
Wittner

Ok. Looks like this had nothing much to do with Titanium and everything to do with my system setup, but this might help others who experience the same symptoms.
Turns out that my .bash_profile was incorrectly set up.
.bash_profile is a batch file which holds information about (among other things) the current path. This file, if it exists, gets run every time terminal is started up. One of my path statements in the file ended without :$PATH
:$PATH concatenates the current path when you are putting a path command in the file e.g.:
export PATH=/etc/bin/
export PATH=/Applications:$PATH
The ':$PATH' at the end of the second statement ensures that the path now contains both /etc/bin/ and /Applications. Without :$PATH, the second line would have set the path to /Applications only, overwriting the /etc/bin/ entry.
So in effect all of the PATH commands before the last one had been overwritten. Terminal could not see where ls, cd or an of those command line tools were. My own terminal worked fine because I had it using ksh (Korn shell) which I had set up with some fancy colours and listing options. When Titanium tried to load a fresh copy of terminal, the PATH was effectively being overwritten and so Alloy, Node etc. where not visible to it.
I fixed up the erroneous PATH statements in the .bash_profile, restarted the app and now Titanium works fine.

Related

environment variable LD_LIBRARY_PATH is not working until I reassign it

I have a strange behavior on an embedded linux system. It is created from an image file and has been used on many system for about a year without any issues. But a new system that I installed just now fail to work.
I have an app that is started by one of the boot scripts, and is dependent on a library foo.so in a special path.
So the script sets LD_LIBRARY_PATH to foopath.
LD_LIBRARY_PATH=foopath \
foo.app
But after boot I can see that the app was never started and if I try to start it manually it complains that it can't find the library.
The strange thing is that I can get it to work by setting the same path again by just copying the path using the clipboard, like this:
$ echo $LD_LIBRARY_PATH
foopath
$ export LD_LIBRARY_PATH=foopath
After this my app will find the library and executes correct.
But if I reboot the system the problem is of course back again.
What could be wrong, and what can I do to solve the issue?
As seen in the comments I got it to work by changing my script like this, but I still can't understand why it works on some systems, but not all.
export LD_LIBRARY_PATH=foopath
foo.app

node command returns nothing in Command Prompt (Windows 10)

Lately, I was trying to install NodeJs on my desktop PC and I ran into this weird problem. When I type, eg. node -v command, it returns nothing. After node I can add anything, it will just be ignored and won't return anything in the next line. I've added C:\Program Files\nodejs to PATH system variable, but it still doesn't work. Only time node -v command works is when I do (in cmd) C:\Program Files\nodejs>cd C:\Program Files\nodejs, then C:\Program Files\nodejs>node -v and in the next line it returns proper verision v16.13.1 .
Obviously, node command works and returns properly only when I run command from \nodejs folder, but as I saw on the Internet, it should work (with system PATH set up) from any folder. I think something is messed up in my Environment Variables, but if you know how to solve this problem, please let me know! Every comment is appreciated!
I downloaded NodeJs from https://nodejs.org/en/download/ (LTS, Windows Installer, 64-bit). Thanks in advance!
PS. npm command works correctly from any folder.
#Compo
Your issue is that you have many things in the %Path%, and clearly have made errors when adding for node.exe.
The first noted problem is that you have added C:\Program Files\nodejs\node.exe when you should have used only C:\Program Files\nodejs. Entries in this variable are for the directories which hold your executable files, not the files themselves. However, as C:\Program Files\nodejs is already included, you can simply remove that invalid entry.
The next issue, is that you need to understand what happens when you enter node in the Command Prompt or a batch file. What happens is that the current directory is searched for files named node which have an extension matching one listed in the %PATHEXT% value, (which is searched in order first to last). If a match is found, that file is run, and the searching stops. If no file is found, the same process occurs with every location listed under %Path%, (in its listing order first to last), the first matching file is run and the searching stops.
So by using node, what happens in your case is the %Path% is being searched, because there is no file named node.COM, node.EXE, node.BAT, node.CMD, node.VBS, node.VBE, node.JS, node.JSE, node.WSF, node.WSH, or node.MSC in the current directory. So each location is searched in order, until it reaches the first match, which in your case happens to be C:\xampp\htdocs\WebRulet\node.JS.
So essentially by using a presumptive/lazy command you are effectively running:
C:\xampp\htdocs\WebRulet\node.JS -v
Which is not what you wanted, and why you are not getting the result you had hoped for.
So now you understand the process which happens, by using code which make assumptions, and how that could cause issues, errors, or potential catastrophies. You should realize with all of that searching, especially if you have many entries in your %Path% and/or %PATHEXT% values, that the quickest and safest way to run your command would be:
"C:\Program Files\nodejs\node.exe" -v
Or
"%ProgramFiles%\nodejs\node.exe" -v
Please note that those absolute paths are double-quoted because they contain space characters. However, spaces are not the only problematic characters used in filenames, so best practice is, unless you are certain there are no such poison characters, to always double-quotes.
Now I know that almost every site will never explain all of that information, and all the code you read will not follow it either, so you are probably going to want to minimize your typing whilst working on the command line.
In order to do that, you will need to ensure that your %Path% value string, is ordered in such a way as your most frequently typed executable file path, is nearer the beginning, than any other location holding a possible matching file. However I will strongly suggest that you always use file extensions, for safety, (it is, after all, usually just four more characters to type).
Noting the entries in your %Path%, there are some extremely important ones missing, which means that your %Path% is essentially corrupted, and requires fixing because it will seriously affect the proper running of your Operating System.
To fix your variables, and order them correctly, begin by typing the following in your Command Prompt window:
Start %SystemRoot%\System32\SystemPropertiesAdvanced.exe
In the window which opens, click on the [Environment Variables] button. A new window will open, within the User variables (upper pane), double-click on Path, and using the [New] [Delete], [Move Up] and [Move Down] buttons make sure that the entries in it, in this order, are:
%UserProfile%\AppData\Roaming\npm
%UserProfile%\.dotnet\tools
%UserProfile%\AppData\Local\Microsoft\WindowsApps
%UserProfile%\AppData\Roaming\Composer\vendor\bin
D:\Inkscape\bin
Once done, click on [OK] to close the window, then do the same thing for System variables, (lower pane), with the following ordered list:
%SystemRoot%\System32
%SystemRoot%
%SystemRoot%\System32\wbem
%SystemRoot%\System32\WindowsPowerShell\v1.0
%SystemRoot%\System32\OpenSSH
%ProgramData%\ComposerSetup\bin
%ProgramData%\DockerDesktop\version-bin
%ProgramFiles%\Docker\Docker\resources\bin
%ProgramFiles%\Azure Data Studio\bin
%ProgramFiles%\nodejs
%ProgramFiles%\dotnet
%ProgramFiles%\heroku\bin
%ProgramFiles%\Oracle\VirtualBox
%ProgramFiles%\NVIDIA Corporation\NVIDIA NvDLISR
%ProgramFiles(x86)%\NVIDIA Corporation\PhysX\Common
%SystemDrive%\xampp\bin
%SystemDrive%\xampp\htdocs\WebRulet
Once complete click on [OK], [OK], and [OK] to close your windows, and then close the Command Prompt window.
From now on you should be able to open any new Command Prompt window and use:
node -v
But remember, I strongly advise that you get into the habit of using its extension:
node.exe -v
Which should result in:
v16.13.1

How can I change the default python packages accesible to git in vscode?

I am working on a commit-msg git hook. Everything works except importing of specific modules. The bad behaviour is specific to the use of the vs-code GUI git bar (little check mark at the top of the source control panel) with pip installed modules. If I use git commit -m "some message" through the terminal, everything works perfectly.
But, when I use the vs-code GUI, I get an import error.
Thinking it may be an environment issue, I ensured that the module needed was available globally by pip installing the needed module to my machine outside of any virtual environment. It didn't help.
To see what's going on, I wiped my hook and replaced it with nothing more than help("modules") to see if my modules were indeed there. They were not. So I ran
import os
dir_path = os.path.dirname(os.path.abspath(__file__))
print(dir_path)
This printed my path to the file being ran and was the path expected.
I opened a new terminal outside of vs-code with no virtual environment enabled and ran python3 path/to/file to see if my module would show up there. It did.
Additionally, it is there if I run it in the vs-code terminal as well. The only place it seems to be missing is wherever the vs-code git GUI pulls it's package list from.
Where does vs-code git get it python package list and how can I ensure that either; 1) it points to my normal python package list or 2) I can add the needed modules into it's path?
Thanks
EDIT: Thanks to the intelligent suggestion of John Szakmeister left in the comments, I have configured my hook to call env. I then initiated the hook through the terminal and through the GUI to compare.
Using the GUI adds a few variables, mostly for logging purposes and error handling. But there are a couple that I don't quite know what they do. APPLICATION_INSIGHTS_NO_DIAGNOSTIC_CHANNEL=true and
ELECTRON_RUN_AS_NODE=1
However, being that it works in terminal but not GUI, I have to assume that the added variables are not the culprit. So, instead I look at what is different from one to the other.
Outside of the additional VS-Code specific variables, there really isn't very much that is coming up different.
Shell level is 2 through terminal but only 1 through the GUI (interesting...)
Terminal has extra variables TERM=xterm-256color and TERM_PROGRAM_VERSION=1.46.0 that aren't present in GUI env.
Additionally, there are some colors that are set in terminal but not the GUI.
Lastly, there is one variable that is in both that is different. GUI gives _=/usr/share/code/code while terminal yields _=/usr/bin/git. I assume that these refer to what program initiated the terminal but I haven't been able to verify that.
That's about it. PATH is the same for both, as is SHELL, as are just about all of the GIT_anything variables (outside of the fact that the GUI sets a pager that the terminal does not)

customed command not found in a new terminal

everyone.
I had a basic question want to consult, about the environment variable setting.
After closed my one existed terminal which could execute compile(make) and do customed(mksdboot) command, i can't do mksdboot command anymore(I had execute a predefined setting environment variable shell script i.e. $ . ./arndale_envsetup.sh again) in the new terminal.
Cause i am a beginner in Linux, i am not very clearly about the environment variable setting rules.
i had tried to 'su' or 'sudo' to execute mksdboot, but no luck:(
ps. I had another project needs to compile in my PC(i didn't export PATH to .bashrc, only execute export PATH when i open a new terminal every time), may it efforts the original project's environment variable?
thanks.
[UPDATED]
i tried using $source ./arndale_envsetup.sh, relative commands worked finally.
but i still did't figure out the reason between work or not work. >"<
The command
history
will list what your previous commands where.
This might give you a pointer what set the path in the way you needed it.
You could also try to see where you command is via
locate mksdboot

Installing TexLive 2010 in Ubuntu 10.10: problem with PATH

I'm followint these instructions to install Kile+TexLive 2010 with package manager on my Ubuntu Maverick: http://ubuntuforums.org/showthread.php?t=141934
The problem I have is that when I finish downloading all the packages to my computer, I have to edit the path but Ubuntu doesn't recognize it. The lines are the following:
PATH=/usr/local/texlive/2005/bin/i386-linux:$PATH
export PATH
I run echo $PATH and as long as I don't close the terminal, the path appears with the echoing, but if I close it, the path disappears. Nevertheless (whether I close the terminal or not), I'm supposed to run texhash but I am told that the command is not found. I already tried editing the path by adding the two lines above to both .bashrc in my home directory and to bash.bashrc in /etc/ directory.
I'm just following the instructions linked above, but I'm a linux rookie. Could anyone help, please?
in order to permanently change any environment variable under Ubuntu/Linux, you must modify the files you mentioned (for example ~/.profile). If you simply issue an export via the terminal, its effect will end once the terminal is closed. Sometime it is needed to perform a logout/login for the changes to take effect.
Also, mind the syntax of what you write in the above mentioned file(s), like "'s around $PATH.
Refer to this question: https://serverfault.com/questions/44275/how-to-add-a-directory-to-my-path-in-ubuntu

Resources