Uninstall refusing to delete .bin files - npm 3.3.0 #9394

Closed
bdukes opened this Issue Aug 24, 2015 · 7 comments

Projects

None yet

6 participants

@bdukes
bdukes commented Aug 24, 2015

Using npm 3.3.0, I get an error trying to uninstall the module nativefier:

Refusing to delete: C:\Code\npm-uninstall-test\node_modules.bin\nativefier.cmd not in C:\Code\npm-uninstall-test\node_modules\nativefier

I was able to uninstall a different package. I do not get the error in npm 2.14.0. I'm running Windows 10.

See silly log output

@othiym23 othiym23 added this to the 3.x milestone Aug 24, 2015
@othiym23 othiym23 added the bug label Aug 24, 2015
@othiym23
Contributor
npm ERR! gentlyRm C:\Code\npm-uninstall-test\node_modules\.bin\nativefier.cmd is outside C:\Code\npm-uninstall-test\node_modules\nativefier and not a link

Whoops! Looks like our deletion code needs to be made aware that cmd shims are a thing, @iarna. 😭

Thanks for the report, @bdukes, and we'll try to get this fixed soon!

@iarna
Member
iarna commented Aug 24, 2015

That was surely caused by #9198

@robertbaker

@iarna please fix this and release #9095 asap. It's really annoying

@amyspark
amyspark commented Sep 5, 2015

Using npm 3.3.2, this bug is still present.
node install gulp-sass@"~2.0.4" --save

npm ERR! Refusing to delete: d:\Documents\Amyspark\TheSilvermoonSentinelFrontend\node_modules\node-sass\node_modules\.bin\supports-color.cmd not in d:\Documents\Amyspark\TheSilvermoonSentinelFrontend\node_modules\node-sass\node_modules\supports-color
File exists: d:\Documents\Amyspark\TheSilvermoonSentinelFrontend\node_modules\node-sass\node_modules\.bin\supports-color.cmd
Move it away, and try again.
@iarna iarna modified the milestone: 3.x-next, 3.x Sep 8, 2015
@iarna
Member
iarna commented Sep 11, 2015

Good news, this should be fixed as of 3.3.3!

@iarna iarna closed this Sep 11, 2015
@vjpr
vjpr commented Oct 19, 2015

I'm having this same issue with npm 2.14.8.

For example:

cd ~/dev-live/foo
npm link ~/dev/gulp4

causes:

npm ERR! Refusing to delete: ~/dev/gulp4/node_modules/.bin/gulp not in ~/dev-live/foo
File exists: ~/dev/gulp4/node_modules/.bin/gulp
Move it away, and try again. 
npm ERR! gentlyRm ~/dev/gulp4/node_modules/gulp-cli/bin/gulp.js symlink target ~/dev/gulp4/node_modules/.bin/gulp is not controlled by npm ~/dev-live/foo
npm ERR! error rolling back Error: Refusing to delete: ~/dev/gulp4/node_modules/.bin/gulp not in ~/dev-live/foo
npm ERR! error rolling back     at clobberFail (/usr/local/lib/node_modules/npm/lib/utils/gently-rm.js:193:12)
npm ERR! error rolling back     at /usr/local/lib/node_modules/npm/lib/utils/gently-rm.js:132:18
npm ERR! error rolling back     at FSReqWrap.oncomplete (fs.js:95:15)
npm ERR! error rolling back  { [Error: Refusing to delete: ~/dev/gulp4/node_modules/.bin/gulp not in ~/dev-live/foo]
npm ERR! error rolling back   code: 'EEXIST',
npm ERR! error rolling back   path: '~/dev/gulp4/node_modules/.bin/gulp' }

npm linking any module which has a local gulp install causes this error.

Here is some npm-debug.log:

