Skip to content
This repository has been archived by the owner on Mar 23, 2024. It is now read-only.

npm Error Refusing to delete: node_modules/jscs/node_modules/.bin/esparse #787

Closed
Krinkle opened this issue Nov 21, 2014 · 18 comments
Closed
Labels

Comments

@Krinkle
Copy link
Contributor

Krinkle commented Nov 21, 2014

Every once in a while, running npm install causes this error.

The job has no pre-existing node_modules directory, git working tree is clean. npm does have its own global cache, naturally, which I don't usually purge:

https://integration.wikimedia.org/ci/job/oojs-ui-npm/2038/consoleFull

12:53:00 npm ERR! error rolling back Error: Refusing to delete: .../jscs/node_modules/.bin/esparse not in .../jscs/node_modules/esprima-harmony-jscs
12:53:00 npm ERR! error rolling back     at clobberFail (/usr/share/npm/lib/utils/gently-rm.js:41:12)
12:53:00 npm ERR! error rolling back     at next (/usr/share/npm/lib/utils/gently-rm.js:27:14)
12:53:00 npm ERR! error rolling back     at /usr/share/npm/lib/utils/gently-rm.js:36:12
12:53:00 npm ERR! error rolling back     at Object.oncomplete (fs.js:107:15)
12:53:00 npm ERR! error rolling back  [email protected] { [Error: Refusing to delete: .../jscs/node_modules/.bin/esparse not in .../jscs/node_modules/esprima-harmony-jscs]
12:53:00 npm ERR! error rolling back   code: 'EEXIST',
12:53:00 npm ERR! error rolling back   path: '.../jscs/node_modules/.bin/esparse' }
12:53:01 npm ERR! Error: ENOENT, lstat '.../jscs/node_modules/xmlbuilder/node_modules/lodash-node/modern/objects.js'
12:53:01 npm ERR! If you need help, you may report this log at:
12:53:01 npm ERR!     <http://github.com/isaacs/npm/issues>
12:53:01 npm ERR! or email it to:
12:53:01 npm ERR!     <[email protected]>
12:53:01 
12:53:01 npm ERR! System Linux 3.13.0-29-generic
12:53:01 npm ERR! command "/usr/bin/nodejs" "/usr/bin/npm" "install"
12:53:01 npm ERR! cwd /mnt/jenkins-workspace/workspace/oojs-ui-npm
12:53:01 npm ERR! node -v v0.10.25
12:53:01 npm ERR! npm -v 1.3.10
12:53:01 npm ERR! path .../jscs/node_modules/xmlbuilder/node_modules/lodash-node/modern/objects.js
12:53:01 npm ERR! fstream_path .../jscs/node_modules/xmlbuilder/node_modules/lodash-node/modern/objects.js
12:53:01 npm ERR! fstream_type File
12:53:01 npm ERR! fstream_class FileWriter
12:53:01 npm ERR! code ENOENT
12:53:01 npm ERR! errno 34
12:53:01 npm ERR! fstream_stack /usr/lib/nodejs/fstream/lib/writer.js:284:26
12:53:01 npm ERR! fstream_stack Object.oncomplete (fs.js:107:15)
12:53:02 npm ERR! EEXIST, symlink '../esprima-harmony-jscs/bin/esparse.js'
12:53:02 File exists: ../esprima-harmony-jscs/bin/esparse.js
12:53:02 Move it away, and try again. 
12:53:02 
12:53:02 npm ERR! System Linux 3.13.0-29-generic
12:53:02 npm ERR! command "/usr/bin/nodejs" "/usr/bin/npm" "install"
12:53:02 npm ERR! cwd /mnt/jenkins-workspace/workspace/oojs-ui-npm
12:53:02 npm ERR! node -v v0.10.25
12:53:02 npm ERR! npm -v 1.3.10
12:53:02 npm ERR! path ../esprima-harmony-jscs/bin/esparse.js
12:53:02 npm ERR! code EEXIST
12:53:02 npm ERR! errno 47

Looks like it might be a race condition of some kind. Any ideas as to what might be causing this? So far the fix has been to just try again until it works..

@mrjoelkemp
Copy link
Member

Haven't experienced this before. Any chance you can follow up with the npm crew to get some more insight?

@mrjoelkemp mrjoelkemp added the cli label Nov 24, 2014
@mikesherov
Copy link
Contributor

@Krinkle I'm going to close this for now. If anything, this is either a bug in esprima or npm. We just made a copy of the existing esprima harmony parser for sanity's sake.

@santagada
Copy link

same problem happening on travis-ci

