安装 fs-extra 时失败 - react-native

Failling when installing fs-extra - react-native

~我正在为 android 创建一个新应用程序,当我命令 react-native 运行-android 和这个错误过来: 错误:捆绑失败:错误:无法从 C:\Users\luis.arnoni.fritzen\Documents\ReactNative\Hello\node_modules\expo-cli\build\exp.js 解析模块 fs:急速模块映射

中不存在模块 fs

阅读一些文档,这似乎是 fs 包的问题。我尝试安装 fs-extra 包,但出现错误

   npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.2.9 
   (node_modules\fsevents):
   npm WARN optional SKIPPING OPTIONAL DEPENDENCY: Error: EPERM: operation 
   not permitted, rename 
   'C:\Users\luis.arnoni.fritzen\Documents\ReactNative
   \Hello\node_modules\.staging\fsevents-aa6bf958\node_modules\rc' -> 
   'C:\Users\luis.arnoni.fritzen\Documents
   \ReactNative\Hello\node_modules\.staging\rc-e2a21b3f'

   npm ERR! path C:\Users\luis.arnoni.fritzen\Documents\ReactNative\
   Hello\node_modules\fs-extra\lib\fs
   npm ERR! code EPERM
   npm ERR! errno -4048
   npm ERR! syscall unlink
   npm ERR! Error: EPERM: operation not permitted, unlink 
   'C:\Users\luis.arnoni.fritzen\Documents\
   ReactNative\Hello\node_modules\fs-extra\lib\fs'
   npm ERR!  { [Error: EPERM: operation not permitted, unlink 
   'C:\Users\luis.arnoni.fritzen\Documents\ReactNative\
   Hello\node_modules\fs-extra\lib\fs']
   npm ERR!   cause:
   npm ERR!    { Error: EPERM: operation not permitted, unlink 
   'C:\Users\luis.arnoni.fritzen\Documents\ReactNative\
   Hello\node_modules\fs-extra\lib\fs'
   npm ERR!      errno: -4048,
   npm ERR!      code: 'EPERM',
   npm ERR!      syscall: 'unlink',
   npm ERR!      path:
   npm ERR!       
   'C:\Users\luis.arnoni.fritzen\Documents\ReactNative\
   Hello\node_modules\fs-extra\lib\fs' },
   npm ERR!   stack:
   npm ERR!    'Error: EPERM: operation not permitted, unlink 
   \'C:\Users\luis.arnoni.fritzen\Documents\
   ReactNative\Hello\node_modules\fs-extra\lib\fs\'',
   npm ERR!   errno: -4048,
   npm ERR!   code: 'EPERM',
   npm ERR!   syscall: 'unlink',
   npm ERR!   path:
   npm ERR!    'C:\Users\luis.arnoni.fritzen\Documents\
   ReactNative\Hello\node_modules\fs-extra\lib\fs',
   npm ERR!   parent: 'Hello' }
   npm ERR!
   npm ERR! The operation was rejected by your operating system.
   npm ERR! It's possible that the file was already in use (by a text 
   editor or antivirus),
   npm ERR! or that you lack permissions to access it.
   npm ERR!
   npm ERR! If you believe this might be a permissions issue, please 
   double-check the
   npm ERR! permissions of the file and its containing directories, or try 
   running
   npm ERR! the command again as root/Administrator (though this is not 
   recommended).

   npm ERR! A complete log of this run can be found in:
   npm ERR!     C:\Users\luis.arnoni.fritzen\AppData\Roaming\npm- 
   cache\_logs19-09-16T16_08_43_971Z-debug.log

react-native没有完整的节点环境。并非所有节点模块都适用于 react-native。您可以考虑使用 https://github.com/itinance/react-native-fs

提到一条解决了我的问题的评论似乎非常重要:

react-native没有完整的node环境。并非所有节点模块都适用于 react-native。您可以考虑使用 https://github.com/itinance/react-native-fs