JavaEar 专注于收集分享传播有价值的技术资料

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. I keep getting:

Error: EINVAL: invalid argument, read

I've setup up a new react-native project:

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

UPDATE: * Results of npm install --save-dev eslint --verbose https://pastebin.com/NcnpfpQ8

2个回答

    最佳答案
  1. Sometimes some packages have issues with npm. This could be base on combination of OS/package version/node version/npm version compatibility issue.

    In such cases best thing is to do is try and use some other package manager. Try this with yarn

    yarn add eslint
    
  2. 参考答案2
  3. Try cleaning the npm cache:

    npm cache clean
    

    Then try again.