Custom OpenShift and NPM cartridge

I work with a community developed OpenShift package for nginx. The cartridge design of the script (without any changes) works well; it starts the nginx server with the configuration file that I provide it. However, I am trying to modify the construction of the script so that it first changes the directory in my OpenShift repository, launches npm installand then grunt buildto create the Angular application that I created.

When I do this, I constantly get an error EACCES, mkdir '/var/lib/openshift/xxxxxxxxxx/.npm'when the script gets the value npm install. Some OpenShift posts have tried to solve the problem, but it seems like a different solution is needed (at least in my case).

So, I am wondering if npm can be used that way, or if I need to create a cartridge that does it all on its own.

0
source share
2 answers

Since creation ~/.npmusually does not require access, we must find ways to move the npm cache (usually ~/.npm) and the user configuration of npm (usually ~/.npmrc) to accessible folders to get everything going. The following information comes in part from a report I submitted to Redhat on this subject.

.npmrc. ( ) .env $OPENSHIFT_DATA_DIR. :

export NPM_CONFIG_USERCONFIG=$OPENSHIFT_HOMEDIR/app-root/build-dependencies/.npmrc

.npmrc , /. , .npmrc $OPENSHIFT_HOMEDIR/app-root/build-dependencies/. , webhook/ script, :

touch $OPENSHIFT_DATA_DIR/.env

, , .npmrc, /. npm. touch .env .npm $OPENSHIFT_HOMEDIR/app-root/build-dependencies/. :

npm config set cache $OPENSHIFT_HOMEDIR/app-root/build-dependencies/.npm

NPM , NodeJS. .

+3

All Articles