unable to resolve ./../packages.json from node_modules/<pacakge-name>

Viewed 40

I am unable to compile my react-native JS bundle, as I am repeatedly getting the above error, but I don't think this has to be related to any package, although I doubt I am having some configuration issue with either babel or typescript

My tsconfig.json looks something like this

{
"compilerOptions": {
    /* Basic Options */
    "target": "es6" /* Specify ECMAScript target version: 'ES3' (default), 'ES5', 'ES2015', 'ES2016', 'ES2017','ES2018' or 'ESNEXT'. */,
    "module": "commonjs" /* Specify module code generation: 'none', 'commonjs', 'amd', 'system', 'umd', 'es2015', or 'ESNext'. */,
    "allowJs": true /* Allow javascript files to be compiled. */,
    // "checkJs": true /* Report errors in .js files. */,
    "jsx": "react-native" /* Specify JSX code generation: 'preserve', 'react-native', or 'react'. */,
    "noEmit": true /* Do not emit outputs. */,
    "strict": true /* Enable all strict type-checking options. */,
    "moduleResolution": "node" /* Specify module resolution strategy: 'node' (Node.js) or 'classic' (TypeScript pre-1.6). */,
    "allowSyntheticDefaultImports": true /* Allow default imports from modules with no default export. This does not affect code emit, just typechecking. */,
    "esModuleInterop": true /* Enables emit interoperability between CommonJS and ES Modules via creation of namespace objects for all imports. Implies 'allowSyntheticDefaultImports'. */,
    "baseUrl": ".",
    "paths": {
        "*": ["App/*"],
        "Assets": ["App/Assets"],
        "Components": ["App/Components"],
        "Config": ["App/Config"],
        "Containers": ["App/Containers"],
        "Fixtures": ["App/Fixtures"],
        "Images": ["App/Images"],
        "Navigation": ["App/Navigation"],
        "Sagas": ["App/Sagas"],
        "Services": ["App/Services"],
        "Themes": ["App/Themes"],
        "types": ["types"]
    }
},
"exclude": ["node_modules"]

}

And my babelrc looks something liks this

    "presets": [
        "module:metro-react-native-babel-preset",
        "@babel/preset-typescript"
    ],
    "plugins": [
        ["@babel/plugin-transform-flow-strip-types"],
        [
            "@babel/plugin-proposal-decorators",
            {
                "legacy": true
            }
        ],
        [
            "@babel/plugin-proposal-class-properties",
            {
                "loose": true
            }
        ],
        [
            "module-resolver",
            {
                "extensions": [".js", ".ios.js", ".android.js", ".ts", ".tsx", ".json"],
                "alias": {
                    "Assets": "./App/Assets",
                    "Components": "./App/Components",
                    "Config": "./App/Config",
                    "Containers": "./App/Containers",
                    "Fixtures": "./App/Fixtures",
                    "Images": "./App/Images",
                    "Navigation": "./App/Navigation",
                    "Sagas": "./App/Sagas",
                    "Services": "./App/Services",
                    "Themes": "./App/Themes",
                    "types": "./types"
                }
            }
        ]
    ],
    "env": {
        "production": {
            "plugins": ["ignite-ignore-reactotron", "transform-remove-console"]
        }
    }
}

babel packages being used

        "@babel/cli": "^7.6.0",
        "@babel/core": "^7.6.2",
        "@babel/plugin-proposal-class-properties": "^7.12.1",
        "@babel/plugin-proposal-decorators": "^7.12.1",
        "@babel/plugin-proposal-object-rest-spread": "^7.12.1",
        "@babel/plugin-transform-flow-strip-types": "^7.12.10",
        "@babel/preset-flow": "^7.0.0",
        "@babel/preset-typescript": "^7.12.7",
        "@babel/runtime": "^7.6.2",
        "babel-eslint": "^10.1.0",
        "babel-jest": "^24.9.0",
        "babel-plugin-functional-hmr": "^1.0.24",
        "babel-plugin-ignite-ignore-reactotron": "^0.3.0",
        "babel-plugin-module-resolver": "^4.1.0",
        "babel-plugin-transform-remove-console": "^6.9.4",
        "babel-preset-es2015": "^6.18.0",
        "babel-preset-react-native": "^5",

I am not able to connect the dots at all that what exactly going wrong,not even deleting packager cache of react-native either helping here

0 Answers
Related