Error: ENOENT: no such file or directory, open 'C:\Users\kudo\01_Work\Repos\expo\expo\android\versioned-react-native

See original GitHub issue

Summary

I have upgraded expo from 46 to 47 and added hermes on app.json

now I get this error message

Error: ENOENT: no such file or directory, open 'C:\Users\kudo\01_Work\Repos\expo\expo\android\versioned-react-native\ReactAndroid\hermes-engine\.cxx\MinSizeRel\2q85j1u4\arm64-v8a\lib\InternalBytecode\InternalBytecode.js'
    at Object.openSync (node:fs:585:3)
    at Object.readFileSync (node:fs:453:35)
    at getCodeFrame (C:\xxx\node_modules\metro\src\Server.js:1028:18)
    at Server._symbolicate (C:\xxx\node_modules\metro\src\Server.js:1101:22)
    at runMicrotasks (<anonymous>)
    at processTicksAndRejections (node:internal/process/task_queues:96:5)
    at async Server._processRequest (C:\xxx\node_modules\metro\src\Server.js:458:7) {
  errno: -4058,
  code: 'ENOENT',
  path: 'C:\\Users\\kudo\\01_Work\\Repos\\expo\\expo\\android\\versioned-react-native\\ReactAndroid\\hermes-engine\\.cxx\\MinSizeRel\\2q85j1u4\\arm64-v8a\\lib\\InternalBytecode\\InternalBytecode.js'
}

This happend when I dispatch anything with RTK Query

Only happens on Android.

What platform(s) does this occur on?

Android

Environment

expo-env-info 1.0.5 environment info: System: OS: Windows 10 10.0.19044 Binaries: Node: 16.13.2 - C:\Program Files\nodejs\node.EXE Yarn: 1.22.11 - ~\AppData\Roaming\npm\yarn.CMD npm: 8.1.2 - C:\Program Files\nodejs\npm.CMD IDEs: Android Studio: Version 2020.3.0.0 AI-203.7717.56.2031.7583922 npmPackages: expo: ^47.0.0 => 47.0.8 react: 18.1.0 => 18.1.0 react-dom: 18.1.0 => 18.1.0 react-native: 0.70.5 => 0.70.5 react-native-web: ~0.18.7 => 0.18.8 Expo Workflow: managed

Minimal reproducible example

import { createApi, fetchBaseQuery } from "@reduxjs/toolkit/dist/query/react";
// @ts-ignore
import { API_ENDPOINT } from '@env';
import { IProduct } from "../../../components/Product";

