所以我有一个单一的回购协议,包括用于 React Native/React Native Web 应用程序的 Next 和 Expo。
尝试在 Expo 上构建时出现此错误:
我运行的命令是这样的:
npx expo run:ios
我最好的猜测是这是由于提升或我的 metro.config.js
我有防止吊装的规则:
{
"name": "frontend",
"private": true,
"workspaces": {
"packages": [
"apps/*",
"packages/*"
],
"nohoist": [
"**/next",
"**/next/**"
]
},
"devDependencies": {
"eslint": "^8.11.0",
"eslint-plugin-react-hooks": "^4.6.0",
"turbo": "^1.1.6",
"typescript": "^4.6.2"
},
"scripts": {
"native": "cd apps/expo && expo start",
"web": "cd apps/next && yarn next dev",
"postinstall": "patch-package"
}
}
我的 metro.config.js 是建议用于 monorepo 的:
const { getDefaultConfig } = require('expo/metro-config');
const path = require('path');
const projectRoot = __dirname;
const workspaceRoot = path.resolve(projectRoot, '../..');
const config = getDefaultConfig(projectRoot);
config.watchFolders = [workspaceRoot];
config.resolver.nodeModulesPaths = [
path.resolve(projectRoot, 'node_modules'),
path.resolve(workspaceRoot, 'node_modules'),
];
config.resolver.disableHierarchicalLookup = true;
module.exports = config;
我的目录结构是:
/
/apps
/expo
/next
/packages
/app
这可能是什么原因造成的?安装加密不会解决它,因为它只会导致一堆我不希望在我的 iOS 或 Android 应用程序中出现的服务器端节点依赖项。