@guilhemSoulas
Copy link

+1. Just happened to me with Wercker.

@Krinkle
Copy link
Contributor Author

Krinkle commented Jan 8, 2015

Same thing just happened again.

19:50:10 npm ERR! error rolling back Error: Refusing to delete:
   .../jscs/node_modules/.bin/esparse not in .../jscs/node_modules/esprima-harmony-jscs
19:50:10 npm ERR! error rolling back     at clobberFail (/usr/share/npm/lib/utils/gently-rm.js:41:12)
19:50:10 npm ERR! error rolling back     at next (/usr/share/npm/lib/utils/gently-rm.js:27:14)
19:50:10 npm ERR! error rolling back     at /usr/share/npm/lib/utils/gently-rm.js:36:12
19:50:10 npm ERR! error rolling back     at Object.oncomplete (fs.js:107:15)
19:50:10 npm ERR! error rolling back  [email protected] { [Error: Refusing to delete: .../jscs/node_modules/.bin/esparse not in .../jscs/node_modules/esprima-harmony-jscs]
19:50:10 npm ERR! error rolling back   code: 'EEXIST',
19:50:10 npm ERR! error rolling back   path: '.../jscs/node_modules/.bin/esparse' }

@MiniXC
Copy link

MiniXC commented Jan 20, 2015

Also happened to me on Travis CI.

@cjsmith
Copy link

cjsmith commented Jan 24, 2015

Also happens to us on Bamboo several times a day. We also start with a with clean working tree/node_modules and we specify a clean dir for both npm cache and the TMPDIR process.

npm ERR! error rolling back Error: Refusing to delete: /data1/bamboo/xml-data/build-dir/MA-MASTER-JOB1/webapp/node_modules/grunt-jscs/node_modules/jscs/node_modules/.bin/esparse not in /data1/bamboo/xml-data/build-dir/MA-MASTER-JOB1/webapp/node_modules/grunt-jscs/node_modules/jscs/node_modules/esprima-harmony-jscs
npm ERR! error rolling back     at clobberFail (/usr/lib/node_modules/npm/lib/utils/gently-rm.js:41:12)
npm ERR! error rolling back     at next (/usr/lib/node_modules/npm/lib/utils/gently-rm.js:27:14)
npm ERR! error rolling back     at /usr/lib/node_modules/npm/lib/utils/gently-rm.js:36:12
npm ERR! error rolling back     at Object.oncomplete (fs.js:107:15)
npm ERR! error rolling back  [email protected] { [Error: Refusing to delete: /data1/bamboo/xml-data/build-dir/MA-MASTER-JOB1/webapp/node_modules/grunt-jscs/node_modules/jscs/node_modules/.bin/esparse not in /data1/bamboo/xml-data/build-dir/MA-MASTER-JOB1/webapp/node_modules/grunt-jscs/node_modules/jscs/node_modules/esprima-harmony-jscs]
npm ERR! error rolling back   code: 'EEXIST',
npm ERR! error rolling back   path: '/data1/bamboo/xml-data/build-dir/MA-MASTER-JOB1/webapp/node_modules/grunt-jscs/node_modules/jscs/node_modules/.bin/esparse' }
npm ERR! error rolling back Error: ENOTEMPTY, rmdir '/data1/bamboo/xml-data/build-dir/MA-MASTER-JOB1/webapp/node_modules/grunt-jscs/node_modules/jscs/node_modules/xmlbuilder/node_modules/lodash-node/compat'
npm ERR! error rolling back  [email protected] { [Error: ENOTEMPTY, rmdir '/data1/bamboo/xml-data/build-dir/MA-MASTER-JOB1/webapp/node_modules/grunt-jscs/node_modules/jscs/node_modules/xmlbuilder/node_modules/lodash-node/compat']
npm ERR! error rolling back   errno: 53,
npm ERR! error rolling back   code: 'ENOTEMPTY',
npm ERR! error rolling back   path: '/data1/bamboo/xml-data/build-dir/MA-MASTER-JOB1/webapp/node_modules/grunt-jscs/node_modules/jscs/node_modules/xmlbuilder/node_modules/lodash-node/compat' }
npm ERR! Error: ENOENT, lstat '/data1/bamboo/xml-data/build-dir/MA-MASTER-JOB1/webapp/node_modules/grunt-jscs/node_modules/jscs/node_modules/xmlbuilder/node_modules/lodash-node/compat/internals/baseIndexOf.js'
npm ERR! If you need help, you may report this log at:
npm ERR!     <http://github.com/isaacs/npm/issues>
npm ERR! or email it to:
npm ERR!     <[email protected]>

npm ERR! System Linux 2.6.32-358.11.1.el6.x86_64
npm ERR! command "node" "/usr/bin/npm" "install" "-q" "--tmp" "/data1/bamboo/xml-data/build-dir/MA-MASTER-JOB1/webapp/temp"
npm ERR! cwd /data1/bamboo/xml-data/build-dir/MA-MASTER-JOB1/webapp
npm ERR! node -v v0.10.26
npm ERR! npm -v 1.3.6
npm ERR! path /data1/bamboo/xml-data/build-dir/MA-MASTER-JOB1/webapp/node_modules/grunt-jscs/node_modules/jscs/node_modules/xmlbuilder/node_modules/lodash-node/compat/internals/baseIndexOf.js
npm ERR! fstream_path /data1/bamboo/xml-data/build-dir/MA-MASTER-JOB1/webapp/node_modules/grunt-jscs/node_modules/jscs/node_modules/xmlbuilder/node_modules/lodash-node/compat/internals/baseIndexOf.js
npm ERR! fstream_type File
npm ERR! fstream_class FileWriter
npm ERR! code ENOENT
npm ERR! errno 34
npm ERR! fstream_stack /usr/lib/node_modules/fstream/lib/writer.js:284:26
npm ERR! fstream_stack Object.oncomplete (fs.js:107:15)
npm ERR! EEXIST, symlink '../esprima-harmony-jscs/bin/esvalidate.js'
File exists: ../esprima-harmony-jscs/bin/esvalidate.js
Move it away, and try again. 

@donaldpipowitch
Copy link

Happened locally at my Mac with the official npm. Using our internal mirror everything worked.

@mikesherov
Copy link
Contributor

Not much we can do here. I suggest filing an issue with esparse or npm.

We've never been able to get a reliable repro, which would help a lot.

@tyv
Copy link

tyv commented Feb 11, 2015

same problem, node version update from 0.8.x to 0.10.x helped

@markelog
Copy link
Member

@othiym23 you help here would be really appreciated, it seems it affects a lot of people :-(

@othiym23
Copy link

@markelog Looking at the stack traces here, everybody encountering this error is running a very old version of npm. Several of those errors look like race condition issues that we finally got around to addressing somewhere around [email protected], and the current version of npm is [email protected], so I suggest that everyone go ahead and upgrade to the latest stable and then file an issue on npm if you're still encountering this.

@markelog
Copy link
Member

@othiym23 thank you for the clarification, great news and all :-).

@qfox
Copy link
Member

qfox commented Feb 12, 2015

It looks like sudo npm -g update npm at before ;-)

@othiym23
Copy link

@zxqfox Please do not use sudo npm -g update npm to update npm. Use npm -g install npm instead. npm update has some issues that we're still working on fixing.

@cjsmith
Copy link

cjsmith commented Feb 14, 2015

