How to set node path for nodejs (Ubuntu) - postgresql

I'm trying to setup nodejs to access a postgres database. What I've done so far is the following (https://gist.github.com/579814):
echo 'export PATH=$HOME/local/bin:$PATH' >> ~/.bashrc
. ~/.bashrc
mkdir ~/local
mkdir ~/node-latest-install
cd ~/node-latest-install
curl http://nodejs.org/dist/node-latest.tar.gz | tar xz --strip-components=1
./configure --prefix=~/local
make install # ok, fine, this step probably takes more than 30 seconds...
curl http://npmjs.org/install.sh | sh
then
git clone git://github.com/isaacs/npm.git
make
make install
so far, so good. However, when I try to install the postgres driver
npm install pg
I get the following:
node-waf configure build || true
Checking for program g++ or c++ : /usr/bin/g++
Checking for program cpp : /usr/bin/cpp
Checking for program ar : /usr/bin/ar
Checking for program ranlib : /usr/bin/ranlib
Checking for g++ : ok
Checking for node path : not found
Checking for node prefix : ok /usr/local
Checking for program pg_config : /usr/bin/pg_config
'configure' finished successfully (0.066s)
Waf: Entering directory `/home/christian/node_modules/pg/build'
[1/2] cxx: src/binding.cc -> build/default/src/binding_1.o
../src/binding.cc:3:25: fatal error: node_events.h: No such file or directory
compilation terminated.
Waf: Leaving directory `/home/christian/node_modules/pg/build'
Build failed: -> task failed (err #1):
{task: cxx binding.cc -> binding_1.o}
I've been looking around for setting the node path, although haven't found anything of help so far - probably also because I'm totally new to nodejs, so I'd be happy about any hint.

Now, you have NodeJS installed in your Ubuntu. You should set /etc/environment and load nodeJS path that can be executed by another users. For example:
NODE="/home/ubuntu/local/node"
NODE_PATH="/usr/local/lib/node_modules"
PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:$NODE/bin:$NODE/lib/node_modules"
#PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games"

Do this in bash:
echo 'export NODE_PATH=~/local/:~/local/node_modules' >> ~/.bashrc

before things are fixed you must use node 0.5.1 (you can use gitk to revert the tree to this version)
Auteur: Ryan Dahl <ry#tinyclouds.org> 2011-07-19 10:46:38
Auteur du commit: Ryan Dahl <ry#tinyclouds.org> 2011-07-19 10:46:38
Parent: 0a3fc1d9c8becc32c63ae736ca2b3719a3d03c5b (Remove StatWatcher's dep on C++ EventEmitter)
Enfant: 061ce7b0ac370c8a5ae93d95ab7da171cbd488f0 (net_uv: Fix simple/test-http-expect-continue.js)
Branche: master, remotes/origin/master
Suit: v0.5.1
Précède: v0.5.2
Finally remove node::EventEmitter

I had the same problem.
The issue was that I was specifying a old version of PG in my package.js
After I removed the old version dependancy I was able to install PG without issue.

Related

AOSP Android 12 Beta version build fails

I've tried to compile AOSP android 12 beta branches with no success.
I cloned the repo using:
repo init -u https://android.googlesource.com/platform/manifest -b refs/tags/android-s-beta-3
repo sync
and then used:
source build/envsetup.sh
lunch aosp_blueline-userdebug
m
now when it starts to run, after a while, it fails because there's duplication at the stub libraries:
[ 95% 86/90] out/soong/.bootstrap/bin/soong_build out/soong/build.ninja
FAILED: out/soong/build.ninja
cd "$(dirname "out/soong/.bootstrap/bin/soong_build")" && BUILDER="$PWD/$(basename "out/soong/.bootstrap/bin/soong_build")" && cd / && env -i "$BUILDER" --top "$TOP" --out "out/soong" -n "out" -d "out/soong/build.ninja.d" -t -l out/.module_paths/Android.bp.list -globFile out/soong/.bootstrap/build-globs.ninja -o out/soong/build.ninja --available_env out/soong/soong.environment.available --used_env out/soong/soong.environment.used Android.bp
error: build/soong/java/core-libraries/Android.bp:130:1: module "legacy.core.platform.api.stubs" already defined
libcore/mmodules/core_platform_api/Android.bp:182:1 <-- previous definition here
error: build/soong/java/core-libraries/Android.bp:146:1: module "stable.core.platform.api.stubs" already defined
libcore/mmodules/core_platform_api/Android.bp:198:1 <-- previous definition here
error: build/soong/java/core-libraries/Android.bp:164:1: module "legacy-core-platform-api-stubs-system-modules" already defined
libcore/mmodules/core_platform_api/Android.bp:216:1 <-- previous definition here
error: build/soong/java/core-libraries/Android.bp:180:1: module "stable-core-platform-api-stubs-system-modules" already defined
libcore/mmodules/core_platform_api/Android.bp:232:1 <-- previous definition here
error: libcore/JavaLibrary.bp:994:1: module "core.current.stubs" already defined
build/soong/java/core-libraries/Android.bp:27:1 <-- previous definition here
error: libcore/JavaLibrary.bp:1015:1: module "core-current-stubs-for-system-modules" already defined
build/soong/java/core-libraries/Android.bp:48:1 <-- previous definition here
error: libcore/JavaLibrary.bp:1041:1: module "core-current-stubs-system-modules" already defined
build/soong/java/core-libraries/Android.bp:74:1 <-- previous definition here
I've also tried to change the build/soong branch to master and I've got another build faliure.
How do I compile those beta versions? what am I missing??
Moreover, all the Android 12 betas I've tried are broken. For example, another beta 1 question
Thanks!
Ok so finally I've got this beta version compiled.
The thing I've found is that beta branch/ tag is not necessarily compiling.
So what I did is looking at:
https://android.googlesource.com/platform/
and when I ran into errors I've tried to checkout a later commit for this problematic sub-module that fixes this compilation.
Doing this until finding a combination of commits that compiled together did the magic.
If someone would like to know which specific commit I've checkout in order to get Android 12 beta 2 compiled just tell me
Actual problem is that this AOSP 12 Beta 3 is not fully synced and few of the modules were mentioned on different-2 files due to that you are getting these errors. I was also getting the same errors.
To get rid of these errors by commenting these modules in these files.
error: build/soong/java/core-libraries/Android.bp:130:1: module "legacy.core.platform.api.stubs" already defined
libcore/mmodules/core_platform_api/Android.bp:182:1 <-- previous definition here
build/soong/java/core-libraries/Android.bp line 130 you can comment this module.
/*java_library {
name: "legacy.core.platform.api.stubs",
visibility: core_platform_visibility,
hostdex: true,
compile_dex: true,
sdk_version: "none",
system_modules: "none",
static_libs: [
"art.module.public.api.stubs.module_lib",
"conscrypt.module.platform.api.stubs",
"legacy.i18n.module.platform.api.stubs",
],
patch_module: "java.base",
}*/
Same you have to do with other modules too.
https://stackoverflow.com/users/4618429/omribager Have you build AOSP 12 Beta 3 successfully if yes, please mention the process because after these fixes also I am getting other modules issue.
[100% 1/1] out/soong/.bootstrap/bin/soong_build out/soong/build.ninja
FAILED: out/soong/build.ninja
cd "$(dirname "out/soong/.bootstrap/bin/soong_build")" && BUILDER="$PWD/$(basename "out/soong/.bootstrap/bin/soong_build")" && cd / && env -i "$BUILDER" --top "$TOP" --out "out/soong" -n "out" -d "out/soong/build.ninja.d" -t -l out/.module_paths/Android.bp.list -globFile out/soong/.bootstrap/build-globs.ninja -o out/soong/build.ninja --available_env out/soong/soong.environment.available --used_env out/soong/soong.environment.used Android.bp
error: external/rust/crates/zip/Android.bp:21:1: "libzip" depends on undefined module "libflate2"
01:00:29 soong bootstrap failed with: exit status 1
failed to build some targets (01:08 (mm:ss))

installation of vmware workstation 10.0.1 on Centos 7

I am attempting to install VMware workstation 10.0.1 on a new installation of CEntOS version 7 (kernel version 3.10.0).
I have copied the vmnet.tar file from /lib/vmware/modules/source to my home directory for debugging. The building of the vmnet module fails with the following error message:
/bin/make -j12 auto-build HEADER_DIR=/lib/modules/3.10.0-123.el7.x86_64/build/include CC=/bin/gcc IS_GCC_3=no
Using 2.6.x kernel build system.
/bin/make -C /lib/modules/3.10.0-123.el7.x86_64/build/include/.. SUBDIRS=$PWD SRCROOT=$PWD/. \
MODULEBUILDDIR= modules
make[1]: Entering directory `/usr/src/kernels/3.10.0-123.el7.x86_64'
CC [M] /home/******/junk/vmnet-only/filter.o
/home/******/junk/vmnet-only/filter.c:206:1: error: conflicting types for ‘VNetFilterHookFn’
VNetFilterHookFn (unsigned int hooknum, // IN:
^
/home/******/junk/vmnet-only/filter.c:64:18: note: previous declaration of ‘VNetFilterHookFn’ was here
static nf_hookfn VNetFilterHookFn;
^
/home/******/junk/vmnet-only/filter.c:64:18: warning: ‘VNetFilterHookFn’ used but never defined [enabled by default]
/home/******/junk/vmnet-only/filter.c:206:1: warning: ‘VNetFilterHookFn’ defined but not used [-Wunused-function]
VNetFilterHookFn (unsigned int hooknum, // IN:
^
make[2]: *** [/home/******/junk/vmnet-only/filter.o] Error 1
make[1]: *** [_module_/home/******/junk/vmnet-only] Error 2
make[1]: Leaving directory `/usr/src/kernels/3.10.0-123.el7.x86_64'
make: *** [vmnet.ko] Error 2
I've googled a bit, but I didn't find anything specific to WS 10.0.1, although I did find some patches for the installation of WS 10.0.3 but it appears that these patches would be ineffective for WS 10.0.1. I believe this because the macro that they are modifying in the patch (KERNEL_VERSION) is no in the offending file, filter.c.
Anyone have a link to a solution to this problem.
Thanks!
I had a similar problem. Found this solution and worked:
cd /usr/lib/vmware/modules/source
tar -xvf vmnet.tar
cd vmnet-only
vi filter.c
Go to lines 206 and 259 and replace the string
#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 13, 0)
By
#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 0, 0)
Then:
cd ..
tar -uvf vmnet.tar vmnet-only
rm -rf vmnet-only
Then run vmware workstation again and it should be able to install the kernel modules.
Good luck!
user3910091 has the right answer. This also works on 10.0.3 on RHEL7. The strange thing is that it appears they patched this in 10.0.3, but their patch uses >= and the filter options are in the opposite order, but the same minor kernel version changes appear to fix it.
cd /usr/lib/vmware/modules/source
tar -xvf vmnet.tar
cd vmnet-only
vi filter.c
Go to around lines 206 and 259 and replace the string
#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 13, 0)
By
#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 0, 0)
Then:
cd ..
tar -uvf vmnet.tar vmnet-only
rm -rf vmnet-only
Then run /usr/bin/vmware again and it should be able to install the kernel modules.

Not able to compile PJSIP on Ubuntu for Blackberry 10

I am trying to compile PJSIP on Ubuntu according to this document:
http://supportforums.blackberry.com/t5/Native-Development/Porting-PJSIP-PJMEDIA-and-PJLIB-to-BlackBerry-10/ta-p/2085751
When I am executing this command: ./buildpjsip (it's on number 8 in document), it is showing these errors:
cp: cannot create regular file /x86/lib': No such file or directory
/home/ahsish/bb10-pjsipdemo-master/pjbuildscripts/pjsip-build /home/ahsish/bb10-pjsipdemo-master/pjbuildscripts
/home/ahsish/bb10-pjsipdemo-master/pjbuildscripts/pjsip-build/trunk /home/ahsish/bb10-pjsipdemo-master/pjbuildscripts/pjsip-build /home/ahsish/bb10-pjsipdemo-master/pjbuildscripts
Makefile:1: build.mak: No such file or directory
Makefile:2: build/host-.mak: No such file or directory
make: *** No rule to make target `build/host-.mak'. Stop.
checking build system type... i686-pc-linux-gnu
checking host system type... i486-pc-nto-qnx8.0.0
checking target system type... i486-pc-nto-qnx8.0.0
checking for i486-pc-nto-qnx8.0.0-gcc... no
checking for gcc... gcc
checking whether the C compiler works... no
aconfigure: error: in `/home/ahsish/bb10-pjsipdemo-master/pjbuildscripts/pjsip-build/trunk':
aconfigure: error: C compiler cannot create executables
See `config.log' for more details
Makefile:1: build.mak: No such file or directory
Makefile:2: build/host-.mak: No such file or directory
make: *** No rule to make target `build/host-.mak'. Stop.
Makefile:1: build.mak: No such file or directory
Makefile:2: build/host-.mak: No such file or directory
make: *** No rule to make target `build/host-.mak'. Stop.
/home/ahsish/bb10-pjsipdemo-master/pjbuildscripts/pjsip-build /home/ahsish/bb10-pjsipdemo-master/pjbuildscripts
adding: libopencore-amrwb.a (deflated 67%) adding: libopencore-amrnb.a (deflated 70%)
/home/ahsish/bb10-pjsipdemo-master/pjbuildscripts*
I also encountered the issue before and solved it successfully. I think what results in the issue is that, after you executed the step 4 in the document: Execute bbndk-env.bat or bbndk-env.sh from the root of your installation of the Native SDK. You shouldn't close the command prompt or open a new terminal. I mean you should execute the rest steps in the same terminal, then you will build the library successfully. Also, you had better ensure your gcc is the newest version. Good luck for you.
You could try first:
$ cd bb10-pjsipdemo/pjbuildscripts/pjsip-checkout/trunk
$ ./configure
$ touch pjlib/include/pj/config_site.h
$ make dep
$ make
Reference: http://www.pjsip.org/pjlib/docs/html/pjlib_build_sys_pg.htm
And then run bb10-pjsipdemo/pjbuildscripts/buildpjsip

Error in ./configure in solaris 11

Okay i am trying to install BIND on solaris 11.
Upon downloading the tar file using wget, then i used extract it out.
After which, when i enter the command :
./configure
i face the following error
checking <<some stuff>>
..
..
..
checking <<some stuff>>
checking whether we are cross compiling... configure: error: in '/home/user/user/downloads/bind9.8.2
configure: error: cannot run C compiled programs.
If you meant to cross compile, use '--host'.
so i used --host in my option, but i cant get it to work,
For example, i entered the below command :
./configure --host=ulinux-uclibc
I received an error saying
checking host system type... Invalid configuration 'ulinux-uclibc': machine 'ulinux' not recognized
Thanks! :)
Why not just install the bind package from your configured solaris publisher?
# pkg install network/dns/bind service/network/dns/bind
should get you exactly what you need. That will get you ISC Bind v9.6.3 if you use pkg.oracle.com/solaris/release publisher.

Unable to install node-mongodb-driver

I'm trying to make the node-mongodb-native driver from git, but when i try and install it i keep on getting this error:
:node-mongodb-native $ make
make -C ./external-libs/bson
rm -rf build .lock-wscript bson.node
node-waf configure build
Checking for program g++ or c++ : /usr/bin/g++
Checking for program cpp : /usr/bin/cpp
Checking for program ar : /usr/bin/ar
Checking for program ranlib : /usr/bin/ranlib
Checking for g++ : ok
Checking for node path : not found
Checking for node prefix : ok /Users/name/local/node
'configure' finished successfully (0.087s)
Waf: Entering directory `/Users/name/Sites/git/node-mongodb-native/external-libs/bson/build'
[1/9] cxx: bson.cc -> build/default/bson_1.o
[2/9] cxx: long.cc -> build/default/long_1.o
[3/9] cxx: objectid.cc -> build/default/objectid_1.o
[4/9] cxx: binary.cc -> build/default/binary_1.o
[5/9] cxx: code.cc -> build/default/code_1.o
[6/9] cxx: dbref.cc -> build/default/dbref_1.o
[7/9] cxx: timestamp.cc -> build/default/timestamp_1.o
[8/9] cxx: local.cc -> build/default/local_1.o
[9/9] cxx_link: build/default/bson_1.o build/default/long_1.o build/default/objectid_1.o
build/default/binary_1.o build/default/code_1.o
build/default/dbref_1.o build/default/timestamp_1.o
build/default/local_1.o -> build/default/bson.node
Waf: Leaving directory `/Users/name/Sites/git/node-mongodb-native/external-libs/bson/build'
'build' finished successfully (1.935s)
node.js:183
throw e; // process.nextTick error, or 'error' event on first tick
^
Error: dlopen(/Users/name/Sites/git/node-mongodb-native/external-libs/bson/build/default/bson.node, 1): Symbol not found: _ev_rt_now
Referenced from: /Users/name/Sites/git/node-mongodb-native/external-libs/bson/build/default/bson.node
Expected in: flat namespace
in /Users/name/Sites/git/node-mongodb-native/external-libs/bson/build/default/bson.node
at Object..node (module.js:472:11)
at Module.load (module.js:339:31)
at Function._load (module.js:298:12)
at require (module.js:367:19)
at Object.<anonymous> (/Users/name/Sites/git/node-mongodb-native/external-libs/bson/test_bson.js:5:10)
at Module._compile (module.js:427:26)
at Object..js (module.js:466:10)
at Module.load (module.js:339:31)
at Function._load (module.js:298:12)
at Array.<anonymous> (module.js:479:10)
make[1]: *** [all] Error 1
make: *** [build_native] Error 2
(some lines broken up for easier readability)
The suspicious part to me is this line:
Checking for node path : not found
I have this as my NODE_PATH in my ~/.bash_profile:
export NODE_PATH=/usr/local/lib/node_modules::/usr/local/lib/node
when I ls both of those directories, this is what i get:
$ ls /usr/local/lib/node
wafadmin -> ../../Cellar/node/0.4.8/lib/node/wafadmin
$ ls /usr/local/lib/node_modules
npm
I even just tried this as my NODE_PATH:
export NODE_PATH=/usr/local/lib/node_modules:/usr/local/lib/node:$HOME/local/node/lib/node_modules:$HOME/local/node/lib/node
which I don't think might be the best path b/c it has node installed in two locations which could lead to varying versions, but that's beside the point.
has anyone else had issues installing this driver?
NPM is the best choice to manage node related packages. If you already have npm, you just run npm install -g mongodb. It will install the node mongo driver into your global node_modules directory.
If you download and install node from its official website, npm will come by default.
Which version of node are you running? I was using v0.5.0-pre and I had this exact same error. Once I downgraded to v0.4.8 it worked.
brew install node
Or download v0.4.8 here