npm / npm

This repository is moving to: https://github.com/npm/cli
http://npm.community
17.54k stars 3.02k forks source link

tar.unpack untar error #5133

Closed hengkiardo closed 9 years ago

hengkiardo commented 10 years ago

i try npm install on Ubuntu 12.04, i getting error about tar.unpack untar error it seem related with mongoose/mongodb

this one screenshoot from my terminal

screen shot 2014-04-23 at 7 00 15 pm

this one list of my node modules

"express": "^3.5.1",
    "jade": "^1.3.0",
    "mongoose": "3.8.8",
    "connect-mongo": "latest",
    "connect-flash": "latest",
    "passport": "^0.2.0",
    "passport-local": "^0.1.6",
    "passport-facebook": "^1.0.2",
    "passport-twitter": "^1.0.2",
    "imager": "latest",
    "winston": "^0.7.2",
    "notifier": "^0.1.4",
    "async": "latest",
    "view-helpers": "latest",
    "connect-multiparty": "^1.0.3",
    "gzippo": "latest",
    "geoip": "^0.5.2",
    "helmet": "^0.1.3",
    "lodash": "^2.4.1",
    "nodejs-gravatar": "^1.0.2",
    "superagent": "^0.16.0",
    "request": "^2.34.0",
    "q": "^1.0.0",
    "twit": "^1.1.12",
    "mongoose-text-search": "0.0.2",
    "mongoosastic": "^0.2.6",
    "express-error-with-sources": "^1.3.0",
    "when": "^2.8.0",
    "cron": "^1.0.4",
    "mathjs": "^0.18.1",
    "query-string": "^0.2.0",
    "moment": "^2.5.1",
    "stats-array": "^0.1.2",
    "time": "^0.10.0",
    "fs-extra": "^0.8.1",
    "json2csv": "^2.2.1",
    "string": "^1.8.0",
    "phantom": "^0.5.7",
    "node-wkhtml": "0.1.0-alpha1",
    "nodepdf": "^1.0.1",
    "utility": "^0.1.11",
    "nodemailer": "^0.6.1",
    "email-templates": "^0.1.7",
    "validator": "^3.5.1",
    "pdfcrowd": "^1.1.0",
    "mongoose-unique-validator": "^0.3.0",
    "jquery-file-upload-middleware": "^0.1.1",
    "mongoose-timestamp": "^0.2.1",
    "express-mongoose": "^0.1.0",
    "mongodb": "^1.4.2"
shepmaster commented 10 years ago

I had a similar error (while installing bower):

npm ERR! tar.unpack untar error /Users/jakegoulding/.npm/ctype/0.5.2/package.tgz
npm WARN optional dep failed, continuing http-signature@0.10.0
npm ERR! Error: ENOENT, lstat '/usr/local/lib/node_modules/bower/node_modules/request/node_modules/http-signature/node_modules/asn1/lib/ber/reader.js'
npm ERR! If you need help, you may report this *entire* log,
npm ERR! including the npm and node versions, at:
npm ERR!     <http://github.com/npm/npm/issues>

npm ERR! System Darwin 13.1.0
npm ERR! command "/usr/local/Cellar/node/0.10.26/bin/node" "/usr/local/bin/npm" "install" "bower" "-g"
npm ERR! cwd /Users/jakegoulding/Projects/bree
npm ERR! node -v v0.10.26
npm ERR! npm -v 1.4.3
npm ERR! path /usr/local/lib/node_modules/bower/node_modules/request/node_modules/http-signature/node_modules/asn1/lib/ber/reader.js
npm ERR! fstream_path /usr/local/lib/node_modules/bower/node_modules/request/node_modules/http-signature/node_modules/asn1/lib/ber/reader.js
npm ERR! fstream_type File
npm ERR! fstream_class FileWriter
npm ERR! code ENOENT
npm ERR! errno 34
npm ERR! fstream_stack /usr/local/Cellar/node/0.10.26/lib/node_modules/npm/node_modules/fstream/lib/writer.js:284:26
npm ERR! fstream_stack Object.oncomplete (fs.js:107:15)

I was able to continue by removing the tarball manually:

rm /Users/jakegoulding/.npm/ctype/0.5.2/package.tgz
shepmaster commented 10 years ago

Does npm check the downloaded files consistency? My guess is that that download got borked in flight; verifying the download against a MD5 (or other hash of choice) would have caught this and forced a redownload.

leoj3n commented 9 years ago

npm cache clean solved a similar "untar" error.

jutiapaboy commented 9 years ago

Thanks leoj3n "npm cache clean" solved the problem for me!

kris7i commented 9 years ago

Actually i use npm cache clean solved a similar "untar" error. But display another problem .

$ npm cache clean npm ERR! Windows_NT 6.3.9600 npm ERR! argv "c:\Program Files\nodejs\node.exe" "c:\Program Files\nodejs\ node_modules\npm\bin\npm-cli.js" "cache" "clean" npm ERR! node v0.12.0 npm ERR! npm v2.5.1 npm ERR! path C:\Users\asusu\AppData\Roaming\npm-cache\ionic\1.3.11 npm ERR! code EBUSY npm ERR! errno -4082

npm ERR! EBUSY, unlink 'C:\Users\asusu\AppData\Roaming\npm-cache\ionic\1.3.11' npm ERR! npm ERR! If you need help, you may report this error at: npm ERR! http://github.com/npm/npm/issues

npm ERR! Please include the following file with any support request: npm ERR! D:\Program Files\phpStudy\WWW\ionic\npm-debug.log /c/Program Files/nodejs/npm: line 14: 2568 Signal 112 (core dumped ) "$basedir/node.exe" "$basedir/node_modules/npm/bin/npm-cli.js" "$@"

edwinhdez commented 9 years ago

Try running your command prompt as administrator that worked for me..

czyang commented 9 years ago

Bump, encounter in my mac, use sudo solved this question.

graywithanA commented 9 years ago

FYI, I had to clear my bower cache as well as my npm cache to resolve this issue:

$ npm cache clean
$ bower cache clean
s875515 commented 9 years ago

Add sudo that prompt administrator to work this

austinarchibald commented 9 years ago

npm cache clean didn't work for me. sudo did. Yosemite 10.10.3

Shawydu commented 9 years ago

It seems that npm cache clean doesn't work in Yosemite 10.10.3, except sudo.

RHCKM commented 9 years ago

Similar issues on Mac but adding sudo worked

isimmons commented 9 years ago

Same issue with untar error on three different packages in ~.npm .

npm cache clean bower cache clean

did not fix.

Tried multiple times so don't think it's a borked download issue.

Even manually cd to the directory in question and untar the package.tgz myself and still have the same error.

Shouldn't npm detect that the package is already there and untared so no need to try to re-download and untar it?

I think in my case it may be an issue with shared folder, using linux vm on a windows host but would think manually untaring the tgz would be a work around

gregoryderner commented 9 years ago

in my case I was trying to install nodemon. The error has been resolved by installing pkg global and not local

Jacinth-21 commented 9 years ago

sudo npm install works for me.

rohandavidg commented 9 years ago

updating npm and sudo worked for me

i-ctra commented 8 years ago

capture1 I am trying to install ionic on windows and im getting this error. Any solution??

vultur commented 8 years ago

please clear the %user%/Temp on Windows then run npm cache clean \ and try again

leopiazzoli commented 8 years ago

npm cache clean work for me... Thanks.

i-ctra commented 8 years ago

I tried npm cache clean but still getting the same error

emiliowebb commented 8 years ago

got same error installing ws module. Solved opening cmd as an Administrator

warrenca commented 8 years ago

"Restart" solved my problem! I am using Ubuntu in virtual box and shared a directory from my host OSX computer. I accidentally deleted the files in OSX and try to clone again the files via git. I have to do npm install but I got the following error

npm ERR! tar.unpack untar error...
...
npm ERR! EEXIST: file already exists, mkdir '/home/vagrant/project-server/node_modules'
File exists: /home/vagrant/project-server/node_modules
Move it away, and try again.

I did npm cache clean but I still can't make it work. I restarted the VM and npm install work. I guess Ubuntu is not aware that the project-server directory is deleted that's why it's complaining. Maybe there's a better way to refresh the status of the files without restarting.

chinhphan099 commented 8 years ago

try with: sudo ...

uazure commented 8 years ago

Had the same issue. It was caused by incomplete .tar.gz files. But npm cache clean didn't help me. Only after disabling my vpn I successfully installed deps. So in my case the issue was in network connection.

anhnc55 commented 8 years ago

sudo npm install -g react-native-cli, then enter your password. This proplem would solved!

zulhfreelancer commented 8 years ago

I'm on OSX El Capitan 10.11.2.

sudo npm install -g bower works for me.

VivekAnand23 commented 8 years ago

I am trying to install Ionic on Windows 7. Getting error for untar package.tgz.

npm ERR! tar.unpack untar error C:\Users\user1\AppData\Roaming\npm-cache\ionic\1.7.12\package.tgz
npm ERR! Windows_NT 6.1.7601
npm ERR! argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Users\\user1\\AppData\\Roaming\\npm\\node_modules\\npm\\bin\\n
pm-cli.js" "install" "-g" "ionic"
npm ERR! node v4.2.4
npm ERR! npm  v3.5.3
npm ERR! path C:\Users\user1\AppData\Local\Temp\npm-7336-1b0c36d1\unpack-4a6c8f61\node_modules\ionic-app-lib\node_modul
es\archiver\node_modules\file-utils\node_modules\isbinaryfile\tests\fixtures\04_HelloWorld.pdf
npm ERR! code EPERM
npm ERR! errno -4048
npm ERR! syscall open