Still seeing issues after upgrading to npm 2.5.0 :( @othiym23, is this an npm bug? Admittedly, I updated npm with sudo -g update npm which generated some warnings.

> [email protected] install /data1/bamboo/xml-data/build-dir/MARCH-CBLDDEP-CAPA2/capybara/capybara-service/node_modules/phantomjs
13-Feb-2015 16:18:04    > node install.js
13-Feb-2015 16:18:04    
13-Feb-2015 16:18:05    Downloading https://bitbucket.org/ariya/phantomjs/downloads/phantomjs-1.9.8-linux-x86_64.tar.bz2
13-Feb-2015 16:18:05    Saving to /data1/bamboo/xml-data/build-dir/MARCH-CBLDDEP-CAPA2/capybara/capybara-service/temp/phantomjs/phantomjs-1.9.8-linux-x86_64.tar.bz2
13-Feb-2015 16:18:05    Receiving...
13-Feb-2015 16:18:10    
13-Feb-2015 16:18:10    Received 12854K total.
13-Feb-2015 16:18:10    Extracting tar contents (via spawned process)
13-Feb-2015 16:18:12    Removing /data1/bamboo/xml-data/build-dir/MARCH-CBLDDEP-CAPA2/capybara/capybara-service/node_modules/phantomjs/lib/phantom
13-Feb-2015 16:18:12    Copying extracted folder /data1/bamboo/xml-data/build-dir/MARCH-CBLDDEP-CAPA2/capybara/capybara-service/temp/phantomjs/phantomjs-1.9.8-linux-x86_64.tar.bz2-extract-1423873090388/phantomjs-1.9.8-linux-x86_64 -> /data1/bamboo/xml-data/build-dir/MARCH-CBLDDEP-CAPA2/capybara/capybara-service/node_modules/phantomjs/lib/phantom
13-Feb-2015 16:18:12    Writing location.js file
13-Feb-2015 16:18:12    Done. Phantomjs binary available at /data1/bamboo/xml-data/build-dir/MARCH-CBLDDEP-CAPA2/capybara/capybara-service/node_modules/phantomjs/lib/phantom/bin/phantomjs
13-Feb-2015 16:18:12    
13-Feb-2015 16:18:12    > [email protected] install /data1/bamboo/xml-data/build-dir/MARCH-CBLDDEP-CAPA2/capybara/capybara-service/node_modules/grunt-sencha-dependencies/node_modules/phantomjs
13-Feb-2015 16:18:12    > node install.js
13-Feb-2015 16:18:12    
13-Feb-2015 16:18:13    Download already available at /data1/bamboo/xml-data/build-dir/MARCH-CBLDDEP-CAPA2/capybara/capybara-service/temp/phantomjs/phantomjs-1.9.8-linux-x86_64.tar.bz2
13-Feb-2015 16:18:13    Extracting tar contents (via spawned process)
13-Feb-2015 16:18:17    Removing /data1/bamboo/xml-data/build-dir/MARCH-CBLDDEP-CAPA2/capybara/capybara-service/node_modules/grunt-sencha-dependencies/node_modules/phantomjs/lib/phantom
13-Feb-2015 16:18:17    Copying extracted folder /data1/bamboo/xml-data/build-dir/MARCH-CBLDDEP-CAPA2/capybara/capybara-service/temp/phantomjs/phantomjs-1.9.8-linux-x86_64.tar.bz2-extract-1423873093200/phantomjs-1.9.8-linux-x86_64 -> /data1/bamboo/xml-data/build-dir/MARCH-CBLDDEP-CAPA2/capybara/capybara-service/node_modules/grunt-sencha-dependencies/node_modules/phantomjs/lib/phantom
13-Feb-2015 16:18:17    Removing /data1/bamboo/xml-data/build-dir/MARCH-CBLDDEP-CAPA2/capybara/capybara-service/temp/phantomjs/phantomjs-1.9.8-linux-x86_64.tar.bz2-extract-1423873093200
13-Feb-2015 16:18:18    Writing location.js file
13-Feb-2015 16:18:18    Done. Phantomjs binary available at /data1/bamboo/xml-data/build-dir/MARCH-CBLDDEP-CAPA2/capybara/capybara-service/node_modules/grunt-sencha-dependencies/node_modules/phantomjs/lib/phantom/bin/phantomjs
13-Feb-2015 16:18:18    npm ERR! Linux 2.6.32-358.11.1.el6.x86_64
13-Feb-2015 16:18:18    npm ERR! argv "node" "/usr/bin/npm" "install" "-q" "--tmp" "/data1/bamboo/xml-data/build-dir/MARCH-CBLDDEP-CAPA2/capybara/capybara-service/temp"
13-Feb-2015 16:18:18    npm ERR! node v0.10.26
13-Feb-2015 16:18:18    npm ERR! npm  v2.5.0
13-Feb-2015 16:18:18    npm ERR! path ../esprima-harmony-jscs/bin/esparse.js
13-Feb-2015 16:18:18    npm ERR! code EEXIST
13-Feb-2015 16:18:18    npm ERR! errno 47
13-Feb-2015 16:18:18    
13-Feb-2015 16:18:18    npm ERR! EEXIST, symlink '../esprima-harmony-jscs/bin/esparse.js'
13-Feb-2015 16:18:18    File exists: ../esprima-harmony-jscs/bin/esparse.js
13-Feb-2015 16:18:18    Move it away, and try again.

@othiym23
Copy link

@cjsmith It looks like you may have two dependencies trying to create the same symbolic link. There's a broader discussion of this issue on npm/npm#7130, where we're trying to figure out the best way to deal with this. The problem is only partially in npm – in general, regardless of the strategy we decide upon, there's going to have to be a way to deal with conflicts between packages wanting to grab the same binary name, and it will probably at least partially devolve to package maintainers to play nice.

Unless this is something else altogether! If you like, open an issue on npm and upload your npm-debug.log from one of these failures as a gist so one of us can take a deeper look into it.

@geraldglennon
Copy link

I was having the same issue, trying to install jscs through maven on jenkins using different versions of npm which all failed. I solved it by adding to the npm, command "npm jscs@(version) --no-bin-links ----no-optional".
not really a solution but it worked for me on the jscs module.

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