React-native: Error: Unable to resolve module `path` from `node_modules/@babel/core/lib/config/item.js`: path could not be found within the project.

Created on 16 Dec 2019  路  18Comments  路  Source: facebook/react-native


error: bundling failed: Error: Unable to resolve module path from node_modules/@babel/core/lib/config/item.js: path could not be found within the project.

If you are sure the module exists, try these steps:

  1. Clear watchman watches: watchman watch-del-all
  2. Delete node_modules: rm -rf node_modules and run yarn install
  3. Reset Metro's cache: yarn start --reset-cache
  4. Remove the cache: rm -rf /tmp/metro-*
    at ModuleResolver.resolveDependency (/Users/panfeilong/Desktop/react-native/AwesomeProject/node_modules/metro/src/node-haste/DependencyGraph/ModuleResolution.js:186:15)
    at ResolutionRequest.resolveDependency (/Users/panfeilong/Desktop/react-native/AwesomeProject/node_modules/metro/src/node-haste/DependencyGraph/ResolutionRequest.js:52:18)
    at DependencyGraph.resolveDependency (/Users/panfeilong/Desktop/react-native/AwesomeProject/node_modules/metro/src/node-haste/DependencyGraph.js:282:16)
    at Object.resolve (/Users/panfeilong/Desktop/react-native/AwesomeProject/node_modules/metro/src/lib/transformHelpers.js:267:42)
    at dependencies.map.result (/Users/panfeilong/Desktop/react-native/AwesomeProject/node_modules/metro/src/DeltaBundler/traverseDependencies.js:426:31)
    at Array.map ()
    at resolveDependencies (/Users/panfeilong/Desktop/react-native/AwesomeProject/node_modules/metro/src/DeltaBundler/traverseDependencies.js:423:18)
    at /Users/panfeilong/Desktop/react-native/AwesomeProject/node_modules/metro/src/DeltaBundler/traverseDependencies.js:275:33
    at Generator.next ()
    at asyncGeneratorStep (/Users/panfeilong/Desktop/react-native/AwesomeProject/node_modules/metro/src/DeltaBundler/traverseDependencies.js:87:24)
    React Native version:0.61.5

    System:
    OS: macOS Mojave 10.14.6
    CPU: (4) x64 Intel(R) Core(TM) i5-7360U CPU @ 2.30GHz
    Memory: 1.23 GB / 16.00 GB
    Shell: 3.2.57 - /bin/bash
    Binaries:
    Node: 10.16.0 - /usr/local/bin/node
    Yarn: 1.16.0 - /usr/local/bin/yarn
    npm: 6.9.0 - /usr/local/bin/npm
    SDKs:
    iOS SDK:
    Platforms: iOS 13.2, DriverKit 19.0, macOS 10.15, tvOS 13.2, watchOS 6.1
    Android SDK:
    API Levels: 23, 25, 26, 27, 28
    Build Tools: 27.0.3, 28.0.2, 28.0.3
    System Images: android-26 | Google Play Intel x86 Atom
    IDEs:
    Android Studio: 3.5 AI-191.8026.42.35.5900203
    Xcode: 11.2.1/11B500 - /usr/bin/xcodebuild
    npmPackages:
    react: 16.9.0 => 16.9.0
    react-native: ^0.61.5 => 0.61.5
    npmGlobalPackages:
    react-native-cli: 2.0.1

Steps To Reproduce

1.
2.

Describe what you expected to happen:
I am writing a code that suddenly reports an error. I did not install any new plugins or versions before or after the error caused me to be overwhelmed. The problem is now. After installing 'path', react-native reports an error 'fs' not found. I think
Anxious for help

Snack, code example, screenshot, or link to a repository:

Bug 馃摝Bundler

Most helpful comment

Just check if you somewhere accidentally imported something from @babel/core.
That helped me.

All 18 comments

Any help?
?

observing the same mistake

@afeichuanqi Did you find a solution? I've tried all the steps rn told me too and still get the same error. cant work

I am currently having the exactly same problem.

same

Just check if you somewhere accidentally imported something from @babel/core.
That helped me.

after that remove
import { loadPartialConfig } from '@babel/core';
everything go right

I found I imported resolvePlugin from '@babel/core' accidently.
import {resolvePlugin} from '@babel/core'; I think this imported while I typing resolve automatically, also I am using vscode.
I remove it and it's working well.
Thanks @chronikum

Just check if you somewhere accidentally imported something from @babel/core.
That helped me.

I faced the same problem and I tried as you said. It's resolved.

Just check if you somewhere accidentally imported something from @babel/core.
That helped me.

That helped... you saved my life man ... * stars for you :)

Just check if you somewhere accidentally imported something from @babel/core.
That helped me.

Thank you, I imported { transform } from '@babel/core'

Or sometimes this happen because you imported something from "jest-resolve"

I am using VSCode and it inserted import { types } from '@babel/core' accidently to cause this error.
Please make sure to prevent any imports from @babel/core in the codes.

check your current working JS file, you may accidentally or your editor inserted the import { anything } from '@babel/core';
Remove it and it will work.

Thank, you save my life

check your current working JS file, you may accidentally or your editor inserted the import { anything } from '@babel/core';
Remove it and it will work.

thank you

In vscode it automatically imported from @babel/core. I removed it and problem resolve thanks for @valerit and @farazAdnare

@MebDevelop @chronikum In which file did you find it, I already checked each one that I noticed, I can't find any that have that import

Was this page helpful?
0 / 5 - 0 ratings