isaacs/npm — Issue #2206: npm cannot uninstall/rollback packages which contain git repositories
Author: balupton
Created: 2012-02-26 11:47:28+00:00
State: open

Hey,

One of my projects is [DocPad](https://github.com/bevry/docpad) it is a CMS which on first run will clone out a few common repositories for the user to use, to bootstrap their next project. However it seems that npm cannot remove these cloned out repositories when upgrading or uninstalling docpad.

Steps to reproduce:

1. Open Windows 7 x64. Works fine on OSX and Linux. Haven't tried other flavors of windows yet.

2. Run `npm install -g docpad`

3. Run `mkdir new-site; cd new-site; docpad run`. Select the kitchen sink skeleton by pressing `2`. This will clone out the repository inside the docpad installation directory, and copy it over to your current working directory.

4. Run `npm install -g docpad` to re-install docpad. It will fail here.

Any help would be appreciated, in the mean time I will work to making the skeletons work as npm packages, however that coud be up to 6 weeks before that is finished.

Here is the log:

```
info it worked if it ends with ok
verbose cli [ 'C:\\Program Files (x86)\\nodejs\\\\node.exe',
verbose cli 'C:\\Program Files (x86)\\nodejs\\node_modules\\npm\\bin\\npm-cli.js',
verbose cli 'install',
verbose cli '-g',
verbose cli 'docpad' ]
info using npm@1.1.0-3
info using node@v0.6.10
verbose config file C:\Users\balupton\.npmrc
verbose config file C:\Program Files (x86)\nodejs\etc\npmrc
verbose config file C:\Program Files (x86)\nodejs\node_modules\npm\npmrc
verbose mkdir done: C:\Users\balupton\AppData\Roaming\npm 755
verbose cache add [ 'docpad', null ]
silly cache add: name, spec, args [ undefined, 'docpad', [ 'docpad', null ] ]
verbose parsed url { pathname: 'docpad', path: 'docpad', href: 'docpad' }
verbose addNamed [ 'docpad', '' ]
verbose addNamed [ null, '' ]
silly name, range, hasData [ 'docpad', '', false ]
verbose raw, before any munging docpad
verbose url resolving [ 'https://registry.npmjs.org/', './docpad' ]
verbose url resolved https://registry.npmjs.org/docpad
verbose etag "EZID111CMUJJPLHEFSIOX9UR6"
http GET https://registry.npmjs.org/docpad
http 304 https://registry.npmjs.org/docpad
silly get cb [ 304,
silly get cb { server: 'CouchDB/1.1.0 (Erlang OTP/R14B04)',
silly get cb etag: '"EZID111CMUJJPLHEFSIOX9UR6"',
silly get cb date: 'Sun, 26 Feb 2012 08:01:09 GMT',
silly get cb 'content-length': '0' } ]
verbose etag docpad from cache
verbose mkdir done: C:\Users\balupton\AppData\Roaming\npm-cache\docpad 755
silly name, range, hasData 2 [ 'docpad', '', true ]
silly versions [ 'docpad',
silly versions [ '0.1.0',
silly versions '0.4.0',
silly versions '0.5.0',
silly versions '0.5.1',
silly versions '0.6.0',
silly versions '0.6.1',
silly versions '0.7.0',
silly versions '0.8.0',
silly versions '0.8.1',
silly versions '0.8.3',
silly versions '0.9.0',
silly versions '0.9.1',
silly versions '0.9.2',
silly versions '0.9.3',
silly versions '0.9.4',
silly versions '0.9.5',
silly versions '0.9.6',
silly versions '0.9.7',
silly versions '0.9.8',
silly versions '0.9.9',
silly versions '0.9.10',
silly versions '0.9.11',
silly versions '0.9.12',
silly versions '0.9.13',
silly versions '0.9.14',
silly versions '0.9.15',
silly versions '0.9.16',
silly versions '0.9.17',
silly versions '0.9.18',
silly versions '0.9.19',
silly versions '0.9.20',
silly versions '0.9.21',
silly versions '0.9.22',
silly versions '0.10.0',
silly versions '1.0.0',
silly versions '1.0.1',
silly versions '1.0.2',
silly versions '1.0.3',
silly versions '1.1.1',
silly versions '1.1.2',
silly versions '1.1.3',
silly versions '1.1.4',
silly versions '1.1.6',
silly versions '1.2.0',
silly versions '1.2.1',
silly versions '1.2.2',
silly versions '1.2.3',
silly versions '1.2.4',
silly versions '1.2.5',
silly versions '1.3.0',
silly versions '1.3.1',
silly versions '1.3.2',
silly versions '1.3.3',
silly versions '1.3.5',
silly versions '1.3.6',
silly versions '1.3.7',
silly versions '1.3.8',
silly versions '1.4.0',
silly versions '1.4.1',
silly versions '2.0.0',
silly versions '2.0.1',
silly versions '2.0.2',
silly versions '2.1.0',
silly versions '2.1.1',
silly versions '2.2.0',
silly versions '2.2.1',
silly versions '2.3.0',
silly versions '2.3.1',
silly versions '2.3.2',
silly versions '2.3.3',
silly versions '2.3.4',
silly versions '2.3.5',
silly versions '2.3.6',
silly versions '2.3.7',
silly versions '2.3.8',
silly versions '2.4.0',
silly versions '2.5.0',
silly versions '2.6.0',
silly versions '2.6.1',
silly versions '3.2.0',
silly versions '3.2.1',
silly versions '3.2.2',
silly versions '3.2.3',
silly versions '3.2.4',
silly versions '3.2.5',
silly versions '3.2.6',
silly versions '3.2.7',
silly versions '3.2.8' ] ]
verbose bin dist [ '0.6-ares1.7.5-DEV-evundefined-openssl0.9.8r-v83.6.6.20-win32-ia32-6.1.7601',
verbose bin dist { shasum: 'a2267d68de3a641ee17e6f85e4b724e45078def9',
verbose bin dist tarball: 'http://registry.npmjs.org/docpad/-/docpad-3.2.8.tgz' } ]
verbose caching C:\Users\balupton\AppData\Roaming\npm-cache\docpad\3.2.8\package\package.json
verbose loadDefaults docpad@3.2.8
silly resolved [ { name: 'docpad',
silly resolved version: '3.2.8',
silly resolved description: 'DocPad is a language agnostic document management system. This means you write your website as documents, in whatever language you wish, and DocPad will handle the compiling, templates and layouts for you. For static documents it will generate static files, for dynamic documents it\'ll re-render them on each request. You can utilise DocPad by itself, or use it as a module your own custom system. It\'s pretty cool, and well worth checking out. We love it.',
silly resolved homepage: 'https://github.com/bevry/docpad',
silly resolved keywords:
silly resolved [ 'document management system',
silly resolved 'content management system',
silly resolved 'static site generator',
silly resolved 'generator',
silly resolved 'compiler',
silly resolved 'language agnostic',
silly resolved 'dms',
silly resolved 'cms',
silly resolved 'website',
silly resolved 'blog' ],
silly resolved author:
silly resolved { name: 'Bevry Pty Ltd',
silly resolved email: 'us@bevry.me',
silly resolved url: 'http://bevry.me' },
silly resolved maintainers:
silly resolved [ { name: 'Benjamin Lupton',
silly resolved email: 'b@lupton.cc',
silly resolved url: 'http://balupton.com' } ],
silly resolved contributors:
silly resolved [ { name: 'Benjamin Lupton',
silly resolved email: 'b@lupton.cc',
silly resolved url: 'http://balupton.com' } ],
silly resolved bugs: { url: 'https://github.com/bevry/docpad/issues' },
silly resolved licenses:
silly resolved [ { type: 'MIT',
silly resolved url: 'https://github.com/bevry/docpad/blob/master/LICENSE.txt' } ],
silly resolved repository: { type: 'git', url: 'git://github.com/bevry/docpad.git' },
silly resolved dependencies:
silly resolved { 'bal-util': '1.3.x',
silly resolved express: '2.5.x',
silly resolved 'query-engine': '0.6.x',
silly resolved watchr: '1.0.x',
silly resolved caterpillar: '1.0.x',
silly resolved commander: '0.5.x',
silly resolved growl: '1.4.x',
silly resolved yaml: '0.2.1',
silly resolved 'coffee-script': '1.2.x',
silly resolved js2coffee: '0.1.x',
silly resolved underscore: '1.3.x',
silly resolved npm: '>=1.0.x',
silly resolved semver: '1.0.x' },
silly resolved devDependencies: { request: '2.9.x', mocha: '0.13.x' },
silly resolved engines: { node: '>=0.4.0' },
silly resolved directories: { lib: 'lib' },
silly resolved bin: { docpad: './bin/docpad' },
silly resolved scripts: { test: 'node ./node_modules/mocha/bin/mocha --reporter spec --ui bdd --ignore-leaks --growl' },
silly resolved main: './lib/docpad.coffee',
silly resolved _id: 'docpad@3.2.8',
silly resolved optionalDependencies: {},
silly resolved _engineSupported: true,
silly resolved _npmVersion: '1.1.0-3',
silly resolved _nodeVersion: 'v0.6.10',
silly resolved _defaultsLoaded: true } ]
info into C:\Users\balupton\AppData\Roaming\npm docpad@3.2.8
info installOne docpad@3.2.8
info unbuild C:\Users\balupton\AppData\Roaming\npm\node_modules\docpad
verbose caching C:\Users\balupton\AppData\Roaming\npm\node_modules\docpad\package.json
verbose loadDefaults docpad@3.2.8
info preuninstall docpad@3.2.8
info uninstall docpad@3.2.8
verbose unbuild docpad@3.2.8 [ true,
verbose unbuild docpad@3.2.8 'C:\\Users\\balupton\\AppData\\Roaming\\npm\\node_modules',
verbose unbuild docpad@3.2.8 'C:\\Users\\balupton\\AppData\\Roaming\\npm\\node_modules' ]
verbose binRoot [ 'C:\\Users\\balupton\\AppData\\Roaming\\npm',
verbose binRoot { docpad: './bin/docpad' } ]
info postuninstall docpad@3.2.8
ERR! error installing docpad@3.2.8
info unbuild C:\Users\balupton\AppData\Roaming\npm\node_modules\docpad
ERR! error rolling back docpad@3.2.8 Error: EPERM, operation not permitted 'C:\Users\balupton\AppData\Roaming\npm\node_modules\docpad\lib\exchange\skeletons\canvas.docpad\.git\objects\pack\pack-263f1b01db666cb4fde611da0079d1c61f708048.idx'
verbose installOne cb docpad@3.2.8
ERR! Error: EPERM, operation not permitted 'C:\Users\balupton\AppData\Roaming\npm\node_modules\docpad\lib\exchange\skeletons\canvas.docpad\.git\objects\pack\pack-263f1b01db666cb4fde611da0079d1c61f708048.idx'
ERR!
ERR! Please try running this command again as root/Administrator.
ERR!
ERR! System Windows_NT 6.1.7601
ERR! command "C:\\Program Files (x86)\\nodejs\\\\node.exe" "C:\\Program Files (x86)\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "install" "-g" "docpad"
ERR! cwd C:\projects\new2
ERR! node -v v0.6.10
ERR! npm -v 1.1.0-3
ERR! path C:\Users\balupton\AppData\Roaming\npm\node_modules\docpad\lib\exchange\skeletons\canvas.docpad\.git\objects\pack\pack-263f1b01db666cb4fde611da0079d1c61f708048.idx
ERR! code EPERM
ERR! message EPERM, operation not permitted 'C:\Users\balupton\AppData\Roaming\npm\node_modules\docpad\lib\exchange\skeletons\canvas.docpad\.git\objects\pack\pack-263f1b01db666cb4fde611da0079d1c61f708048.idx'
ERR! errno {}
verbose exit [ 1, true ]
```