blackberry / BB10-Webworks-Packager

The BB10 WebWorks Packager bundles the App content with the BB10 WebWorks Framework to create a BAR to run on the BB10 Device (or simulator)
27 stars 18 forks source link

configure does not handle permissions gracefully. #258

Open lewellyn opened 11 years ago

lewellyn commented 11 years ago

Currently, onfigure uses a mix of npm invocations, some by invoking sudo and some by running in the user's context. This causes permissions issues if the user has never invoked npm before:

npm ERR! Error: EACCES, open '/home/lewellyn/.npm/e81c1faa-jasmine-node-1-0-7.lock'
npm ERR!  { [Error: EACCES, open '/home/lewellyn/.npm/e81c1faa-jasmine-node-1-0-7.lock']
npm ERR!   errno: 3,
npm ERR!   code: 'EACCES',
npm ERR!   path: '/home/lewellyn/.npm/e81c1faa-jasmine-node-1-0-7.lock' }
npm ERR! 
npm ERR! Please try running this command again as root/Administrator.

The status of $HOME/.npm is, not surprisingly, as follows:

drwxr-xr-x 15 root root 4096 Feb  5 21:10 /home/lewellyn/.npm/

Tested on a stock install of Ubuntu 12.10 with the following post-install configuration:

lewellyn commented 11 years ago

I see two possible solutions here.

  1. Try to run npm as the user or as root, consistently.
  2. Ensure that $HOME/.npm exists prior to invoking npm, and is owned by the user.

I'm not in a position to make any judgements about the first option, so lacking any better ideas, I personally prefer the latter.