当我安装 react-native-popup-menu 时,我遇到了这样的错误。
这是错误代码
在
E:\react-native\.. 中寻找 JS 文件正在加载依赖图...(节点:9460)UnhandledPromiseRejectionWarning:错误:jest-haste-map:Haste 模块命名冲突:重复模块名称:react-native 路径:E:\react-native\........ .....\node_modules\react-native-twitter-signin\node_modules\react-native\package.json 与 E:\react-native\................\node_modules\ 发生冲突react-native\package.json
这个错误是由
hasteImpl为不同的文件返回相同的名称。在 setModule (E:\react-native\................\node_modules\jest-haste-map\build\index.js:551:17) 在 workerReply (E:\react- native\................\node_modules\jest-haste-map\build\index.js:613:9) 在 process._tickCallback (internal/process/next_tick.js:68:7 ) (node:9460) UnhandledPromiseRejectionWarning:未处理的承诺拒绝。这个错误要么是因为在没有 catch 块的情况下抛出了异步函数,要么是因为拒绝了一个没有用 .catch() 处理过的承诺。(rejection id: 2) (node:9460) [DEP0018] DeprecationWarning:不推荐使用未处理的承诺拒绝。将来,未处理的承诺拒绝将使用非零退出代码终止 Node.js 进程。(节点:9460)未处理的PromiseRejectionWarning:错误:jest-haste-map:此错误是由
hasteImpl为不同文件返回相同名称引起的。在 setModule (E:\react-native\................\node_modules\jest-haste-map\build\index.js:551:17) 在 workerReply (E:\react- native\................\node_modules\jest-haste-map\build\index.js:613:9) 在 process._tickCallback (internal/process/next_tick.js:68:7 ) (node:9460) UnhandledPromiseRejectionWarning:未处理的承诺拒绝。这个错误要么是因为在没有 catch 块的情况下抛出了异步函数,要么是因为拒绝了一个没有用 .catch() 处理过的承诺。(拒绝编号:3)
我试图找到解决此错误的方法,但找不到任何解决方案。
我在C编程语言中使用char数组有两个不同版本的代码.
第一版:
int main(int argc, char *argv[]) {
return 0;
}
Run Code Online (Sandbox Code Playgroud)
第二版:
int main(int argc, char *argv) {
return 0;
}
Run Code Online (Sandbox Code Playgroud)
所有代码编译时没有警告或错误,所以这些代码之间有什么区别?
我是编码新手,曾被问过这个问题;
创建一个将接收手机号码字符串的函数。如果该号码是有效的英国号码,则应返回 true,否则返回 false。
有效的手机号码可能以“07”开头,后跟 9 位数字。它也可能以“+447”开头,后跟 9 个数字。它也可能以“00447”开头,后跟 9 个数字。其他的都是无效的。
这是我创建的代码;
function validMobileNumber(num) {
if (num.length != 9)
{
return false
}
if (num.length = 9 && num.includes(07, 0) && num.includes(+447, 0) && num.includes(00447, 0)) {
return true
}
}
Run Code Online (Sandbox Code Playgroud)
我的代码将针对此运行;
describe("validMobileNumber", () => {
it("returns false when passed a string of the wrong length", () => {
expect(validMobileNumber("123")).to.equal(false);
expect(validMobileNumber("0750617250638")).to.equal(false);
expect(validMobileNumber("+447712368768724988")).to.equal(false);
});
it("returns true when passed a valid plain phone num string", () => {
expect(validMobileNumber("07506172506")).to.equal(true);
});
it("returns true …Run Code Online (Sandbox Code Playgroud) javascript ×2
arrays ×1
c ×1
char ×1
include ×1
jestjs ×1
node.js ×1
numbers ×1
react-native ×1
reactjs ×1