[英]Naming collision in react native app start
I'm using the out-of-the box react native framework to try to build a new app. 我正在使用开箱即用的反应本机框架来尝试构建新的应用程序。
i used the following commands ind CMD (Windows 10). 我在ind CMD(Windows 10)中使用了以下命令。
node -v: v8.12.0 节点-v:v8.12.0
npm -v: 6.4.1 npm -v:6.4.1
mkdir react-native-workspace mkdir react-native-workspace
cd react-native-workspace cd react-native-workspace
npm install -g create-react-native-app npm install -g create-react-native-app
create-react-native-app Exercise2 create-react-native-app练习2
cd Exercise2 cd练习2
npm start npm开始
ERROR 12:42 (node:15564) UnhandledPromiseRejectionWarning: Error: jest-haste-map: @providesModule naming collision: Duplicate module name: my-new-project Paths: C:\\Users\\wp_99\\Dokumenter\\react-native-workspace\\Exercise2\\package.json collides with C:\\Users\\wp_99\\Documents\\react-native-workspace\\Exercise2\\package.json
错误12:42(节点:15564)UnhandledPromiseRejectionWarning:错误:开玩笑的地图:@providesModule命名冲突:重复的模块名称:我的新项目路径:C:\\ Users \\ wp_99 \\ Dokumenter \\ react-native-workspace \\ Exercise2 \\ package.json与C:\\ Users \\ wp_99 \\ Documents \\ react-native-workspace \\ Exercise2 \\ package.json冲突
This error is caused by a @providesModule declaration with the same name across two different files.
此错误是由两个不同文件中具有相同名称的@providesModule声明引起的。 at setModule (C:\\Users\\wp_99\\Documents\\react-native-workspace\\Exercise2\\node_modules\\metro\\node_modules\\jest-haste-map\\build\\index.js:462:17) at workerReply (C:\\Users\\wp_99\\Documents\\react-native-workspace\\Exercise2\\node_modules\\metro\\node_modules\\jest-haste-map\\build\\index.js:512:9) at at process._tickCallback (internal/process/next_tick.js:189:7) ERROR 12:42 (node:15564) UnhandledPromiseRejectionWarning: Unhandled promise rejection.
在工作人员回复(C:\\ Users \\下)的setModule(C:\\ Users \\ wp_99 \\ Documents \\ react-native-workspace \\ Exercise2 \\ node_modules \\ metro \\ node_modules \\ jest-haste-map \\ build \\ index.js:462:17)下wp_99 \\ Documents \\ react-native-workspace \\ Exercise2 \\ node_modules \\ metro \\ node_modules \\ jest-haste-map \\ build \\ index.js:512:9)在进程中._tickCallback(内部/进程/next_tick.js:189: 7)错误12:42(节点:15564)UnhandledPromiseRejectionWarning:未处理的承诺拒绝。 This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch().
引发此错误的原因可能是抛出了一个没有catch块的异步函数,或者是拒绝了一个.catch()无法处理的承诺。 (rejection id: 2) (node:15564) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated.
(拒绝ID:2)(节点:15564)[DEP0018] DeprecationWarning:已弃用未处理的承诺拒绝。 In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
将来,未处理的承诺拒绝将以非零退出代码终止Node.js进程。
It's a bug in the metro-bundler. 这是地铁捆绑机中的错误。 You should create rn-cli.config.js and add this configuration to it:
您应该创建rn-cli.config.js并将此配置添加到其中:
For react-native>=0.57 对于本机> = 0.57
const blacklist = require('metro-config/src/defaults/blacklist');
module.exports = {
resolver:{
blacklistRE: blacklist([
/nodejs-assets\/.*/,
/android\/.*/,
/ios\/.*/
])
},
};
react-native < 0.57 反应本征<0.57
const blacklist = require('metro/src/blacklist');
module.exports = {
getBlacklistRE: function() {
return blacklist([
/nodejs-assets\/.*/,
/android\/.*/,
/ios\/.*/
]);
},
};
I've added the following to rn-cli.config.js 我在rn-cli.config.js中添加了以下内容
const blacklist = require('metro-config/src/defaults/blacklist');
module.exports = {
resolver: {
blacklistRE: blacklist([
/node_modules\/.*\/node_modules\/react-native\/.*/,
])
},
};
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.