how to fix node_modules error?

Please run expo diagnostics and paste the log that’s printed out along with your question or issue!

I use expo version 40 in my project and in my computer installed expo sdk version 42.
i did “npm start” and got error like this

Unable to resolve module ./plugins/Immutable from node_modules\pretty-format\build\index.js:
None of these files exist:

  • node_modules\pretty-format\build\plugins\Immutable(.native|.ios.expo.ts|.native.expo.ts|.expo.ts|.ios.expo.tsx|.native.expo.tsx|.expo.tsx|.ios.expo.js|.native.expo.js|.expo.js|.ios.expo.jsx|.native.expo.jsx|.expo.jsx|.ios.ts|.native.ts|.ts|.ios.tsx|.native.tsx|.tsx|.ios.js|.native.js|.js|.ios.jsx|.native.jsx|.jsx|.ios.json|.native.json|.json)
  • node_modules\pretty-format\build\plugins\Immutable\index(.native|.ios.expo.ts|.native.expo.ts|.expo.ts|.ios.expo.tsx|.native.expo.tsx|.expo.tsx|.ios.expo.js|.native.expo.js|.expo.js|.ios.expo.jsx|.native.expo.jsx|.expo.jsx|.ios.ts|.native.ts|.ts|.ios.tsx|.native.tsx|.tsx|.ios.js|.native.js|.js|.ios.jsx|.native.jsx|.jsx|.ios.json|.native.json|.json)
    ABI40_0_0facebook::ABI40_0_0React::JSIExecutor::defaultTimeoutInvoker(std::__1::function<void ()> const&, std::__1::function<std::__1::basic_string<char, std::__1::char_traits, std::__1::allocator > ()>)
    ABI40_0_0facebook::ABI40_0_0React::JSIExecutor::defaultTimeoutInvoker(std::__1::function<void ()> const&, std::__1::function<std::__1::basic_string<char, std::__1::char_traits, std::__1::allocator > ()>)
    DAF30062-4C85-3B92-B159-50602A0C9D97
    DAF30062-4C85-3B92-B159-50602A0C9D97
    _dispatch_main_queue_callback_4CF
    4FBDF167-161A-324C-A233-D516922C67E5
    4FBDF167-161A-324C-A233-D516922C67E5
    CFRunLoopRunSpecific
    GSEventRunModal
    33B02AB5-5DAF-3249-8DC6-5872DF830EC5
    UIApplicationMain
    Expo Go
    E574A365-9878-348A-8E84-91E163CFC128

i didn’t installed immutable package and pretty-format.
Why is there an error?

pretty-format is installed because it’s a dependency of something else.

I do have a file called node_modules/pretty-format/build/plugins/Immutable.js, so you should too. The fact that you don’t seem to implies that your node_modules directory is somehow corrupted or incomplete.

Try deleting node_modules and re-running npm install

1 Like

As you said, it goes well! thank you!!!

1 Like