npm ERR! Error: EPERM: operation not permitted, open 'C:\Users\user1\AppData\Local\Temp\npm-7336-1b0c36d1\unpack-4a6c8f
61\node_modules\ionic-app-lib\node_modules\archiver\node_modules\file-utils\node_modules\isbinaryfile\tests\fixtures\04_
HelloWorld.pdf'
npm ERR!     at Error (native)
npm ERR!  { [Error: EPERM: operation not permitted, open 'C:\Users\user1\AppData\Local\Temp\npm-7336-1b0c36d1\unpack-4a
6c8f61\node_modules\ionic-app-lib\node_modules\archiver\node_modules\file-utils\node_modules\isbinaryfile\tests\fixtures
\04_HelloWorld.pdf']
npm ERR!   errno: -4048,
npm ERR!   code: 'EPERM',
npm ERR!   syscall: 'open',
npm ERR!   path: 'C:\\Users\\user1\\AppData\\Local\\Temp\\npm-7336-1b0c36d1\\unpack-4a6c8f61\\node_modules\\ionic-app-l
ib\\node_modules\\archiver\\node_modules\\file-utils\\node_modules\\isbinaryfile\\tests\\fixtures\\04_HelloWorld.pdf' }
npm ERR!
npm ERR! Please try running this command again as root/Administrator.

npm ERR! Please include the following file with any support request:
npm ERR!     C:\Users\user1\npm-debug.log

Seems while untaring, the filepath is longer than acceptable by OS.

Any help please.

mathew-kurian commented 8 years ago

This could be a disk space issue. Try to clear your /tmp/ folder

ihorml commented 8 years ago

@bluejamesbond it helps for me. thx

mlhoque commented 8 years ago

Following worked for me

npm cache clean npm update npm install

alheranx commented 8 years ago

WARNING!, the sudo helps, and solve it, but i dont recommend it. Past days i have problems with that, because then the installation appears like root user by using sudo, and when you compile and other thins, the console show other type errrors because you are working with pacakges installed by SUDO(root) user.... then the best solution for not having problems in the future with updates and other libraries is change the chown user. In the next link i found more information: https://docs.npmjs.com/getting-started/fixing-npm-permissions

xiayumoGit commented 8 years ago

i have the same issue,any help?

ybbz commented 8 years ago

I use sudo solved this question in my mac too.

huangyingjie commented 8 years ago

I have solved by this way: just remove the $NVM_DIR and reinstall nvm.

daneshka commented 8 years ago

I have the same issue, none of the solutions worked for me. The problem is using virtualbox share folder. By copy pasting file to another folder it will work. I'm waiting for the real solution :)

mmrko commented 8 years ago

In my case this was caused by package.json and npm-shrinkwrap.json being "out of sync". So to fix things I needed to run npm shrinkwrap, fix the reported conflicts and then npm install.

srmob commented 8 years ago

npm cache and run as admin worked for me.

angelarted commented 8 years ago

FOR MAC USER: also for me, running the command with 'sudo' worked. So it become something like this: sudo npm install ...whatever you need to install

Romasato commented 8 years ago

Also, if you're on Virtualbox VM and have your project hosted on other partition (separate mounted *.vdi file), try moving it to the main system partition. Doing that has solved the issue for me :)

jedwards1211 commented 8 years ago

On my mac, running sudo npm cache clean worked for me; didn't have to run npm install with sudo.

y4code commented 8 years ago

just add “sudo” to the last one npm command order A hexo newer sudo npm install hexo-cli -g

enricostano commented 8 years ago

ubuntu/xenial64 vagrant VM on Mac OSX host, having similar issue running npm install: https://gist.github.com/nadalsol/2378a02e3eeffac35708349e97c1e492

sudo does not solve the issue.

BTW... this issue is open since 2014...

type-a-developer commented 7 years ago

I got the same errors because my VM ran out space have way through the npm install. Make sure you have enough space and run (npm cache clean). This worked for me.

webbanza commented 7 years ago

Encountered this issue in elementary OS (modified ubuntu), switched to yarn package manager.

jehoshua02 commented 7 years ago

MEME

andresjordanze commented 7 years ago

thanks @leoj3n npm cache clean worked for me!

flute commented 7 years ago

sudo npm install XX works for me! npm cache clean not worked

macOS Sierra 10.12.2
node v5.12.0
npm 3.8.9
dilagurung commented 7 years ago

I tried all the aforesaid trick(npm cache clean(run as admin too) , npm update) , but dint work.. still getting the same error orginially posted. Any help will be appreciated.

justinmc commented 7 years ago

I encountered this while trying to npm install a tarball that I created myself using grunt-contrib-compress. For whatever reason, the output of grunt-contrib-compress isn't like by npm. It worked fine for me when I created the tarball with tar -cvzf or npm pack instead.

Wyzardsleeves commented 7 years ago

I just built the app on Windows instead of my Ubuntu VM and that worked. I can even npm start through my VM and develop that way.