Skip to content
This repository has been archived by the owner on Aug 11, 2022. It is now read-only.

npm link <path> broken #6850

Closed
nigelzor opened this issue Dec 4, 2014 · 3 comments
Closed

npm link <path> broken #6850

nigelzor opened this issue Dec 4, 2014 · 3 comments
Labels

Comments

@nigelzor
Copy link
Contributor

nigelzor commented Dec 4, 2014

git clone https://github.com/npm/fs-vacuum.git
mkdir example
cd example
npm link ../fs-vacuum

results in

npm ERR! Linux 3.16.0-24-generic
npm ERR! argv "node" "/home/neil/bin/npm" "link" "../fs-vacuum"
npm ERR! node v0.10.33
npm ERR! npm  v2.1.11

npm ERR! /home/neil/npm-repro/fs-vacuum/node_modules/mkdirp is not a child of /home/neil/npm-repro/example
npm ERR! 
npm ERR! If you need help, you may report this error at:
npm ERR!     <http://github.com/npm/npm/issues>
npm ERR! error rolling back Error: /home/neil/npm-repro/fs-vacuum/node_modules/mkdirp is not a child of /home/neil/npm-repro/example
npm ERR! error rolling back     at vacuum (/home/neil/lib/node_modules/npm/node_modules/fs-vacuum/vacuum.js:24:15)
npm ERR! error rolling back     at gentlyRm (/home/neil/lib/node_modules/npm/lib/utils/gently-rm.js:47:12)
npm ERR! error rolling back     at /home/neil/lib/node_modules/npm/lib/unbuild.js:30:20
npm ERR! error rolling back     at /home/neil/lib/node_modules/npm/node_modules/read-package-json/read-json.js:51:40
npm ERR! error rolling back     at /home/neil/lib/node_modules/npm/node_modules/read-package-json/read-json.js:97:49
npm ERR! error rolling back     at evalmachine.<anonymous>:207:20
npm ERR! error rolling back     at OpenReq.Req.done (/home/neil/lib/node_modules/npm/node_modules/graceful-fs/graceful-fs.js:141:5)
npm ERR! error rolling back     at OpenReq.done (/home/neil/lib/node_modules/npm/node_modules/graceful-fs/graceful-fs.js:61:22)
npm ERR! error rolling back     at Object.oncomplete (evalmachine.<anonymous>:107:15)
npm ERR! error rolling back  [Error: /home/neil/npm-repro/fs-vacuum/node_modules/mkdirp is not a child of /home/neil/npm-repro/example]

At https://github.com/npm/npm/blob/v2.1.9/lib/unbuild.js#L30 gentlyRm should be called with the link target instead of npm.prefix, but we no longer know it.

@othiym23
Copy link
Contributor

othiym23 commented Dec 5, 2014

The good news is that gentlyRm is getting better at doing its job (removing paths managed by npm and only paths managed by npm). The bad news is that we're running into a bunch of edge cases where it's being too safe now. This is a good find. Thanks. I'll try to get this fixed soon.

@othiym23
Copy link
Contributor

This should be fixed by 29a6ef3, which is part of npm@2.4.0. Can you install npm@next (npm -g install npm@next) and confirm? If it is fixed, can you please close this issue?

@nigelzor
Copy link
Contributor Author

Seems to be working here. Thanks!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

2 participants