Thursday, July 31, 2014

Nodejs: your global modules don't work after installing

Another linux distribution enigma.

In the name of Tutatis, why f**** the node_modules directories are different in  npm and "distro" packages????. The error message is similar to:
Error: Cannot find module 'any_npm_module'
at Function.Module._resolveFilename (module.js:338:15)
at Function.Module._load (module.js:280:25)
at Module.require (module.js:364:17)
at require (module.js:380:17)
at repl:1:7
at REPLServer.self.eval (repl.js:110:21)
at repl.js:249:20
at REPLServer.self.eval (repl.js:122:7)
at Interface.<anonymous> (repl.js:239:12)
at Interface.emit (events.js:95:17)
Surprise!!!

CentOS, Fedora, Ubuntu, Debian and MacOSX-ports are using diferent path for the nodejs global modules. If you install the binary of "node" and "npm", and later, you choose to use npm to install some modules, your modules will be dissapeared.

Workarounds:
  1. Compile your own node/npm version (LOL!).
  2. Use local modules always (for command line scripts is very LOL!)
  3. Use NODE_PATH to point to the correct path:
    1. Standard profile: For only one user, you can use .profile, .bash_profile or .bashrc $HOME files (be careful if you are doing login, it uses only one kind of file so choose the correct one).
    2. Developer Eclipse: You can configure environment variables in the properties of the main js file of your project. So you could put NODE_PATH there. 
    3. Daemon/Service profile: Launch from init.d. You could create a correct init.d script with the NODE_PATH inside ;)
    4. Master of node global modules (one ring to bring them all):
      1. Linux: you need to create /etc/profile.d/nodejs.sh with the export NODE_PATH path there. (And restart)
      2. MacOSx: you need to create the crazy and non-existentz /etc/launchd.conf and write this line: setenv NODE_PATH /usr/local/lib/node_modules. And restart.
:) 



Wednesday, July 30, 2014

Glassfish 4: Updating Weld

Summary:

Updating Weld (http://delabassee.com/blog/?p=286):
1. Grab the Weld 2.0.5 OSGi bundle and copy it to the GF modules directory:
cp weld-osgi-bundle-2.0.5.Final.jar glassfish/modules/
2. Restart GlassFish:
glassfish/bin/asadmin restart-domain domain1
3. You check which version is now installed by issuing:
glassfish/bin/asadmin osgi lb | grep 'Weld OSGi'

Thursday, July 24, 2014

Ubuntu/Debian: nodejs package provides nodejs binary and not node binary

Crazy and f*%*%* linux distribution world

Error:
/usr/sbin/node: No such file or directory
Someone in Debian (and Ubuntu then) chose to eliminate "node" binary from nodejs package. Now the binary is "nodejs". So, for Eclipse, and some scripts, node does not work although nodejs package is installed!

Well.... the same guy has preferred to create a second package to solve that. The package is "nodejs-legacy".

So, please, poor Debian/Ubuntu user, you need to remember that when you install node:
apt-get install nodejs nodejs-legacy
It is the life.




Wednesday, July 23, 2014

Nodejs - npm - Error: SELF_SIGNED_CERT_IN_CHAIN

New error in the npm port package in Mavericks (OSX 10.9.4):
npm ERR! Error: SELF_SIGNED_CERT_IN_CHAIN
Workaround:
npm config set ca ""
And re-install the module.

;)

Wednesday, July 16, 2014

Half Dome

Tim Cook:


Me, some days before:
























:)

Thursday, July 3, 2014

Changing ONBOOT value in RHEL/CentOS with networkmanager enabled.

Sometimes the RHEL world has odd things. For example:

If you want to configure a network interface using NetworkManager (without X!!!) you can do it with system-config-network script. From here, you can change the network configuration and DNS/hostname of the box.

What is the problem then?

The network interfaces could be enabled or disabled in boot time. You can see that in the configuration file (etc/sysconfig/network-scripts/ifcfg-<interfacename>) It is something like:
ONBOOT=yes  or ONBOOT=No
But we are talking about using NetwortManager (in that file NM_CONTROLLED=yes) so you cannot edit and change that value directly.

What is the way then?

You go to the famous  system-config-network script and you will discover there is not option to change the ONBOOT value.

WTF!

Well, the way to change this value is very crazy.

You will need export the NetworkManager configuration from terminal:
system-config-network-cmd > export.cfg
Modify the correct line of your network interface. For example:
DeviceList.Ethernet.eth0.OnBoot=False 
to:
DeviceList.Ethernet.eth0.OnBoot=True
Save the file and import it with:
system-config-network-cmd -i < export.cfg
TADAAA!!!

Crazy, i know.


Tuesday, July 1, 2014

Show RAID recovery process from Dell PERC H710 disks on CentOS

You will need to install MegaCLI (read this: http://vicendominguez.blogspot.com.es/2014/02/dell-h710p-equivalent-to-lsi-megaraid.html)

Two commands from here:

  • Show and exit:

/opt/MegaRAID/MegaCli/MegaCli64 -PDRbld -ShowProg -PhysDrv \[32:0\] -a0

  • Continuos:
  /opt/MegaRAID/MegaCli/MegaCli64 -PDRbld -ProgDsply -PhysDrv \[32:0\] -a0

The value [32:0] is a value for [Enclosure:Slot]

To get enclosure number there are two possible commands (choose):
/opt/MegaRAID/MegaCli/MegaCli64 -PDList -aALL
/opt/MegaRAID/MegaCli/MegaCli64 -EncInfo -aALL
Some more info: http://www.maths.cam.ac.uk/computing/docs/public/megacli_raid_lsi.html

:)