112 verbose installOne of gulp-cli to /Users/Vaughan/dev/gulp4 not in flight; installing
113 verbose lock using /Users/Vaughan/.npm/_locks/gulp-cli-124017db7c503212.lock for /Users/Vaughan/dev/gulp4/node_modules/gulp-cli
114 silly install write writing gulp-cli 0.4.0 to /Users/Vaughan/dev/gulp4/node_modules/gulp-cli
115 verbose unbuild e_modules/gulp-cli
116 info preuninstall gulp-cli@0.4.0
117 info uninstall gulp-cli@0.4.0
118 verbose unbuild rmStuff gulp-cli@0.4.0 from /Users/Vaughan/dev-live/foo/node_modules
119 verbose unbuild rmStuff in /Users/Vaughan/dev/gulp4/node_modules
120 silly gentlyRm /Users/Vaughan/dev/gulp4/node_modules/.bin/gulp is being gently removed
121 silly gentlyRm verifying /Users/Vaughan/dev-live/foo is an npm working directory
122 silly gentlyRm containing path /Users/Vaughan/dev-live/foo is under npm's control, in /Users/Vaughan/dev-live/foo
123 silly gentlyRm /Users/Vaughan/dev/gulp4/node_modules/.bin/gulp is not under /Users/Vaughan/dev-live/foo
124 silly gentlyRm verifying /Users/Vaughan/dev/gulp4/node_modules/.bin/gulp is an npm working directory
125 silly isManaged /Users/Vaughan/dev/gulp4/node_modules/.bin/gulp-cli/bin/gulp.js is not inside /Users/Vaughan/dev-live/foo
126 silly isManaged /Users/Vaughan/dev/gulp4/node_modules/.bin/gulp-cli/bin/gulp.js is not inside /usr/local
127 silly isManaged /Users/Vaughan/dev/gulp4/node_modules/.bin/gulp-cli/bin/gulp.js is not inside /Users/Vaughan/dev-live/foo/node_modules
128 silly isManaged /Users/Vaughan/dev/gulp4/node_modules/.bin/gulp-cli/bin/gulp.js is not inside /Users/Vaughan/dev-live/foo/node_modules
129 silly isManaged /Users/Vaughan/dev/gulp4/node_modules/.bin/gulp-cli/bin/gulp.js is not inside /usr/local/lib/node_modules
130 silly isManaged /Users/Vaughan/dev/gulp4/node_modules/.bin/gulp-cli/bin/gulp.js is not inside /Users/Vaughan/dev-live/foo/node_modules/.bin
131 silly isManaged /Users/Vaughan/dev/gulp4/node_modules/.bin/gulp-cli/bin/gulp.js is not inside /usr/local/bin
132 verbose gentlyRm /Users/Vaughan/dev/gulp4/node_modules/.bin/gulp is not under npm's control
133 silly gentlyRm checking to see if /Users/Vaughan/dev/gulp4/node_modules/.bin/gulp is a link
134 silly gentlyRm /Users/Vaughan/dev/gulp4/node_modules/.bin/gulp is a link
135 error gentlyRm /Users/Vaughan/dev/gulp4/node_modules/gulp-cli/bin/gulp.js symlink target /Users/Vaughan/dev/gulp4/node_modules/.bin/gulp is not controlled by npm /Users/Vaughan/dev-live/foo
136 verbose unlock done using /Users/Vaughan/.npm/_locks/gulp-cli-124017db7c503212.lock for /Users/Vaughan/dev/gulp4/node_modules/gulp-cli
137 verbose stack Error: Refusing to delete: /Users/Vaughan/dev/gulp4/node_modules/.bin/gulp not in /Users/Vaughan/dev-live/foo
137 verbose stack     at clobberFail (/usr/local/lib/node_modules/npm/lib/utils/gently-rm.js:193:12)
137 verbose stack     at /usr/local/lib/node_modules/npm/lib/utils/gently-rm.js:132:18
137 verbose stack     at FSReqWrap.oncomplete (fs.js:95:15)
138 verbose cwd /Users/Vaughan/dev-live/foo
139 error Darwin 14.0.0
140 error argv "node" "/usr/local/bin/npm" "link" "/Users/Vaughan/dev/gulp4"
141 error node v0.12.3
142 error npm  v2.14.8
143 error path /Users/Vaughan/dev/gulp4/node_modules/.bin/gulp
144 error code EEXIST
145 error Refusing to delete: /Users/Vaughan/dev/gulp4/node_modules/.bin/gulp not in /Users/Vaughan/dev-live/foo
File exists: /Users/Vaughan/dev/gulp4/node_modules/.bin/gulp
Move it away, and try again.
146 verbose exit [ 1, true ]

EDIT:

Works fine if I do cd ~/dev/gulp4 && npm link, then cd ~/dev-live/foo && npm link gulp.

Maybe the last arg needs to be a relative path reference?

@othiym23
Contributor

@vjpr The way npm link <package> is supposed to work is to install a package on which npm link has previously been run, because what npm link <package> does is make a symbolic link from your global install location into the current package. It's not surprising (to me, at least) that npm has logic to handle this case, but it's also not surprising to me that this has some surprising behavior. What you're seeing is probably a bug, but it's not related to this issue, so if you'd like to see it addressed, please open a new issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment