react-native - 错误 : Cannot find module 'source-map-support'

标签 react-native expo node-modules

我今天打开 React Native 应用程序时突然出现了这个错误。我尝试了 npm installyarn 和清理缓存,但没有任何帮助。正如我所说,它是凭空冒出来的,因为在那之前一切都运行良好。这可能是什么原因,我该如何解决?

    > expo start

internal/modules/cjs/loader.js:968
  throw err;
  ^

Error: Cannot find module 'source-map-support'
Require stack:
- C:\Users\Angel\AppData\Roaming\npm\node_modules\expo-cli\node_modules\xdl\build\index.js
- C:\Users\Angel\AppData\Roaming\npm\node_modules\expo-cli\build\exp.js
- C:\Users\Angel\AppData\Roaming\npm\node_modules\expo-cli\bin\expo.js
    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:965:15)
    at Function.Module._load (internal/modules/cjs/loader.js:841:27)
    at Module.require (internal/modules/cjs/loader.js:1025:19)
    at require (internal/modules/cjs/helpers.js:72:18)
    at Object.<anonymous> (C:\Users\Angel\AppData\Roaming\npm\node_modules\expo-cli\node_modules\xdl\build\index.js:4:30)
    at Module._compile (internal/modules/cjs/loader.js:1137:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1157:10)
    at Module.load (internal/modules/cjs/loader.js:985:32)
    at Function.Module._load (internal/modules/cjs/loader.js:878:14)
    at Module.require (internal/modules/cjs/loader.js:1025:19) {
  code: 'MODULE_NOT_FOUND',
  requireStack: [
    'C:\\Users\\Angel\\AppData\\Roaming\\npm\\node_modules\\expo-cli\\node_modules\\xdl\\build\\index.js',
    'C:\\Users\\Angel\\AppData\\Roaming\\npm\\node_modules\\expo-cli\\build\\exp.js',
    'C:\\Users\\Angel\\AppData\\Roaming\\npm\\node_modules\\expo-cli\\bin\\expo.js'
  ]
}
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! @ start: `expo start`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the @ start script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\Angel\AppData\Roaming\npm-cache\_logs\2021-06-06T18_17_52_900Z-debug.log

最佳答案

最后经过几个小时的努力,我刚刚删除了 Expo,然后重新安装它,它成功了。

关于react-native - 错误 : Cannot find module 'source-map-support' ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/67862354/

相关文章:

node.js - npm install 返回 syscall spawn git 错误

javascript - Metro extraNodeModules 不起作用 - 错误 : Unable to resolve module

android - 为什么 React Native Picker 在我的 Android 模拟器中无法工作?

android - react native : react native undefined is not an object (evaluating 'this. _lazyCallableModules

javascript - React-Native ios如何使用android按钮

android - 在 scrollView 滚动时同时 ScrollView

reactjs - 尽管 TypeScript 编译器出现错误,为什么我的 React Native 应用程序仍能成功构建?

react-native - 在 React Native (Expo) 中上传图片,使用 fetch 导致 400 错误

javascript - Node 和 DialogFlow 错误 : UnhandledPromiseRejectionWarning: TypeError: sessionClient. projectAgentSessionPath 不是函数

react-native - 如何在React Native中从输入字段清除焦点?