export const WishlistApi = createApi({
  reducerPath: 'WishlistApi',
  baseQuery: fetchBaseQuery({baseUrl: `${API_ENDPOINT}/`}),
  tagTypes: ['WISHLIST', 'HOME'],
  endpoints: (build) => ({
    // Wishlist
    wishlist: build.query<(IProduct & { is_wishlist: boolean; })[], { user_id: number; }>({
      query: (data) => ({
        url: '/wishlist',
        method: 'POST',
        body: data
      }),
      providesTags: ['WISHLIST']
    }),
    // Main Products
    homeList: build.query<(IProduct & { is_wishlist: boolean; })[], void>({
      query: (data) => ({
        url: '/home',
        method: 'POST',
        body: data
      }),
//      providesTags: ['HOME']
    }),
    testList: build.query<(IProduct & { is_wishlist: boolean; })[], void>({
      query: (data) => ({
        url: '/test',
        method: 'POST',
        body: data
      }),
//      providesTags: ['HOME']
    }),
    getPost: build.query<IProduct, number>({
      query: (id) => `get_product/${id}`,
      providesTags: ['HOME'],
    }),
//      providesTags: ['HOME']
    updateHomelist: build.mutation<void, { product_id: number; product: IProduct; user_id?: number; }>({
      query: (data) => ({
        url: '/add_to_wishlist',
        method: 'POST',
        body: data
      }),
      async onQueryStarted({ product_id, product, user_id }, { dispatch, queryFulfilled }) {

        const patchResult = dispatch(
          WishlistApi.util.updateQueryData('homeList', undefined, (draft) => {
            const pf = draft?.find((el => el.id === product_id));
            if(pf) {
              pf.is_wishlist = !pf.is_wishlist;
            }
           // Object.assign(draft, product)
          })
        )
   
        const patchResult2 = dispatch(
          WishlistApi.util.updateQueryData('testList', undefined, (draft) => {
            const pf = draft?.find((el => el.id === product_id));
            if(pf) {
              pf.is_wishlist = !pf.is_wishlist;
            }
           // Object.assign(draft, product)
          })
        )

        const patchResult3 = dispatch(
          WishlistApi.util.updateQueryData('wishlist', { user_id }, (draft) => {
            console.log('HI');
            const dd = draft?.find((el => el.id === product_id));
            console.log(dd);
            if(dd) {
              return draft.filter((el => el.id !== product_id));
            } else {
              draft.push({...product, is_wishlist: true});
            }
           
           // Object.assign(draft, product)
          })
        )
        try {
          await queryFulfilled
        } catch {
          patchResult.undo();
          patchResult2.undo();
          patchResult3.undo();

          /**
           * Alternatively, on failure you can invalidate the corresponding cache tags
           * to trigger a re-fetch:
           * dispatch(api.util.invalidateTags(['Post']))
           */
        }
      },
    //  invalidatesTags: ['WISHLIST']
    }),
...

Issue Analytics

  • State:closed
  • Created 10 months ago
  • Reactions:1
  • Comments:9 (4 by maintainers)

github_iconTop GitHub Comments

2reactions
Kudocommented, Dec 9, 2022

yes i did try on windows mahcine which doesn’t have the same path.

well, i finally get the repro today. it’s from unhandled promise rejection. the error only show in cli terminal and not impact to the app. i’ll try to figure out what happen to hermes internally.

export default function App() {
  async function foo() {
    throw new Error("unhandled promise rejection");
  }

  useEffect(() => {
    foo();
  }, []);
 // ...
}
1reaction
Thodor12commented, Dec 5, 2022

Retract that previous statement, I’ve done some testing and checking in that stacktrace, it does come from metro, but it appears whenever metro wants to display a warning message on the screen of the device.

That’s what that _symbolize call does. If I open my project and purposefully make a compilation error, that’s when the error appears. So I put a logger on that statement like so

  async _symbolicate(req, res) {
    const getCodeFrame = (urls, symbolicatedStack) => {
      for (let i = 0; i < symbolicatedStack.length; i++) {
        const { collapse, column, file, lineNumber } = symbolicatedStack[i];
        const fileAbsolute = path.resolve(
          this._config.projectRoot,
          file !== null && file !== void 0 ? file : ""
        );
        console.log(fileAbsolute, this._config.projectRoot)

For most files this prints correctly like this:

D:\Projects\IPM\App\node_modules\react-devtools-core\dist\backend.js D:\Projects\IPM\App
D:\Projects\IPM\App\node_modules\expo\build\logs\RemoteConsole.js D:\Projects\IPM\App
D:\Projects\IPM\App\node_modules\expo\build\environment\react-native-logs.fx.js D:\Projects\IPM\App

But there’s one entry which shows this:

D:\Users\kudo\01_Work\Repos\expo\expo\android\versioned-react-native\ReactAndroid\hermes-engine\.cxx\MinSizeRel\6d3b5k69\arm64-v8a\lib\InternalBytecode\InternalBytecode.js D:\Projects\IPM\App

I have no idea from where this symbolization is being initiated, but it does look like there’s some faulty path set somewhere.

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to resolve Nodejs: Error: ENOENT: no such file or directory
Not as simple as my solution--computer rebooted, opened powershell in c:\windows\system, and I didn't realize I wasn't in my project directory!
Read more >
Error: ENOENT: no such file or directory, open 'libtaos.so' #2255
This isn't a td-connector issue by the way, it just depends on the permissions set for the libtaos.so and other files.
Read more >
Error: ENOENT: no such file or directory, open
This is not a feature suggestion. Whenever Visual Studio Installer needs to update itself when opened through an update notification in Visual Studio, ......
Read more >
ENOENT: no such file or directory" (Doc ID 2895246.1)
When Selecting "Optimize Application" VBS Package Job Fails With "Error: ENOENT: no such file or directory" (Doc ID 2895246.1).
Read more >
Error: ENOENT: no such file or directory, scandir ... - YouTube
nodejsError: ENOENT : no such file or directory, scandir '**/node_modules/node-sass/vendor' | Module build failed (from .
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found