Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ndeed, none of these files exist: * /Users/mini12/Documents/Projects/yourz-mobile/node_modules/idb-keyval/dist/compat.cjs(.native|.android.ts|.native.ts| #144

Closed
tiavina-mika opened this issue Jan 3, 2022 · 6 comments

Comments

@tiavina-mika
Copy link

my environment:
OS: macOS 10.15.0
Computer model: Mac Mini 2012
React Native: 0.64.3
Expo: 44.0.0
Node: v14.18.2

when i run "yarn android" on macOS I got this error:
Android Bundling failed 99474ms
While trying to resolve module idb-keyval from file /Users/mini12/Documents/Projects/yourz-mobile/node_modules/parse/lib/react-native/IndexedDBStorageController.js, the package /Users/mini12/Documents/Projects/yourz-mobile/node_modules/idb-keyval/package.json was successfully found. However, this package itself specifies a main module field that could not be resolved (/Users/mini12/Documents/Projects/yourz-mobile/node_modules/idb-keyval/dist/compat.cjs. Indeed, none of these files exist:

  • /Users/mini12/Documents/Projects/yourz-mobile/node_modules/idb-keyval/dist/compat.cjs(.native|.android.ts|.native.ts|.ts|.android.tsx|.native.tsx|.tsx|.android.js|.native.js|.js|.android.jsx|.native.jsx|.jsx|.android.json|.native.json|.json)
  • /Users/mini12/Documents/Projects/yourz-mobile/node_modules/idb-keyval/dist/compat.cjs/index(.native|.android.ts|.native.ts|.ts|.android.tsx|.native.tsx|.tsx|.android.js|.native.js|.js|.android.jsx|.native.jsx|.jsx|.android.json|.native.json|.json)

Capture d’écran 2022-01-03 à 09 47 28

@carlnx
Copy link

carlnx commented Jan 4, 2022

I am having the exactly same problem!!! :(

@jakearchibald
Copy link
Owner

It looks like the issue is with React Native. There's a suggested workaround here, but I haven't tested facebook/metro#535 (comment)

Let me know if that works.

@carlnx
Copy link

carlnx commented Jan 4, 2022

It looks like the issue is with React Native. There's a suggested workaround here, but I haven't tested facebook/metro#535 (comment)

Let me know if that works.

Hi! This code solved for me... phew!!!

/**
 * Metro configuration for React Native
 * https://github.com/facebook/react-native
 *
 * @format
 */
const defaultSourceExts =
    require('metro-config/src/defaults/defaults').sourceExts;
module.exports = {
    transformer: {
        getTransformOptions: () => ({
            transform: {
                experimentalImportSupport: false,
                inlineRequires: true,
            },
        }),
    },
    resolver: {
        sourceExts: process.env.RN_SRC_EXT
            ? [...process.env.RN_SRC_EXT.split(',').concat(defaultSourceExts), 'cjs', 'jsx'] 
            : [...defaultSourceExts, 'cjs', 'jsx'], 
    },
};

Look I had to add jsx too... Do not ask me why... :(

@tiavina-mika
Copy link
Author

@jakearchibald , @carlnx thanks, it's worked

@carlnx
Copy link

carlnx commented Jan 5, 2022

Well... now another issue that I did not understand :(

When I use parse (see code), it happens the error:

[Unhandled promise rejection: ReferenceError: Can't find variable: indexedDB]
at node_modules/idb-keyval/dist/compat.cjs:34:12 in createStore

The code that calls this error:

import AsyncStorage from '@react-native-async-storage/async-storage';

const bdParse = () => {
    const Parse = require('parse/react-native.js');
    Parse.setAsyncStorage(AsyncStorage);
    //APP_ID
    Parse.initialize('xxxxxxxxxx');
    Parse.masterKey = 'xxxxxxxxx';
    Parse.serverURL = 'https://xxxx.xzxxx.xxx.xx.xx/parse';
    return Parse;
}

Any ideas? :(

@NajeebUllah161
Copy link

You must be using abc.js instead of abc.jsx

use import React from "react"; in the .js file and issue would be solved..!!!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants