Nodejs module oracled cannot find LD_LIBRARY_PATH - linux

I'm getting the following error in my nodejs script using the oracledb module on a Centos 6 VM:
Error: libclntsh.so.11.1: cannot open shared object file: No such file or directory
We're using the full Oracle client. My google searches have led me to LD_LIBRARY_PATH being the problem. It is set in /etc/profile.d/ in an oracle script, and I can see it in my linux user's env output. But when I check process.env within the node script, LD_LIBRARY_PATH is simply not there. (If I add other variables to my /etc/profile.d script, those test variables appear in process.env)
The other weirdness is that when I run the script as root, the variable gets set properly and the script executes as expected.
So why is LD_LIBRARY_PATH disappearing when my non-root user runs the script?

You didn't explain how you are invoking the script. If you are sudo-ing, do you need to call a shell script that sets LD_LIBRARY_PATH before invoking node?

Related

How to set environment path to folder in my documents directory on mac

Hello I am working on a hyper ledger fabric project using python
I am running into an error on my program which requires me to set an environment path
below is the error given :
configtxgen not in PATH.
Configtx is empty
now I know the fix for this, it requires me setting an environment path to a file called
configtx.yaml
its location on my Mac is
documents/blockchain/fabric-sdk-py/test/fixtures/e2e_cli/configtx.yaml
please how do I set an environment path towards this file
Thanks
How you set an env var depends on your shell and whether you are running the program from a shell prompt or some other way (e.g., double-clicking on an application icon). Assuming you're using a POSIX shell like bash or zsh you would type something like this:
export VAR_NAME="$HOME/documents/blockchain/fabric-sdk-py/test/fixtures/e2e_cli/configtx.yaml"
You would normally put that statement in a file like ~/.bashrc so it is set each time you start an interactive shell.
P.S., If the documentation for the application you're using doesn't tell you how to do this I would open an issue suggesting such instructions be added.

How to start a Nodejs server with options?

My computer runs Windows10 Enterprise.
I found this repo for creating a Nodejs server for tchatbot. As you can see there are options for starting the server. I tried to execute this command : node app.js DF_PROJECT_ID="agent-human-handoff-sampl-jseo" DF_SERVICE_ACCOUNT_PATH="D:\Docs\TchatBot\clé_account_service_agent_human_operator\agent-human-handoff-sampl-jseo-3349b2f01974.json"
But I got error : You need to specify a path to a service account keypair in environment variable DF_SERVICE_ACCOUNT_PATH
So what is wrong ?
It's basically same as jfriend00's solution, but I add node app.js in the end. And you just follow below sequence to run command.
set DF_SERVICE_ACCOUNT_PATH="D:\Docs\TchatBot\clé_account_service_agent_human_operator\agent-human-handoff-sampl-jseo-3349b2f01974.json"
set DF_PROJECT_ID="agent-human-handoff-sampl-jseo"
node app.js
By the way, if you use linux system or macOS, you'll use following command to start server.
(Just one line)
DF_SERVICE_ACCOUNT_PATH="D:\Docs\TchatBot\clé_account_service_agent_human_operator\agent-human-handoff-sampl-jseo-3349b2f01974.json" DF_PROJECT_ID="agent-human-handoff-sampl-jseo" node app.js
You can just set these in the environment in a command shell before running nodejs from that command shell:
set DF_SERVICE_ACCOUNT_PATH="D:\Docs\TchatBot\clé_account_service_agent_human_operator\agent-human-handoff-sampl-jseo-3349b2f01974.json"
set DF_PROJECT_ID="agent-human-handoff-sampl-jseo"
Then, you you can run your program and these variables will be in the environment that your node program inherits. If you want to automate this, you can create a small batch file that will set them and then run your program. Keep in mind that setting environment variables like this sets them on for programs run from the current command shell, not other command shells and not for programs run other ways.
After setting those, your environment is now configured and you would run your program just as always:
node app.js

Issue tying to read environment variable in Python

Hi I'm trying to read an environment variable in python, if I execute my script from console with:
python3 myScript.py everything goes ok, but I need to run this script as a service in Ubuntu, in this case, the script can't get the environment variable. Anyone has past for the same issue? I noticed that when i'm trying to read the mongo URI from environment.
The correct way to achieve that is passing the environment variable or environment file to the service file, in my case I added this line to my service file:
EnvironmentFile = /etc/environment

Environment Variable not being passed to CruiseControl, specifically the 'nodosfilewarnings' ENV variable from Cygwin

I have a Perl program that someone else created and I am calling on with CruiseControl. The program calls on Unix Commands using Cygwin. However, everytime that the Perl program calls on a Unix like command with a DOS like address, I get the well known error:
cygwin warning:
MS-DOS style path detected: E:\regression
Preferred POSIX equivalent is: /cygdrive/e/regression
CYGWIN environment variable option "nodosfilewarning" turns off this warning.
Consult the user's guide for more details about POSIX paths:
http://cygwin.com/cygwin-ug-net/using.html#using-pathnames
I have set both the User Variable AND System Variable CYGWIN to nodosfilewarning. This removes the error when I run the program from the command line, but the error still occurs in CruiseControl when called as an automated process from a batch file. I have called on both the batch file from the Desktop AND Command Line and ran as an administrator. Nothing changes.
Other Notes
For purposes of this problem, I don't have access to the Perl Program
I am trying to go back to Cygwin 1.5.*, but since I am using Server 2008, I am encountering compatibility issues
This is occurring on one of the distributed servers, not the main server running the Webdashboard.
I have read somewhere that this issue may stem from a different user calling on CruiseControl, but the issue should have been solved by setting this as an ENV System variable
Is it possible to modify the registery to set the ENV variables?
Thank you in advance
The way I do it is like this
printf 'export CYGWIN=nodosfilewarning' >> ~/.bash_profile
If CruiseControl is connecting to the server via ssh, reinstall sshd and explicitly include nodosfilewarning when prompted for the CYGWIN environment variable during the install.
Re-installing with modified environment will work but if you don't want to or cannot re-install, an alternative is to change the registry instead of re-installing the service.
See: CYGWIN windows cygrunsrv sshd server and MS-DOS style path detected

IZPack Setting Linux Environment Variables

I am sure this has to be out there somewhere, but after about a day of searching I am stuck. I am trying to use IZPack to do an installation on Linux and trying to call a shell script that sets some environment variables. However I don't know how to "source" the script instead of just running it. Running the script using:
<executable type="bin" stage="postinstall" targetfile="$INSTALL_PATH/myscript.sh" os="unix"/>
This only executes the script, it does not source it. So all exports of ENV variables are lost once the script completes.
How can I source my scripts from IZPack instead of just running them?
IMHO you simply cannot influence the shell environment your Java process of your IzPack installer is running in from that process itself.
Torsten is right. This is not an issue of IzPack, Java or anything else, this is just the way operating system process work with respect to environment variables ;-)

Resources