Note: This is a beta release of Red Hat Bugzilla 5.0. The data contained within is a snapshot of the live data so any changes you make will not be reflected in the production Bugzilla. Also email is disabled so feel free to test any aspect of the site that you want. File any problems you find or give feedback here.
Bug 1066097 - Jenkins is not able to install npm packages
Summary: Jenkins is not able to install npm packages
Alias: None
Product: OpenShift Online
Classification: Red Hat
Component: Image
Version: 2.x
Hardware: Unspecified
OS: Unspecified
Target Milestone: ---
: ---
Assignee: Dan McPherson
QA Contact: libra bugs
: 1067054 (view as bug list)
Depends On:
TreeView+ depends on / blocked
Reported: 2014-02-17 16:43 UTC by Eric Rich
Modified: 2018-12-04 17:31 UTC (History)
0 users

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Last Closed: 2014-02-17 17:35:05 UTC
Target Upstream Version:

Attachments (Terms of Use)

System ID Priority Status Summary Last Updated
Red Hat Knowledge Base (Solution) 718643 None None None Never

Description Eric Rich 2014-02-17 16:43:13 UTC
Description of problem:

As part of the build process I need Jenkins to run Grunt build to build the UI before the Jenikns build process starts.
I have tried to install Yeoman on the Jenkins instance but since I am not the administrator I am getting Access errors.

[\> npm install -g yo
npm ERR! Error: EACCES, mkdir '/var/lib/openshift/<ID>/.npm'
npm ERR!  { [Error: EACCES, mkdir '/var/lib/openshift/<ID>/.npm']
npm ERR!   errno: 3,
npm ERR!   code: 'EACCES',
npm ERR!   path: '/var/lib/openshift/<ID>/.npm' }
npm ERR!
npm ERR! Please try running this command again as root/Administrator.

How reproducible: Very

Steps to Reproduce:
1. rhc app create Jarvis jenkins-1
2. rhc app create t7 jbossews-2.0 jenkins-client-1
3. Edit the build script on Jenkins to run `npm install yo`, just before `gear build`.
4. cd t7/ ; vim 
5. git commit -am "Changed Read Me, to tests jekins build."; git push

Actual results:

remote: Waiting for build to schedule....Done
remote: Waiting for job to complete...........Done
remote: FAILED
remote: !!!!!!!!
remote: Deployment Halted!
remote: If the build failed before the deploy step, your previous
remote: build is still running.  Otherwise, your application may be
remote: partially deployed or inaccessible.
remote: Fix the build and try again.
remote: !!!!!!!!
remote: An error occurred executing 'gear postreceive' (exit code: 1)
remote: Error message: CLIENT_ERROR: Failed to execute: 'control post-receive' for /var/lib/openshift/UUID/jenkins-client

Expected results:

A successful build. 

Additional info:

The reason why it is suspected that this can not be done is because of the Jenkins cartridges locking configuration: 


5.1. Lock Configuration
The metadata/managed_files.yml locked_files entry lists the files and directories, one per line, that will be provided to the cartridge author with read/write access while the cartridge is unlocked, but only read access to the application developer while the cartridge is locked.

Any non-existent files that are included in the list will be created before your setup script is called. Any missing parent directories will be created as needed. The list is anchored at the cartridge’s directory. An entry ending in slash is processed as a directory. Entries ending in asterisk are a list of files. Entries ending in any other character are considered files. OpenShift will not attempt to change files to directories or vice versa, and your cartridge may fail to operate if files are miscategorized and you depend on OpenShift to create them.

Example 1. Lock Configuration Example
Here is a locked_files entry for a PHP cartridge:

- ~/.pearrc 
- bin/ 
- conf/* 

The file ~/.pearrc will be created, if it does not exist, and be made editable by you.

The directory php/bin is locked but not the files it contains. While you can add files, both you and the application developer can edit any files contained.
The files in php/conf are locked but the directory itself is not, so you or the application developer can add files, but only you can edit them.
Directories like ~/.node-gyp and ~/.npm in nodejs are NOT candidates to be created in this manner as they require the application developer to have read and write access while the application is deploying and running. These directories would need to be created by the nodejs setup or install scripts.


I tried creating a custom Jenkins cartridge ( to get around this the same way the node.js cartridge does, but could not get this to create the ~/.node-gyp and ~/.npm directories or the ~.npmrc file in the same way the nodejs cartridge does.

Comment 1 Dan McPherson 2014-02-17 17:35:05 UTC
This is a similar request to:

I have added a new card for npm:

Comment 2 Dan McPherson 2014-02-19 15:24:22 UTC
*** Bug 1067054 has been marked as a duplicate of this bug. ***

Note You need to log in before you can comment on or make changes to this bug.