无法解析模块 ./index
Unable to resolve module ./index
我运行我的项目很好,但突然开始出现这个错误:
Logs for your project will appear below.
Error: Unable to resolve module ./index from C:\Users\mateu\OneDrive\Documentos\React JS\Projetos\sleeper-app\sleeper-app-v1\sleeper-app/.: None of these files exist: * 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) * index\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) at ModuleResolver.resolveDependency (C:\Users\mateu\OneDrive\Documentos\React JS\Projetos\sleeper-app\sleeper-app-v1\sleeper-app\node_modules\metro\src\node-haste\DependencyGraph\ModuleResolution.js:136:15) at DependencyGraph.resolveDependency (C:\Users\mateu\OneDrive\Documentos\React JS\Projetos\sleeper-app\sleeper-app-v1\sleeper-app\node_modules\metro\src\node-haste\DependencyGraph.js:231:43) at C:\Users\mateu\OneDrive\Documentos\React JS\Projetos\sleeper-app\sleeper-app-v1\sleeper-app\node_modules\metro\src\lib\transformHelpers.js:129:24 at Server._resolveRelativePath (C:\Users\mateu\OneDrive\Documentos\React JS\Projetos\sleeper-app\sleeper-app-v1\sleeper-app\node_modules\metro\src\Server.js:1107:12) at Server.requestProcessor [as _processBundleRequest] (C:\Users\mateu\OneDrive\Documentos\React JS\Projetos\sleeper-app\sleeper-app-v1\sleeper-app\node_modules\metro\src\Server.js:450:37) at Server._processRequest (C:\Users\mateu\OneDrive\Documentos\React JS\Projetos\sleeper-app\sleeper-app-v1\sleeper-app\node_modules\metro\src\Server.js:406:9)
奇怪的是我实际上有一个 index.js
文件而且我没有对它做任何更改:
我的 index.js
文件包含:
import 'react-native-gesture-handler'
import { registerRootComponent } from 'expo';
import TrackPlayer from 'react-native-track-player';
import App from './App';
// registerRootComponent calls AppRegistry.registerComponent('main', () => App);
// It also ensures that whether you load the app in Expo Go or in a native build,
// the environment is set up appropriately
registerRootComponent(App);
// AppRegistry.registerComponent(...);
TrackPlayer.registerPlaybackService(() => require('./service'));
我尝试重新安装所有软件包,清理 node_modules
,升级 expo,清理 gradle,使用 expo r -c
重置缓存,停止我的 onedrive,重新启动我的电脑但没有任何效果
我的 OneDrive 可能有问题。我将我的应用程序文件夹从 /OneDrive
文件夹中取出,它工作正常。
我运行我的项目很好,但突然开始出现这个错误:
Logs for your project will appear below. Error: Unable to resolve module ./index from C:\Users\mateu\OneDrive\Documentos\React JS\Projetos\sleeper-app\sleeper-app-v1\sleeper-app/.: None of these files exist: * 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) * index\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) at ModuleResolver.resolveDependency (C:\Users\mateu\OneDrive\Documentos\React JS\Projetos\sleeper-app\sleeper-app-v1\sleeper-app\node_modules\metro\src\node-haste\DependencyGraph\ModuleResolution.js:136:15) at DependencyGraph.resolveDependency (C:\Users\mateu\OneDrive\Documentos\React JS\Projetos\sleeper-app\sleeper-app-v1\sleeper-app\node_modules\metro\src\node-haste\DependencyGraph.js:231:43) at C:\Users\mateu\OneDrive\Documentos\React JS\Projetos\sleeper-app\sleeper-app-v1\sleeper-app\node_modules\metro\src\lib\transformHelpers.js:129:24 at Server._resolveRelativePath (C:\Users\mateu\OneDrive\Documentos\React JS\Projetos\sleeper-app\sleeper-app-v1\sleeper-app\node_modules\metro\src\Server.js:1107:12) at Server.requestProcessor [as _processBundleRequest] (C:\Users\mateu\OneDrive\Documentos\React JS\Projetos\sleeper-app\sleeper-app-v1\sleeper-app\node_modules\metro\src\Server.js:450:37) at Server._processRequest (C:\Users\mateu\OneDrive\Documentos\React JS\Projetos\sleeper-app\sleeper-app-v1\sleeper-app\node_modules\metro\src\Server.js:406:9)
奇怪的是我实际上有一个 index.js
文件而且我没有对它做任何更改:
我的 index.js
文件包含:
import 'react-native-gesture-handler'
import { registerRootComponent } from 'expo';
import TrackPlayer from 'react-native-track-player';
import App from './App';
// registerRootComponent calls AppRegistry.registerComponent('main', () => App);
// It also ensures that whether you load the app in Expo Go or in a native build,
// the environment is set up appropriately
registerRootComponent(App);
// AppRegistry.registerComponent(...);
TrackPlayer.registerPlaybackService(() => require('./service'));
我尝试重新安装所有软件包,清理 node_modules
,升级 expo,清理 gradle,使用 expo r -c
重置缓存,停止我的 onedrive,重新启动我的电脑但没有任何效果
我的 OneDrive 可能有问题。我将我的应用程序文件夹从 /OneDrive
文件夹中取出,它工作正常。