简体   繁体   English

为“npm install --save-dev eslint --verbose”获取“错误:EINVAL:无效参数,读取”

[英]getting “Error: EINVAL: invalid argument, read” for “npm install --save-dev eslint --verbose”

Any ideas/assistance here re how to get "npm install --save-dev eslint --verbose" working.这里的任何想法/帮助都是关于如何让“npm install --save-dev eslint --verbose”工作的。 I keep getting:我不断得到:

Error: EINVAL: invalid argument, read

I've setup up a new react-native project:我已经建立了一个新的 react-native 项目:

react-native init gcLists

E:\gcLists>npm -v
5.5.1
E:\gcLists>yarn -v
1.2.1
E:\gcLists>react-native -v
react-native-cli: 2.0.1
react-native: 0.49.5

npm install --save-dev eslint --verbose

Last part of the log:日志的最后一部分:

npm http fetch GET 304 https://registry.npmjs.org/slice-ansi 104ms (from cache)
npm verb correctMkdir D:\Users\greg\AppData\Roaming\npm-cache\_locks correctMkdir not in flight; initializing
npm verb lock using D:\Users\greg\AppData\Roaming\npm-cache\_locks\staging-255cd84f0d76b150.lock for E:\gcLists\node_modules\.staging
npm info lifecycle semver@5.4.1~preuninstall: semver@5.4.1
npm info lifecycle semver@5.4.1~uninstall: semver@5.4.1
npm verb unbuild rmStuff semver@5.4.1 from E:\gcLists\node_modules
npm verb unlock done using D:\Users\greg\AppData\Roaming\npm-cache\_locks\staging-255cd84f0d76b150.lock for E:\gcLists\node_modules\.staging
npm verb stack Error: EINVAL: invalid argument, read
npm verb stack     at D:\Users\greg\AppData\Roaming\npm\node_modules\npm\lib\utils\gently-rm.js:275:7
npm verb stack     at D:\Users\greg\AppData\Roaming\npm\node_modules\npm\node_modules\iferr\index.js:13:50
npm verb stack     at D:\Users\greg\AppData\Roaming\npm\node_modules\npm\node_modules\graceful-fs\polyfills.js:287:18
npm verb stack     at FSReqWrap.oncomplete (fs.js:154:5)
npm verb cwd E:\gcLists
npm verb Windows_NT 6.1.7601
npm verb argv "C:\\Program Files\\nodejs\\node.exe" "D:\\Users\\greg\\AppData\\Roaming\\npm\\node_modules\\npm\\bin\\npm-cli.js" "install" "--save-dev" "eslint" "--verbose"
npm verb node v8.7.0
npm verb npm  v5.5.1
npm ERR! code EINVAL
npm ERR! EINVAL: invalid argument, read
npm verb exit [ 1, true ]

npm ERR! A complete log of this run can be found in:
npm ERR!     D:\Users\greg\AppData\Roaming\npm-cache\_logs\2017-11-03T02_38_08_842Z-debug.log

Notes:注意事项:

  • On Windows 7在 Windows 7 上

UPDATE: * Results of npm install --save-dev eslint --verbose may be found here.更新: * npm install --save-dev eslint --verbose可以在这里找到

Since you are using drive letter E:, you might be on a portable drive.由于您使用的是驱动器号 E:,因此您可能使用的是便携式驱动器。 I had the same problem using an USB-Stick formatted on FAT32.我在使用 FAT32 格式的 USB 记忆棒时遇到了同样的问题。 I solved it reformatting to NTFS.我解决了它重新格式化为 NTFS 的问题。

What helped me was to also delete my package-lock.json file.帮助我的是还删除了我的 package-lock.json 文件。

rm -rf node_modules package-lock.json
npm i

Sometimes some packages have issues with npm.有时某些软件包会出现 npm 问题。 This could be base on combination of OS/package version/node version/npm version compatibility issue.这可能是基于 OS/包版本/节点版本/npm 版本兼容性问题的组合。

In such cases best thing is to do is try and use some other package manager.在这种情况下,最好的办法是尝试使用其他包管理器。 Try this with yarn用纱线试试这个

yarn add eslint

Same problem happened to me and what i did was deleting the whole node_modules folder and run npm install again.同样的问题发生在我身上,我所做的是删除整个 node_modules 文件夹并再次运行npm install It fixed the error.它修复了错误。 The reason was in the initial npm install it was closed in the middle by me which crashed some files.原因是在最初的 npm install 中它被我在中间关闭,导致一些文件崩溃。

Try cleaning the npm cache:尝试清理 npm 缓存:

npm cache clean

Then try again.然后再试一次。

I was getting the error when I did npm update so i deleted some npm outdated node_modules and ran npm update again and it worked.我在执行npm update时遇到错误,所以我删除了一些npm outdated node_modules并再次运行npm update并且它工作正常。

yarn upgrade also fixed the thing. yarn upgrade也修复了这个问题。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM