jest-haste-map:加速模块命名冲突:尝试生成 .ipa 时反应本机
jest-haste-map: Haste module naming collision: react-native when attempting to generate .ipa
我需要为我的项目生成不同目标的 .ipa
,但是无论我是在命令行中还是通过 Xcode 执行此操作,我都会继续收到以下错误:
jest-haste-map: Haste module naming collision: react-native
The following files share their name; please adjust your hasteImpl:
* <rootDir>/node_modules/react-native/package.json
* <rootDir>/ios/build/Archive/DEV.xcarchive/Products/Applications/DEV.app/assets/node_modules/react-native/package.json
Failed to construct transformer: { Error: Duplicated files or mocks. Please check the console for more info
at setModule (/Users/danale/Projects/NFIBEngage/node_modules/jest-haste-map/build/index.js:620:17)
at workerReply (/Users/danale/Projects/NFIBEngage/node_modules/jest-haste-map/build/index.js:691:9)
at process._tickCallback (internal/process/next_tick.js:68:7)
mockPath1: 'node_modules/react-native/package.json',
mockPath2:
'ios/build/Archive/DEV.xcarchive/Products/Applications/DEV.app/assets/node_modules/react-native/package.json' }
我已经试过像这样创建 rn-cli.config.js
文件:
const blacklist = require("metro-config/src/defaults/blacklist");
module.exports = {
resolver: {
blacklistRE: blacklist([/nodejs-assets\/.*/, /android\/.*/, /ios\/.*/])
}
};
或者这个:
const blacklist = require("metro-config/src/defaults/blacklist");
module.exports = {
resolver: {
blacklistRE: blacklist([/node_modules\/.*\/node_modules\/react-native\/.*/])
}
};
这两个都不适合我。我也有 metro.config.js
:
/**
* Metro configuration for React Native
* https://github.com/facebook/react-native
*
* @format
*/
module.exports = {
transformer: {
getTransformOptions: async () => ({
transform: {
experimentalImportSupport: false,
inlineRequires: false,
},
}),
},
};
这里的步骤对我不起作用:
How to fix React Native error "jest-haste-map: Haste module naming collision"?
Naming collision in react native app start
Error: jest-haste-map: Haste module naming collision:
我已经尝试 运行 和 rm -rf ios/build
但最终当它重新创建时出现错误 returns。
有效的是运行以下命令:
rm ios/build/Archive/DEV.xcarchive/Products/Applications/DEV.app/assets/node_modules/react-native/package.json
我遇到这个问题是因为我有一个名为 node_module_bak 的重复 node_module 文件夹,该文件夹是由脚本创建的,检查您是否有相同的名称。
如果您在同一个主目录中启动了一个新项目,请尝试将其移出并将它们放在不同的地方
实际上,这个错误只是因为发生了碰撞。我不知道为什么会这样,但显然这是两者之间的冲突:
<rootDir>/node_modules/react-native/package.json
<rootDir>/ios/build/[MY_BUILD_NAME]/Build/Products/Debug-iphoneos/[MY_BUILD_NAME].app/assets/node_modules/react-native/package.json
我太清楚了,第二个没用,碰撞的根源。所以当我删除它时,一切都变得正常,一切都恢复正常。所以使用这些命令:
$ cd [YOUR_PROJECT_ROOT_PATH]
$ rm ios/build/[MY_BUILD_NAME]/Build/Products/Debug-iphoneos/[MY_BUILD_NAME].app/assets/node_modules/react-native/package.json
我需要为我的项目生成不同目标的 .ipa
,但是无论我是在命令行中还是通过 Xcode 执行此操作,我都会继续收到以下错误:
jest-haste-map: Haste module naming collision: react-native
The following files share their name; please adjust your hasteImpl:
* <rootDir>/node_modules/react-native/package.json
* <rootDir>/ios/build/Archive/DEV.xcarchive/Products/Applications/DEV.app/assets/node_modules/react-native/package.json
Failed to construct transformer: { Error: Duplicated files or mocks. Please check the console for more info
at setModule (/Users/danale/Projects/NFIBEngage/node_modules/jest-haste-map/build/index.js:620:17)
at workerReply (/Users/danale/Projects/NFIBEngage/node_modules/jest-haste-map/build/index.js:691:9)
at process._tickCallback (internal/process/next_tick.js:68:7)
mockPath1: 'node_modules/react-native/package.json',
mockPath2:
'ios/build/Archive/DEV.xcarchive/Products/Applications/DEV.app/assets/node_modules/react-native/package.json' }
我已经试过像这样创建 rn-cli.config.js
文件:
const blacklist = require("metro-config/src/defaults/blacklist");
module.exports = {
resolver: {
blacklistRE: blacklist([/nodejs-assets\/.*/, /android\/.*/, /ios\/.*/])
}
};
或者这个:
const blacklist = require("metro-config/src/defaults/blacklist");
module.exports = {
resolver: {
blacklistRE: blacklist([/node_modules\/.*\/node_modules\/react-native\/.*/])
}
};
这两个都不适合我。我也有 metro.config.js
:
/**
* Metro configuration for React Native
* https://github.com/facebook/react-native
*
* @format
*/
module.exports = {
transformer: {
getTransformOptions: async () => ({
transform: {
experimentalImportSupport: false,
inlineRequires: false,
},
}),
},
};
这里的步骤对我不起作用:
How to fix React Native error "jest-haste-map: Haste module naming collision"?
Naming collision in react native app start
Error: jest-haste-map: Haste module naming collision:
我已经尝试 运行 和 rm -rf ios/build
但最终当它重新创建时出现错误 returns。
有效的是运行以下命令:
rm ios/build/Archive/DEV.xcarchive/Products/Applications/DEV.app/assets/node_modules/react-native/package.json
我遇到这个问题是因为我有一个名为 node_module_bak 的重复 node_module 文件夹,该文件夹是由脚本创建的,检查您是否有相同的名称。
如果您在同一个主目录中启动了一个新项目,请尝试将其移出并将它们放在不同的地方
实际上,这个错误只是因为发生了碰撞。我不知道为什么会这样,但显然这是两者之间的冲突:
<rootDir>/node_modules/react-native/package.json
<rootDir>/ios/build/[MY_BUILD_NAME]/Build/Products/Debug-iphoneos/[MY_BUILD_NAME].app/assets/node_modules/react-native/package.json
我太清楚了,第二个没用,碰撞的根源。所以当我删除它时,一切都变得正常,一切都恢复正常。所以使用这些命令:
$ cd [YOUR_PROJECT_ROOT_PATH]
$ rm ios/build/[MY_BUILD_NAME]/Build/Products/Debug-iphoneos/[MY_BUILD_NAME].app/assets/node_modules/react-native/package.json