event.js:174 throw er// 不允许未处理的“错误”事件操作

kei*_*eil 6 javascript android node.js reactjs react-native

每次我尝试将我的应用程序部署到 android 时我都会得到这个,它破坏了我的 Metro 服务器。

我尝试更新我的环境变量。

events.js:174
      throw er; // Unhandled 'error' event
      ^

Error: EPERM: operation not permitted, lstat 'C:\Users\user\Documents\DEV\react-native-dualscreen\dualscreeninfo\examples\android\app\build\generated\not_namespaced_r_class_sources\debug\processDebugResources\r\androidx\lifecycle\viewmodel'
Emitted 'error' event at:
    at NodeWatcher.<anonymous> (C:\Users\user\Documents\DEV\react-native-dualscreen\dualscreeninfo\examples\node_modules\sane\src\node_watcher.js:291:16)
    at FSReqWrap.oncomplete (fs.js:153:21)
Run Code Online (Sandbox Code Playgroud)

小智 1

我猜这个问题是因为你的 Windows env 路径设置而发生的,确切的解决方案是:添加%SystemRoot%\system32到你的 PATH,按照以下步骤操作:

  1. 右键单击桌面上的“我的电脑”。
  2. 单击属性。
  3. 在“系统属性”窗口中,单击“高级”选项卡,然后单击“环境变量”。
  4. 在“系统变量”窗口中,突出显示“路径”,然后单击“编辑”。
  5. 在“编辑系统变量”窗口中,将光标插入“变量值”字段的末尾。
  6. 如果最后一个字符不是分号 (;),请添加一个。
  7. 在最后一个分号后,键入要查找的文件的完整路径。
    %SystemRoot%\system32
    
    Run Code Online (Sandbox Code Playgroud)
  8. 在每个打开的窗口中单击“确定”
  9. 重启系统

提示:记住,您应该重新启动系统。重启后这个问题就会消失。