Custom node.js version on Openshift

2019-05-21 05:15发布

问题:

I am having trouble running custom node version on node0.10 cartridge on open shift which you can find here.

I get to install the new node version just great, however open shift keeps using the old node 10.25.

Deoploy log:

remote: Activating deployment
remote:   - Checking to see if Node.js version 0.10.33 is installed ... 
remote:   - Node.js version 0.10.33 is already installed
remote: 
remote:   - pre_start_nodejs: Adding Node.js version 0.10.33 binaries to path
remote: -this is the path: /var/lib/openshift/54b6ea6e4382ece151000039/app-root/data/node-v0.10.33-linux-x64/bin:/var/lib/openshift/54b6ea6e4382ece151000039/app-root/runtime/repo/node_modules/.bin:/var/lib/openshift/54b6ea6e4382ece151000039//.node_modules/.bin:/opt/rh/nodejs010/root/usr/bin:/bin:/usr/bin:/usr/sbin 
remote:   - PATH set to include custom node version (0.10.33) from
remote:        /var/lib/openshift/54b6ea6e4382ece151000039/app-root/data/node-v0.10.33-linux-x64/bin 
remote:     PATH = /var/lib/openshift/54b6ea6e4382ece151000039/app-root/data/node-v0.10.33-linux-x64/bin:/var/lib/openshift/54b6ea6e4382ece151000039/app-root/runtime/repo/node_modules/.bin:/var/lib/openshift/54b6ea6e4382ece151000039//.node_modules/.bin:/opt/rh/nodejs010/root/usr/bin:/bin:/usr/bin:/usr/sbin
remote: Starting NodeJS cartridge

Everything looks great and awesome, until I run the app which says: 10.25...

rhc tail:

v0.10.25

/opt/rh/nodejs010/root/usr/bin:/opt/rh/v8314/root/usr/bin:/var/lib/openshift/54b6feb9e0b8cd56c00000e1/app-root/data/node-v0.10.33-linux-x64/bin:/var/lib/openshift/54b6feb9e0b8cd56c00000e1/app-root/runtime/repo/node_modules/.bin:/var/lib/openshift/54b6feb9e0b8cd56c00000e1//.node_modules/.bin:/opt/rh/nodejs010/root/usr/bin:/bin:/usr/bin:/usr/sbin

undefined

Even when i rhc ssh to my app and try node -v i get 10.33...

on start time the PATH env gets overwritten and causes node to use the old bins...

PS: I am trying to deploy a Meteor app (1.0.2.1)

回答1:

Nevermind, figured it out :-)

If you want to use custom node @openshift take a look at this repo.

Hope I get to help someone!