0

This question already has an answer here:

I am trying to install phonegap in my Ubuntu 14.04 and when I try to update NPM I always get this error. What can it be? How to fix?

The commands I am using are sudo npm npm update -g and sudo npm npm install -g and always of this error:

npm ERR! tar pack Error reading /home/alisson/tmp/npm-13231/1456521975198-0.6208237137179822/package
npm ERR! TypeError: Cannot call method 'filter' of undefined
npm ERR!     at Packer.IgnoreReader.addIgnoreRules (/usr/local/lib/node_modules/npm/node_modules/fstream-npm/node_modules/fstream-ignore/ignore.js:148:13)
npm ERR!     at Packer.IgnoreReader.addIgnoreFile (/usr/local/lib/node_modules/npm/node_modules/fstream-npm/node_modules/fstream-ignore/ignore.js:133:10)
npm ERR!     at fs.readFile (fs.js:176:14)
npm ERR!     at fs.close (/usr/local/lib/node_modules/npm/node_modules/graceful-fs/graceful-fs.js:90:5)
npm ERR!     at Object.oncomplete (fs.js:297:15)
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!     <npm-@googlegroups.com>

npm ERR! System Linux 3.16.0-60-generic
npm ERR! command "/usr/local/bin/node" "/usr/local/bin/npm" "update" "npm" "-g"
npm ERR! cwd /home/alisson/.local/share/Trash/files/npm
npm ERR! node -v v0.8.15
npm ERR! npm -v 1.1.66
npm ERR! type non_object_property_call
npm ERR! addLocalDirectory Could not pack "/home/alisson/tmp/npm-13231/1456521975198-0.6208237137179822/package" to "/home/alisson/.npm/npm/3.7.5/package.tgz"
npm ERR! Error: Callback called more than once.
npm ERR!     at errorHandler (/usr/local/lib/node_modules/npm/lib/utils/error-handler.js:80:16)
npm ERR!     at asyncMap (/usr/local/lib/node_modules/npm/node_modules/slide/lib/async-map.js:27:18)
npm ERR!     at /usr/local/lib/node_modules/npm/lib/update.js:29:5
npm ERR!     at /usr/local/lib/node_modules/npm/lib/outdated.js:33:30
npm ERR!     at cb (/usr/local/lib/node_modules/npm/node_modules/slide/lib/async-map.js:48:11)
npm ERR!     at cb (/usr/local/lib/node_modules/npm/node_modules/slide/lib/async-map.js:48:11)
npm ERR!     at cb (/usr/local/lib/node_modules/npm/node_modules/slide/lib/async-map.js:48:11)
npm ERR!     at cb (/usr/local/lib/node_modules/npm/node_modules/slide/lib/async-map.js:48:11)
npm ERR!     at cb (/usr/local/lib/node_modules/npm/node_modules/slide/lib/async-map.js:48:11)
npm ERR!     at cb (/usr/local/lib/node_modules/npm/node_modules/slide/lib/async-map.js:48:11)
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!     <npm-@googlegroups.com>

npm ERR! System Linux 3.16.0-60-generic
npm ERR! command "/usr/local/bin/node" "/usr/local/bin/npm" "update" "npm" "-g"
npm ERR! cwd /home/alisson/.local/share/Trash/files/npm
npm ERR! node -v v0.8.15
npm ERR! npm -v 1.1.66
npm ERR! 
npm ERR! Additional logging details can be found in:
npm ERR!     /home/alisson/.local/share/Trash/files/npm/npm-debug.log
npm ERR! not ok code 0

This folder npm-13231/1456521975198-0.6208237137179822/package exists in directory tmp

marked as duplicate by karel, Fabby, David Foerster, Zanna, anonymous2 Apr 18 '18 at 11:39

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

1

I encountered a similar issue. It looks like you're using an old version of npm which is no longer supported. (According to the last post in this GitHub issue ).

I would suggest uninstalling npm completely and reinstalling the latest version.

To uninstall both node and npm (if npm was bundled with your node installation), try sudo apt-get remove nodejs. (To reinstall the latest versions, see MorganGalpin's answer to this Stack Overflow question)

To uninstall npm only, try npm rm npm -g (removes npm globally) or make uninstall in the folder where npm is installed (which npm will tell you where that is).

Not the answer you're looking for? Browse other questions tagged or ask your own question.