无法解析模块 expo-constants
2021-12-17
7617
我安装了一个 expo-constant 进行测试,之后我通过
npm uninstall expo-constants
现在当我运行我的应用程序时出现错误:
Unable to resolve module expo-constants from C:\Users..\node_modules\expo-font\build\FontLoader.js: expo-constants 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 and run yarn install
3. Reset Metro's cache: yarn start --reset-cache
4. Remove the cache: rm -rf /tmp/metro-*
1 | import { CodedError } from '@unimodules/core';
2 | import { Asset } from 'expo-asset';
> 3 | import Constants from 'expo-constants';
| ^
4 | import { Platform } from 'react-native';
5 | import ExpoFontLoader from './ExpoFontLoader';
6 | const isInClient = Constants.appOwnership === 'expo';
2个回答
尝试将软件包更新到最新版本。
npm update
如果更新不起作用,请尝试使用
--force
标志进行安装。例如:
npm install --force
Rocha Moran
2022-05-22
您可以在 package.json 中添加此内容
"expo-yarn-workspaces": { "symlinks": ["expo-constants"] }
问候
Jose Valles
2022-06-07