npm Community Forum (Archive)

The npm community forum has been discontinued.

To discuss usage of npm, visit the GitHub Support Community.

EINVAL: invalid argument, read

I’m getting a really annoying error that’s preventing me from installing most packages. Some random person on stackoverflow solved their related issue with deleting node_modules but that doesn’t help me. Forcefully clearing or repairing npm cache also does not help at all.

H:\projects\node\webserver>npm i --save @arcticzeroo/webserver-module-msu
npm ERR! code EINVAL
npm ERR! EINVAL: invalid argument, read

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\Spencer\AppData\Roaming\npm-cache\_logs\2018-07-14T19_20_19_084Z-debug.log

This has only started happening in the past few months.

2018-07-14T19_20_19_084Z-debug.log (759.6 KB)
This is the referenced log file.

There are definitely a lot of packages in this project, but I can’t even install simple stuff. Running npm i --save-dev eslint @arcticzeroo/eslint-config fails in after either has been installed once before for me.

npm is pretty much unusable for me right now, and I have to use yarn to install modules. Which sucks because yarn is also weird and runs extra random commands from my package.json after I install things…

Lemme take a look. This looks like a legit bug.

Thank you! I would also like to note that it appears to be version-agnostic, for both npm and node. I’ve had it happen on node v8, 9, 10, and npm v5.6 through latest. (it could have been happening before any of those, that’s just the range on which I have tested)

I snooped around a bit and couldn’t track down the error. There’s definitely something weird going on and this definitely seems like a bug (so I’m gonna move it to #bugs). I would really appreciate if you edited the OP to fit into the bug report template after I do that, 'cause it’ll be easier to scan. It sounds like you have a repro that works for you so that’s great. I’ll try the repro myself on Windows on Monday and see how it goes (it’s a weekend, I’m not really working but I wanted to check something hadn’t gone horribly wrong with yesterday’s release).

For the time being, take a look at:

I suggest you try installing both node and npm entirely, and then do an install and do the upgrade doing npm-windows-upgrade. The node.js installer does… things that break npm sometimes, and I wanna make sure your install itself is working, in case that gets you going. It’s a bit of a stretch, but it’s what I’ve got for you right now. :green_heart:

Neither of those things helped, unfortunately :frowning:

I’m unsure if the repro is specific to my system, but yeah it’s very easy to reproduce since it happens with most modules haha.

It’s not related to yesterday’s release, so no worries there. I’ve had this issue for a while and just decided to post an issue about it.

I will format it into a bug in a moment.

edit: I’m receiving an error when I attempt to do so, and it provides no extra info, so no bug formatting for now unfortunately :(

I’m still getting that error unfortunately – some random answer on stackoverflow seemed to correlate it with the fact that someone else was installing onto a flash drive formatted with exFAT rather than NTFS (which is my case as well).

Deleting node_modules and package.json fixes it for a single run of the npm install

Same issue, the previous time I got that error when my external hard drive has been “unsafe removed” and it got some bad sectors, chkdsk fixed that issue for me for a while.
Now, this doesn’t help as well as node_modules remove or cache clean.

From my understanding, it can be “fixed” by reformatting your filesystem to be NTFS. My flash drive was FAT32 I believe, which is where I had my project. Moving off the flash drive onto my hard drive fixed it. I’d imagine that this issue only occurs where the filesystems differ – I believe that linux uses FAT32 natively (I am probably wrong there), which would imply that it can handle the flash drive fine.