toolness / p5.js-docker

Experimental docker setup to make p5.js + p5js.org development easier.
12 stars 4 forks source link

npm install fails #3

Closed toolness closed 8 years ago

toolness commented 8 years ago

This is happening on my OS X machine:

p5_1      | npm info installOne reqwest@1.1.6
p5_1      | npm ERR! tar.unpack untar error /home/atul/.npm/grunt-contrib-connect/0.9.0/package.tgz
p5_1      | npm ERR! tar.unpack untar error /home/atul/.npm/grunt-contrib-uglify/0.7.0/package.tgz
p5_1      | npm ERR! tar.unpack untar error /home/atul/.npm/grunt-contrib-concat/0.5.1/package.tgz
p5_1      | npm ERR! tar.unpack untar error /home/atul/.npm/grunt-contrib-requirejs/0.4.4/package.tgz
p5_1      | npm ERR! tar.unpack untar error /home/atul/.npm/grunt/0.4.5/package.tgz
p5_1      | npm ERR! tar.unpack untar error /home/atul/.npm/amdclean/0.3.3/package.tgz
p5_1      | npm ERR! tar.unpack untar error /home/atul/.npm/grunt-release-it/0.2.1/package.tgz
p5_1      | npm ERR! tar.unpack untar error /home/atul/.npm/grunt-contrib-jshint/0.11.3/package.tgz
p5_1      | npm ERR! tar.unpack untar error /home/atul/.npm/grunt-lib-phantomjs/0.4.0/package.tgz
p5_1      | npm ERR! tar.unpack untar error /home/atul/.npm/grunt-contrib-yuidoc/0.5.2/package.tgz
p5_1      | npm ERR! tar.unpack untar error /home/atul/.npm/jscs-stylish/0.3.1/package.tgz
p5_1      | npm ERR! tar.unpack untar error /home/atul/.npm/concat-files/0.1.0/package.tgz
p5_1      | npm ERR! tar.unpack untar error /home/atul/.npm/grunt-saucelabs/8.6.1/package.tgz
p5_1      | npm ERR! tar.unpack untar error /home/atul/.npm/derequire/2.0.3/package.tgz
p5_1      | npm ERR! tar.unpack untar error /home/atul/.npm/grunt-jscs/1.8.0/package.tgz
p5_1      | npm ERR! tar.unpack untar error /home/atul/.npm/brfs/1.4.3/package.tgz
p5_1      | npm ERR! tar.unpack untar error /home/atul/.npm/reqwest/1.1.6/package.tgz
p5_1      | npm ERR! tar.unpack untar error /home/atul/.npm/grunt-update-json/0.2.2/package.tgz
p5_1      | npm ERR! tar.unpack untar error /home/atul/.npm/grunt-newer/1.1.1/package.tgz
p5_1      | npm ERR! tar.unpack untar error /home/atul/.npm/grunt-contrib-watch/0.5.3/package.tgz
p5_1      | npm ERR! tar.unpack untar error /home/atul/.npm/grunt-mocha/0.4.15/package.tgz
p5_1      | npm ERR! tar.unpack untar error /home/atul/.npm/grunt-cli/0.1.13/package.tgz
p5_1      | npm ERR! tar.unpack untar error /home/atul/.npm/phantomjs/1.9.19/package.tgz
p5_1      | npm ERR! tar.unpack untar error /home/atul/.npm/browserify/11.2.0/package.tgz
p5_1      | npm ERR! tar.unpack untar error /home/atul/.npm/opentype.js/0.4.11/package.tgz
p5_1      | npm ERR! Linux 4.1.13-boot2docker
p5_1      | npm ERR! argv "/usr/local/bin/node" "/usr/local/bin/npm" "install"
p5_1      | npm ERR! node v4.2.6
p5_1      | npm ERR! npm  v2.14.12
p5_1      | npm ERR! path /var/p5.js/node_modules
p5_1      | npm ERR! code EACCES
p5_1      | npm ERR! errno -13
p5_1      | npm ERR! syscall mkdir
p5_1      | 
p5_1      | npm ERR! Error: EACCES: permission denied, mkdir '/var/p5.js/node_modules'
p5_1      | npm ERR!     at Error (native)
p5_1      | npm ERR!  { [Error: EACCES: permission denied, mkdir '/var/p5.js/node_modules']
p5_1      | npm ERR!   errno: -13,
p5_1      | npm ERR!   code: 'EACCES',
p5_1      | npm ERR!   syscall: 'mkdir',
p5_1      | npm ERR!   path: '/var/p5.js/node_modules',
p5_1      | npm ERR!   fstream_type: 'Directory',
p5_1      | npm ERR!   fstream_path: '/var/p5.js/node_modules/grunt-contrib-connect',
p5_1      | npm ERR!   fstream_class: 'DirWriter',
p5_1      | npm ERR!   fstream_stack: 
p5_1      | npm ERR!    [ '/usr/local/lib/node_modules/npm/node_modules/fstream/lib/writer.js:171:25',
p5_1      | npm ERR!      '/usr/local/lib/node_modules/npm/node_modules/mkdirp/index.js:47:53',
p5_1      | npm ERR!      'FSReqWrap.oncomplete (fs.js:82:15)' ] }
p5_1      | npm ERR! 
p5_1      | npm ERR! Please try running this command again as root/Administrator.
p5_1      | npm ERR! Linux 4.1.13-boot2docker
p5_1      | npm ERR! argv "/usr/local/bin/node" "/usr/local/bin/npm" "install"
p5_1      | npm ERR! node v4.2.6
p5_1      | npm ERR! npm  v2.14.12
p5_1      | npm ERR! path npm-debug.log.6a751d59e2521430d6d59745da332c69
p5_1      | npm ERR! code EACCES
p5_1      | npm ERR! errno -13
p5_1      | npm ERR! syscall open
p5_1      | 
p5_1      | npm ERR! Error: EACCES: permission denied, open 'npm-debug.log.6a751d59e2521430d6d59745da332c69'
p5_1      | npm ERR!     at Error (native)
p5_1      | npm ERR!  { [Error: EACCES: permission denied, open 'npm-debug.log.6a751d59e2521430d6d59745da332c69']
p5_1      | npm ERR!   errno: -13,
p5_1      | npm ERR!   code: 'EACCES',
p5_1      | npm ERR!   syscall: 'open',
p5_1      | npm ERR!   path: 'npm-debug.log.6a751d59e2521430d6d59745da332c69' }
p5_1      | npm ERR! 
p5_1      | npm ERR! Please try running this command again as root/Administrator.
p5_1      | 
p5_1      | npm ERR! Please include the following file with any support request:
p5_1      | npm ERR!     /var/p5.js/npm-debug.log
p5_1      | child_process.js:507
p5_1      |     throw err;
p5_1      |     ^
p5_1      | 
p5_1      | Error: Command failed: npm install
p5_1      |     at checkExecSyncError (child_process.js:464:13)
p5_1      |     at Object.execSync (child_process.js:504:13)
p5_1      |     at Object.exports.runSync (/var/p5.js/p5-website-bridge/process-util.js:15:17)
p5_1      |     at Object.<anonymous> (/var/p5.js/p5-website-bridge/start.js:5:7)
p5_1      |     at Module._compile (module.js:410:26)
p5_1      |     at Object.Module._extensions..js (module.js:417:10)
p5_1      |     at Module.load (module.js:344:32)
p5_1      |     at Function.Module._load (module.js:301:12)
p5_1      |     at Function.Module.runMain (module.js:442:10)
p5_1      |     at startup (node.js:136:18)
p5jsdocker_p5_1 exited with code 1
^CGracefully stopping... (press Ctrl+C again to force)
Stopping p5jsdocker_website_1 ... done
website_1 | [Fri Jan 29 16:38:19.805802 2016] [mpm_prefork:notice] [pid 1] AH00169: caught SIGTERM, shutting down
p5jsdocker_website_1 exited with code 0
toolness commented 8 years ago

Hmm so my uid on my OS X machine is 501, but the container says /var/p5.js is owned by uid 1000.

I think this is happening because of funky docker-machine indirection.

However, it makes me realize that one easy way to do the UID switch, without needing to communicate it explicitly via HOST_UID, is to simply stat /var/p5.js on container startup, and use the UID of its owner.

toolness commented 8 years ago

I was worried that OS X wouldn't be able to read files made with uid 1000 on the docker host, but VirtualBox seems to map everything back to my OS X user (uid 501) just fine! Woot!!

Um except now npm install seems to be going in an infinite loop for some reason... oy