〜我正在为android创建一个新应用,当我命令 react-native run-android 时,出现此错误:
错误:捆绑失败:错误:无法解析fs
中的模块C:\Users\luis.arnoni.fritzen\Documents\ReactNative\Hello\node_modules\expo-cli\build\exp.js
:急速模块映射中不存在模块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\_logs\2019-09-16T16_08_43_971Z-debug.log
答案 0 :(得分:0)
react-native
没有完整的节点环境。并非所有节点模块都可与react-native一起使用。您可以考虑使用https://github.com/itinance/react-native-fs
答案 1 :(得分:0)
提及解决我的问题的一条评论似乎非常重要:
react-native没有完整的节点环境。并非所有节点模块都可与react-native一起使用。您可以考虑使用https://github.com/itinance/react-native-fs