Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refusing to delete global module #29

Closed
coreybutler opened this issue Dec 15, 2014 · 12 comments
Closed

Refusing to delete global module #29

coreybutler opened this issue Dec 15, 2014 · 12 comments

Comments

@coreybutler
Copy link
Owner

Per @vkbansal (moved from issue #26):

I keep getting Error: Refusing to delete: C:\Program Files\nodejs\coffeelint.cmd not in C:\Program Files\nodejs. when I do npm install -g coffeelint. Any idea what may cause this ?

Here's npm-debug.log

0 info it worked if it ends with ok
1 verbose cli [ 'C:\\Program Files\\nodejs\\\\node.exe',
1 verbose cli   'C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js',
1 verbose cli   'install',
1 verbose cli   '-g',
1 verbose cli   'coffeelint' ]
2 info using npm@2.1.9
3 info using node@v0.10.32
4 verbose node symlink C:\Program Files\nodejs\\node.exe
5 silly cache add args [ 'coffeelint', null ]
6 verbose cache add spec coffeelint
7 silly cache add parsed spec { raw: 'coffeelint',
7 silly cache add   scope: null,
7 silly cache add   name: 'coffeelint',
7 silly cache add   rawSpec: '',
7 silly cache add   spec: '*',
7 silly cache add   type: 'range' }
8 verbose addNamed coffeelint@*
9 silly addNamed semver.valid null
10 silly addNamed semver.validRange *
11 silly addNameRange { name: 'coffeelint', range: '*', hasData: false }
12 silly mapToRegistry name coffeelint
13 silly mapToRegistry using default registry
14 silly mapToRegistry registry https://registry.npmjs.org/
15 silly mapToRegistry uri https://registry.npmjs.org/coffeelint
16 verbose addNameRange registry:https://registry.npmjs.org/coffeelint not in flight; fetching
17 verbose request uri https://registry.npmjs.org/coffeelint
18 verbose request no auth needed
19 info attempt registry request try #1 at 10:22:10
20 verbose request id 4d4b8cae84f08a01
21 verbose etag "3M75DKO5CKF5HR02T670OPLOU"
22 http request GET https://registry.npmjs.org/coffeelint
23 http 304 https://registry.npmjs.org/coffeelint
24 silly get cb [ 304,
24 silly get   { date: 'Mon, 15 Dec 2014 04:52:12 GMT',
24 silly get     server: 'Apache',
24 silly get     via: '1.1 varnish',
24 silly get     'last-modified': 'Mon, 15 Dec 2014 04:52:12 GMT',
24 silly get     'cache-control': 'max-age=60',
24 silly get     etag: '"3M75DKO5CKF5HR02T670OPLOU"',
24 silly get     age: '0',
24 silly get     'x-served-by': 'cache-sn88-SIN',
24 silly get     'x-cache': 'HIT',
24 silly get     'x-cache-hits': '1',
24 silly get     'x-timer': 'S1418619132.555107,VS0,VE198',
24 silly get     vary: 'Accept',
24 silly get     'content-length': '0',
24 silly get     'keep-alive': 'timeout=10, max=50',
24 silly get     connection: 'Keep-Alive' } ]
25 verbose etag https://registry.npmjs.org/coffeelint from cache
26 silly addNameRange number 2 { name: 'coffeelint', range: '*', hasData: true }
27 silly addNameRange versions [ 'coffeelint',
27 silly addNameRange   [ '0.0.1',
27 silly addNameRange     '0.0.2',
27 silly addNameRange     '0.0.3',
27 silly addNameRange     '0.0.4',
27 silly addNameRange     '0.0.5',
27 silly addNameRange     '0.0.6',
27 silly addNameRange     '0.0.7',
27 silly addNameRange     '0.1.0',
27 silly addNameRange     '0.2.0',
27 silly addNameRange     '0.3.0',
27 silly addNameRange     '0.4.0',
27 silly addNameRange     '0.5.0',
27 silly addNameRange     '0.5.1',
27 silly addNameRange     '0.5.2',
27 silly addNameRange     '0.5.3',
27 silly addNameRange     '0.5.4',
27 silly addNameRange     '0.5.5',
27 silly addNameRange     '0.5.6',
27 silly addNameRange     '0.5.7',
27 silly addNameRange     '0.6.0',
27 silly addNameRange     '0.6.1',
27 silly addNameRange     '1.0.0',
27 silly addNameRange     '1.0.1',
27 silly addNameRange     '1.0.2',
27 silly addNameRange     '1.0.3',
27 silly addNameRange     '1.0.4',
27 silly addNameRange     '1.0.5',
27 silly addNameRange     '1.0.6',
27 silly addNameRange     '1.0.7',
27 silly addNameRange     '1.0.8',
27 silly addNameRange     '1.1.0',
27 silly addNameRange     '1.2.0',
27 silly addNameRange     '1.3.0',
27 silly addNameRange     '1.4.0',
27 silly addNameRange     '1.4.1',
27 silly addNameRange     '1.5.0',
27 silly addNameRange     '1.5.1',
27 silly addNameRange     '1.5.2',
27 silly addNameRange     '1.5.3',
27 silly addNameRange     '1.5.4',
27 silly addNameRange     '1.5.5',
27 silly addNameRange     '1.5.6',
27 silly addNameRange     '1.5.7',
27 silly addNameRange     '1.6.0',
27 silly addNameRange     '1.6.1',
27 silly addNameRange     '1.7.0' ] ]
28 verbose addNamed coffeelint@1.7.0
29 silly addNamed semver.valid 1.7.0
30 silly addNamed semver.validRange 1.7.0
31 silly cache afterAdd coffeelint@1.7.0
32 verbose afterAdd C:\Users\hdev11\AppData\Roaming\npm-cache\coffeelint\1.7.0\package\package.json not in flight; writing
33 verbose afterAdd C:\Users\hdev11\AppData\Roaming\npm-cache\coffeelint\1.7.0\package\package.json written
34 silly install resolved [ { name: 'coffeelint',
34 silly install resolved     description: 'Lint your CoffeeScript',
34 silly install resolved     version: '1.7.0',
34 silly install resolved     homepage: 'http://www.coffeelint.org',
34 silly install resolved     keywords: [ 'lint', 'coffeescript', 'coffee-script' ],
34 silly install resolved     author: { name: 'Matthew Perpick', email: 'clutchski@gmail.com' },
34 silly install resolved     main: './lib/coffeelint.js',
34 silly install resolved     engines: { npm: '>=1.3.7', node: '>=0.8.0' },
34 silly install resolved     repository:
34 silly install resolved      { type: 'git',
34 silly install resolved        url: 'git://github.com/clutchski/coffeelint.git' },
34 silly install resolved     bin: { coffeelint: './bin/coffeelint' },
34 silly install resolved     dependencies:
34 silly install resolved      { 'coffee-script': '~1.7',
34 silly install resolved        glob: '^4.0.0',
34 silly install resolved        ignore: '^2.2.15',
34 silly install resolved        optimist: '^0.6.1',
34 silly install resolved        resolve: '^0.6.3' },
34 silly install resolved     devDependencies: { vows: '>=0.6.0', underscore: '>=1.4.4' },
34 silly install resolved     licenses: [ [Object] ],
34 silly install resolved     scripts:
34 silly install resolved      { pretest: 'cake compile',
34 silly install resolved        test: './vowsrunner.js --spec test/*.coffee test/*.litcoffee',
34 silly install resolved        posttest: 'npm run lint',
34 silly install resolved        prepublish: 'cake prepublish',
34 silly install resolved        publish: 'cake publish',
34 silly install resolved        lint: 'cake compile && ./bin/coffeelint .',
34 silly install resolved        'lint-csv': 'cake compile && ./bin/coffeelint --csv .',
34 silly install resolved        'lint-jslint': 'cake compile && ./bin/coffeelint --jslint .',
34 silly install resolved        compile: 'cake compile' },
34 silly install resolved     gitHead: 'abe43e69f0ecb34b439e7681d687c14fd7c496f4',
34 silly install resolved     bugs: { url: 'https://github.com/clutchski/coffeelint/issues' },
34 silly install resolved     _id: 'coffeelint@1.7.0',
34 silly install resolved     _shasum: '84d01a7f0c0d5f532eece096a1603ee37c220634',
34 silly install resolved     _from: 'coffeelint@*',
34 silly install resolved     _npmVersion: '2.1.4',
34 silly install resolved     _nodeVersion: '0.10.28',
34 silly install resolved     _npmUser: { name: 'asaayers', email: 'Asa@AsaAyers.com' },
34 silly install resolved     maintainers: [ [Object], [Object], [Object] ],
34 silly install resolved     dist:
34 silly install resolved      { shasum: '84d01a7f0c0d5f532eece096a1603ee37c220634',
34 silly install resolved        tarball: 'http://registry.npmjs.org/coffeelint/-/coffeelint-1.7.0.tgz' },
34 silly install resolved     directories: {},
34 silly install resolved     _resolved: 'https://registry.npmjs.org/coffeelint/-/coffeelint-1.7.0.tgz',
34 silly install resolved     readme: 'ERROR: No README data found!' } ]
35 info install coffeelint@1.7.0 into C:\Program Files\nodejs
36 info installOne coffeelint@1.7.0
37 verbose installOne of coffeelint to C:\Program Files\nodejs not in flight; installing
38 verbose lock using C:\Users\hdev11\AppData\Roaming\npm-cache\_locks\coffeelint-b593cebdb3430387.lock for C:\Program Files\nodejs\node_modules\coffeelint
39 silly install write writing coffeelint 1.7.0 to C:\Program Files\nodejs\node_modules\coffeelint
40 silly cache addNamed cb coffeelint@1.7.0
41 verbose unbuild node_modules\coffeelint
42 info preuninstall coffeelint@1.6.1
43 info uninstall coffeelint@1.6.1
44 verbose unbuild rmStuff coffeelint@1.6.1 from C:\Program Files\nodejs\node_modules
45 verbose gentlyRm verifying that C:\Program Files\nodejs is managed by npm
46 silly cacheAndTest C:\Program Files\nodejs is not inside C:\Program Files\nodejs\node_modules
47 silly isManaged C:\Program Files\nodejs is not inside C:\Program Files\nodejs\node_modules
48 silly cacheAndTest C:\Program Files\nodejs is not inside C:\Users\hdev11\AppData\Roaming\nvm\v0.10.32
49 silly isManaged C:\Program Files\nodejs is not inside C:\Users\hdev11\AppData\Roaming\nvm\v0.10.32
50 silly isManaged C:\Program Files\nodejs is not inside C:\Program Files\nodejs\node_modules
51 verbose isManaged no path
52 silly isManaged C:\Program Files\nodejs is not inside C:\Users\hdev11\AppData\Roaming\nvm\v0.10.32
53 silly isManaged C:\Program Files\nodejs is not inside C:\Users\hdev11\AppData\Roaming\nvm\v0.10.32
54 verbose gentlyRm C:\Program Files\nodejs is not managed by npm
55 verbose unlock done using C:\Users\hdev11\AppData\Roaming\npm-cache\_locks\coffeelint-b593cebdb3430387.lock for C:\Program Files\nodejs\node_modules\coffeelint
56 verbose stack Error: Refusing to delete: C:\Program Files\nodejs\coffeelint.cmd not in C:\Program Files\nodejs
56 verbose stack     at clobberFail (C:\Users\hdev11\AppData\Roaming\nvm\v0.10.32\node_modules\npm\lib\utils\gently-rm.js:166:12)
56 verbose stack     at C:\Users\hdev11\AppData\Roaming\nvm\v0.10.32\node_modules\npm\lib\utils\gently-rm.js:56:14
56 verbose stack     at zalgoSafe (C:\Users\hdev11\AppData\Roaming\nvm\v0.10.32\node_modules\npm\node_modules\dezalgo\dezalgo.js:20:10)
56 verbose stack     at map (C:\Users\hdev11\AppData\Roaming\nvm\v0.10.32\node_modules\npm\node_modules\async-some\some.js:28:33)
56 verbose stack     at reduce (C:\Users\hdev11\AppData\Roaming\nvm\v0.10.32\node_modules\npm\node_modules\async-some\some.js:38:5)
56 verbose stack     at predicate (C:\Users\hdev11\AppData\Roaming\nvm\v0.10.32\node_modules\npm\lib\utils\gently-rm.js:130:14)
56 verbose stack     at map (C:\Users\hdev11\AppData\Roaming\nvm\v0.10.32\node_modules\npm\node_modules\async-some\some.js:30:5)
56 verbose stack     at reduce (C:\Users\hdev11\AppData\Roaming\nvm\v0.10.32\node_modules\npm\node_modules\async-some\some.js:38:5)
56 verbose stack     at predicate (C:\Users\hdev11\AppData\Roaming\nvm\v0.10.32\node_modules\npm\lib\utils\gently-rm.js:130:14)
56 verbose stack     at map (C:\Users\hdev11\AppData\Roaming\nvm\v0.10.32\node_modules\npm\node_modules\async-some\some.js:30:5)
57 verbose cwd E:\temp
58 error Windows_NT 6.2.9200
59 error argv "C:\\Program Files\\nodejs\\\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "install" "-g" "coffeelint"
60 error node v0.10.32
61 error npm  v2.1.9
62 error path C:\Program Files\nodejs\coffeelint.cmd
63 error code EEXIST
64 error Refusing to delete: C:\Program Files\nodejs\coffeelint.cmd not in C:\Program Files\nodejs
File exists: C:\Program Files\nodejs\coffeelint.cmd
Move it away, and try again.
65 verbose exit [ 1, true ]
66 verbose unbuild node_modules\coffeelint
67 info preuninstall coffeelint@1.6.1
68 info uninstall coffeelint@1.6.1
69 verbose unbuild rmStuff coffeelint@1.6.1 from C:\Program Files\nodejs\node_modules
70 verbose gentlyRm verifying that C:\Program Files\nodejs is managed by npm
71 silly isManaged C:\Program Files\nodejs is not inside C:\Program Files\nodejs\node_modules
72 silly isManaged C:\Program Files\nodejs is not inside C:\Program Files\nodejs\node_modules
73 silly isManaged C:\Program Files\nodejs is not inside C:\Users\hdev11\AppData\Roaming\nvm\v0.10.32
74 silly isManaged C:\Program Files\nodejs is not inside C:\Users\hdev11\AppData\Roaming\nvm\v0.10.32
75 silly isManaged C:\Program Files\nodejs is not inside C:\Program Files\nodejs\node_modules
76 verbose isManaged no path
77 silly isManaged C:\Program Files\nodejs is not inside C:\Users\hdev11\AppData\Roaming\nvm\v0.10.32
78 silly isManaged C:\Program Files\nodejs is not inside C:\Users\hdev11\AppData\Roaming\nvm\v0.10.32
79 verbose gentlyRm C:\Program Files\nodejs is not managed by npm
80 error error rolling back Error: Refusing to delete: C:\Program Files\nodejs\coffeelint.cmd not in C:\Program Files\nodejs
80 error error rolling back     at clobberFail (C:\Users\hdev11\AppData\Roaming\nvm\v0.10.32\node_modules\npm\lib\utils\gently-rm.js:166:12)
80 error error rolling back     at C:\Users\hdev11\AppData\Roaming\nvm\v0.10.32\node_modules\npm\lib\utils\gently-rm.js:56:14
80 error error rolling back     at C:\Users\hdev11\AppData\Roaming\nvm\v0.10.32\node_modules\npm\node_modules\dezalgo\dezalgo.js:17:12
80 error error rolling back     at flush (C:\Users\hdev11\AppData\Roaming\nvm\v0.10.32\node_modules\npm\node_modules\dezalgo\node_modules\asap\asap.js:27:13)
80 error error rolling back     at process._tickCallback (node.js:419:13)
80 error error rolling back  { [Error: Refusing to delete: C:\Program Files\nodejs\coffeelint.cmd not in C:\Program Files\nodejs]
80 error error rolling back   code: 'EEXIST',
80 error error rolling back   path: 'C:\\Program Files\\nodejs\\coffeelint.cmd' }
@coreybutler
Copy link
Owner Author

I was unable to recreate this... I was able to install successfully, reinstall successfully, and remove successfully (using npm v1.4.28). I'd suggest trying npm uninstall -g coffeelint first.

The coffee module and associated packages are fairly notorious for not following standards and being a little glitchy, especially with backwards compatibility. So, it could just be this module.

@vkbansal
Copy link

It's not just coffeelint. Even npm install -g npm and npm install -g less produces similar errors.

@coreybutler
Copy link
Owner Author

I can't recreate any of these errors... which version of node and npm are you running this against?

@vkbansal
Copy link

capture

As you can see, I'm using node v0.10.33 and npm v2.1.10

@coreybutler
Copy link
Owner Author

Sorry - should have caught that in the debug. I hate to ask a stupid question, but are you running the command prompt as an admin?

The issue is pretty clear "Refusing to delete"... there are a finite number of reasons why a file cannot be deleted. Either the permissions aren't acceptable, or perhaps the file is in use. There is also the possibility this is an issue with npm. Keep in mind the version of npm that ships with 0.10.33 is 1.4.28. The 2.x.x branch isn't shipping with a stable version of node... yet.

At this point, I think it's unlikely this is an NVM issue.

@vkbansal
Copy link

Yep tried it even with an elevated command prompt. Still same error.

Refusing to delete: C:\Program Files\nodejs\lessc.cmd not in C:\Program Files\nodejs
File exists: C:\Program Files\nodejs\lessc.cmd
Move it away, and try again.

According to the message, also tried after removing less.cmd. Still getting same error.

Everything will run fine if I do nvm uninstall 0.10.33, nvm install 0.10.33, npm install -g less

Can you make sense of lines 77-80 in the log?

@coreybutler
Copy link
Owner Author

If an uninstall/reinstall worked, then I'm confident this is an npm issue. By reinstalling, npm was reset to the default version (1.4.8).

Lines 77-78 are part of npm's process for finding the node_modules directory. I'm not sure about line 79, but line 80 is looking for the .cmd file in the node root when I believe it's supposed to be in the npm root.

@vkbansal
Copy link

can this be related to #26 ?

@coreybutler
Copy link
Owner Author

It's highly unlikely. npm is installed uniquely for each version of node. At one point in our dialog, you mentioned running an npm update npm or npm install -g npm, which would change the version of npm for node 0.10.33.

If you had reinstalled node and still experienced the same issues, then I'd be more suspicious of NVM, but I'm pretty certain the issue is related to npm. In fact, I'm confident enough in this that I'm going to close this issue (of course, I can reopen if necessary).

If you want to experiment, you could try a fresh install of node 0.10.33, then install your modules. This should work without a hitch and be a baseline for the test. Then uninstall those modules (or reinstall node 0.10.33). Then update npm via npm update npm or npm install -g npm and try to install the modules again. I suspect they'll fail, which would indicate an issue with npm. If that is the case, I'd file a bug with npm.

@vkbansal
Copy link

Just wanted to share this link. May be you could add this to readme:
https://github.com/npm/npm/wiki/Troubleshooting#upgrading-on-windows

@Splaktar
Copy link

It looks like the previous link has been moved. I think that https://npm.community/t/installing-upgrading-npm/251/2 is the new location.

@Splaktar
Copy link

I checked the Common Issues Wiki but didn't see this issue covered there. I get a failure with both npm i -g npm and npm update -g npm.

I read through this issue but I don't see a resolution. The suggestion in the link I posted above is to use https://github.com/felixrieseberg/npm-windows-upgrade#upgrade-npm-on-windows, but that doesn't seem like a good solution to me. It would require installing that NPM package globally in every NPM version that I install, plus it requires a number of extra steps and permissions.

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

No branches or pull requests

3 participants